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)
172
172
retval
173
173
}
174
174
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
+
175
197
# Method redefinition (code invalidation) and GC
176
198
assert_equal '7' , %q{
177
199
def bar()
Original file line number Diff line number Diff line change @@ -888,7 +888,11 @@ invalidate_block_version(block_t* block)
888
888
{
889
889
branch_t * branch = rb_darray_get (block -> incoming , incoming_idx );
890
890
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 ;
892
896
893
897
// Create a stub for this branch target
894
898
branch -> dst_addrs [target_idx ] = get_branch_target (
@@ -898,9 +902,6 @@ invalidate_block_version(block_t* block)
898
902
target_idx
899
903
);
900
904
901
- // Mark this target as being a stub
902
- branch -> blocks [target_idx ] = NULL ;
903
-
904
905
// Check if the invalidated block immediately follows
905
906
bool target_next = block -> start_pos == branch -> end_pos ;
906
907
You can’t perform that action at this time.
0 commit comments