Project

General

Profile

ยซ Previous | Next ยป 

Revision 5ca71364

Added by jhawthorn (John Hawthorn) 2 months ago

Avoid GC while operands in inconsistent state

compile_data_calloc2 may run GC (though because it allocates from an
arena this is rare in practice). When this happened when resizing
operands there was a risk of seeing the insn in an inconsistent state.

To solve this we need to make any allocations before we start modifying
the instrucitons. This refactors the code to use a new
insn_replace_with_operands() function that allocates the new operands
array before modifying the instruction object.

Co-authored-by: Aaron Patterson