Commit b5758a8a
b5758a8afeb5Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified
Description
Merge pull request #209 from mame/pr/gc-root-range-and-times-map
fix(codegen): SP_GC_ROOT Range#map / N.times.map accumulators
Details
- Commit
- b5758a8afeb5
- Parent
- 95b51ab5502a
- Merge parent
- 09252cc49467
spinel_codegen.rbmodifiedView file
@@ -26983,6 +26983,11 @@
2698326983
@needs_int_array = 12698426984
emit(" sp_IntArray *" + tmp_arrn + " = sp_IntArray_new();")2698526985
end26986+
# Root the accumulator so a GC pass triggered by an26987+
# allocation inside the block (e.g. string interpolation)26988+
# doesn't free the half-built array. Same reasoning as the26989+
# int_array / str_array branches further down.26990+
emit(" SP_GC_ROOT(" + tmp_arrn + ");")2698626991
emit(" for (mrb_int " + tmp_in + " = 0; " + tmp_in + " < " + ncount + "; " + tmp_in + "++) {")2698726992
if bpn != ""2698826993
emit(" lv_" + bpn + " = " + tmp_in + ";")@@ -27064,6 +27069,11 @@
2706427069
else2706527070
emit(" sp_IntArray *" + tmp_arr + " = sp_IntArray_new();")2706627071
end27072+
# Root the accumulator so a GC pass triggered by an27073+
# allocation inside the block (e.g. string interpolation)27074+
# doesn't free the half-built array. Same reasoning as the27075+
# int_array / str_array branches further down.27076+
emit(" SP_GC_ROOT(" + tmp_arr + ");")2706727077
# Walk through ParenthesesNode wrappers to find a literal2706827078
# RangeNode (so we can read its exclude_end flag and its raw2706927079
# endpoint expressions). If the receiver is a variable holdingtest/gc_root_range_and_times_map.rbaddedView file
Loading diff…
test/gc_root_range_and_times_map.rb.expectedaddedView file
Loading diff…