File tree Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,28 @@ def alias_then_hash(klass, method_to_redefine)
172172 retval
173173}
174174
175+ # Code invalidation and opt_getinlinecache
176+ assert_normal_exit %q{
177+ class Foo; end
178+
179+ # Uses the class constant Foo
180+ def use_constant(arg)
181+ [Foo.new, arg]
182+ end
183+
184+ def propagate_type
185+ i = Array.new
186+ i.itself # make it remember that i is on-heap
187+ use_constant(i)
188+ end
189+
190+ propagate_type
191+ propagate_type
192+ use_constant(Foo.new)
193+ class Jo; end # bump global constant state
194+ use_constant(3)
195+ }
196+
175197# Method redefinition (code invalidation) and GC
176198assert_equal '7' , %q{
177199 def bar()
Original file line number Diff line number Diff line change @@ -888,7 +888,11 @@ invalidate_block_version(block_t* block)
888888 {
889889 branch_t * branch = rb_darray_get (block -> incoming , incoming_idx );
890890 uint32_t target_idx = (branch -> dst_addrs [0 ] == code_ptr )? 0 :1 ;
891- RUBY_ASSERT (!branch -> blocks [target_idx ] || branch -> blocks [target_idx ] == block );
891+ RUBY_ASSERT (branch -> dst_addrs [target_idx ] == code_ptr );
892+ RUBY_ASSERT (branch -> blocks [target_idx ] == block );
893+
894+ // Mark this target as being a stub
895+ branch -> blocks [target_idx ] = NULL ;
892896
893897 // Create a stub for this branch target
894898 branch -> dst_addrs [target_idx ] = get_branch_target (
@@ -898,9 +902,6 @@ invalidate_block_version(block_t* block)
898902 target_idx
899903 );
900904
901- // Mark this target as being a stub
902- branch -> blocks [target_idx ] = NULL ;
903-
904905 // Check if the invalidated block immediately follows
905906 bool target_next = block -> start_pos == branch -> end_pos ;
906907
You can’t perform that action at this time.
0 commit comments