mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-09-22 23:18:01 +03:00
In hll_call(), pointers to heap data passed by reference could become invalid if the heap was reallocated during the call. The previous implementation attempted to prevent this by calling heap_guarantee() to pre-allocate heap space. However, this approach does not work for certain functions in PastelChime2 HLL, which can perform an unbounded number of heap allocations. This commit removes heap_guarantee() and replaces it with a more robust copy-in/copy-out strategy: - Before the call (Copy-in): For reference arguments, the pointer value is copied from the heap to a local variable on the stack. A pointer to this local variable is then passed to the HLL function. - After the call (Copy-out): The pointer value, which may have been modified by the HLL function, is written back from the local variable to its original slot in the heap.