• Kevin Modzelewski's avatar
    Some small independent changes · 31f7002a
    Kevin Modzelewski authored
    Can emit add/sub/etc instructions with 32-bit operands in addition to 8-bit now
    Can get the RSP and RBP in rewriter1, for accessing scratch space
    Change some debugging output
    
    Fix a gc bug: if an object gets new'd, and takes a parameter that gets new'd, the sequence is
    1) object space gets allocated
    2) parameter space gets allocated
    3) parameter gets constructed
    4) object gets constructed
    The bug is that the object construction is what initializes the GC header,
    so if step #3 causes a collection, it can see that the allocation from step #1
    has an invalid header.
    As a workaround, always zero out the header in allocation, and skip blocks with
    zeroed headers.
    The real solution is probably to have the GC manage the header itself rather than
    expecting the user to; this would mean that gc_alloc would take the allocation kind,
    put that into the header, and then return a pointer to the post-header data section
    of the allocation.
    31f7002a
rewriter.cpp 12.5 KB