Files
nunuhara_xsystem4/include/vm
kichikuou f0e25e53d7 ffi: Make HLL calls safe against heap reallocation
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.
2025-09-06 07:34:29 +09:00
..