diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-03-25 20:29:09 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-25 20:29:09 +0900 |
commit | 69967ee64eac9ce65b83533a566d69d12a6046d0 (patch) | |
tree | b7012ba8b7ad5b1c99d7b1f9b2345ecd8117f433 /bootstraptest | |
parent | 7ee26740e41f99d3da37df36b956237fbf36868e (diff) | |
download | ruby-69967ee64eac9ce65b83533a566d69d12a6046d0.tar.gz |
Revert "Finer-grained inline constant cache invalidation"
This reverts commits for [Feature #18589]:
* 8008fb7352abc6fba433b99bf20763cf0d4adb38
"Update formatting per feedback"
* 8f6eaca2e19828e92ecdb28b0fe693d606a03f96
"Delete ID from constant cache table if it becomes empty on ISEQ free"
* 629908586b4bead1103267652f8b96b1083573a8
"Finer-grained inline constant cache invalidation"
MSWin builds on AppVeyor have been crashing since the merger.
Diffstat (limited to 'bootstraptest')
-rw-r--r-- | bootstraptest/test_constant_cache.rb | 187 |
1 files changed, 0 insertions, 187 deletions
diff --git a/bootstraptest/test_constant_cache.rb b/bootstraptest/test_constant_cache.rb deleted file mode 100644 index 1fa83256ed..0000000000 --- a/bootstraptest/test_constant_cache.rb +++ /dev/null @@ -1,187 +0,0 @@ -# Constant lookup is cached. -assert_equal '1', %q{ - CONST = 1 - - def const - CONST - end - - const - const -} - -# Invalidate when a constant is set. -assert_equal '2', %q{ - CONST = 1 - - def const - CONST - end - - const - - CONST = 2 - - const -} - -# Invalidate when a constant of the same name is set. -assert_equal '1', %q{ - CONST = 1 - - def const - CONST - end - - const - - class Container - CONST = 2 - end - - const -} - -# Invalidate when a constant is removed. -assert_equal 'missing', %q{ - class Container - CONST = 1 - - def const - CONST - end - - def self.const_missing(name) - 'missing' - end - - new.const - remove_const :CONST - end - - Container.new.const -} - -# Invalidate when a constant's visibility changes. -assert_equal 'missing', %q{ - class Container - CONST = 1 - - def self.const_missing(name) - 'missing' - end - end - - def const - Container::CONST - end - - const - - Container.private_constant :CONST - - const -} - -# Invalidate when a constant's visibility changes even if the call to the -# visibility change method fails. -assert_equal 'missing', %q{ - class Container - CONST1 = 1 - - def self.const_missing(name) - 'missing' - end - end - - def const1 - Container::CONST1 - end - - const1 - - begin - Container.private_constant :CONST1, :CONST2 - rescue NameError - end - - const1 -} - -# Invalidate when a module is included. -assert_equal 'INCLUDE', %q{ - module Include - CONST = :INCLUDE - end - - class Parent - CONST = :PARENT - end - - class Child < Parent - def const - CONST - end - - new.const - - include Include - end - - Child.new.const -} - -# Invalidate when const_missing is hit. -assert_equal '2', %q{ - module Container - Foo = 1 - Bar = 2 - - class << self - attr_accessor :count - - def const_missing(name) - @count += 1 - @count == 1 ? Foo : Bar - end - end - - @count = 0 - end - - def const - Container::Baz - end - - const - const -} - -# Invalidate when the iseq gets cleaned up. -assert_equal '2', %q{ - CONSTANT = 1 - - iseq = RubyVM::InstructionSequence.compile(<<~RUBY) - CONSTANT - RUBY - - iseq.eval - iseq = nil - - GC.start - CONSTANT = 2 -} - -# Invalidate when the iseq gets cleaned up even if it was never in the cache. -assert_equal '2', %q{ - CONSTANT = 1 - - iseq = RubyVM::InstructionSequence.compile(<<~RUBY) - CONSTANT - RUBY - - iseq = nil - - GC.start - CONSTANT = 2 -} |