Installation with RVM:
$ rvm install 2.2.3 --patch https://gist.githubusercontent.com/tdg5/0fba32242ccc39e71577/raw/b0d869e006761c74dac4ed9dbb779a56b424b63c/ruby_tco.patch
2024-06-11T13:55:58.652-0400 [INFO] Terraform version: 1.8.3 | |
2024-06-11T13:55:58.653-0400 [DEBUG] using github.com/hashicorp/go-tfe v1.51.0 | |
2024-06-11T13:55:58.653-0400 [DEBUG] using github.com/hashicorp/hcl/v2 v2.20.0 | |
2024-06-11T13:55:58.653-0400 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1 | |
2024-06-11T13:55:58.653-0400 [DEBUG] using github.com/zclconf/go-cty v1.14.3 | |
2024-06-11T13:55:58.653-0400 [INFO] Go runtime version: go1.22.1 | |
2024-06-11T13:55:58.653-0400 [INFO] CLI args: []string{"terraform", "apply", "-auto-approve"} | |
2024-06-11T13:55:58.653-0400 [DEBUG] Attempting to open CLI config file: /Users/danny/.terraformrc | |
2024-06-11T13:55:58.653-0400 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. | |
2024-06-11T13:55:58.653-0400 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins |
Installation with RVM:
$ rvm install 2.2.3 --patch https://gist.githubusercontent.com/tdg5/0fba32242ccc39e71577/raw/b0d869e006761c74dac4ed9dbb779a56b424b63c/ruby_tco.patch
/* | |
https://github.com/apache/cassandra/blob/cassandra-2.0/src/java/org/apache/cassandra/db/compaction/CompactionManager.java#L523 | |
*/ | |
private void doCleanupCompaction(final ColumnFamilyStore cfs, Collection<SSTableReader> sstables, CounterId.OneShotRenewer renewer) throws IOException | |
{ | |
assert !cfs.isIndex(); | |
Keyspace keyspace = cfs.keyspace; | |
Collection<Range<Token>> ranges = StorageService.instance.getLocalRanges(keyspace.getName()); | |
if (ranges.isEmpty()) | |
{ |
require "tco_method" | |
# Wrap method definitons in a lambda to facilitate recompiling with tail call | |
# optimization enabled. | |
tail_calls = lambda do |this| | |
def start_tail_call_chain | |
implicit_tail_call | |
end | |
def implicit_tail_call |
# Create some special classes to facilitate tracking allocated objects. | |
class TrackedArray < Array; end | |
class TrackedString < String; end | |
STRANG = "a" * 5000 | |
class ClingyObjects | |
def generate(should_cling = false) | |
strs = TrackedArray.new | |
30000.times { strs << TrackedString.new(STRANG) } |
# Create some special classes to facilitate tracking allocated objects. | |
class TrackedArray < Array; end | |
class TrackedString < String; end | |
STRANG = "a" * 5000 | |
# Other than a few extra escapes, the code below can be understood more or less | |
# as is. Any weirdness is to facilitate interpretting with/without tail-call | |
# optimization in a DRY manner. | |
KLASS = <<-CODE | |
class GcFriendlyTco |
# Abstract UnionList base class | |
class AbstractUnionList | |
private :initialize | |
def length | |
how_many?(0) | |
end | |
def how_many?(counter) | |
raise NotImplementedError |
%w[ | |
after_read | |
before_eval | |
after_eval | |
when_started | |
before_session | |
after_session | |
].each do |hook| | |
Pry.config.hooks.add_hook(hook.to_sym, "my_#{hook}_hook") do |_, _, _| | |
puts "hello from #{hook}" |
module PartiallyImplementedInterface | |
def self.not_implemented_error(klass, method) | |
raise NotImplementedError, not_implemented_message(klass, method), caller(2) | |
end | |
def self.not_implemented_message(klass, method_name) | |
"#{method_name} must be implemented by subclasses of #{klass.name}!" | |
end | |
private_class_method :not_implemented_message |
def self.pbt_deep_dup_build(clone, original) | |
mapped = Set.new | |
edges = [[clone, original]] | |
while edges.any? | |
builder, twin = edges.shift | |
pair_hash = "#{builder.class.name}:#{builder.hash}~#{twin.hash}".hash | |
next if mapped.include?(pair_hash) | |
mapped << pair_hash | |
pbt_dup_build(builder, twin) |