1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-15 16:20:17 +02:00

Reserve frame word for machine return address

* libguile/frames.h: Add machine return address to diagram.
  (SCM_FRAME_MACHINE_RETURN_ADDRESS):
  (SCM_FRAME_SET_MACHINE_RETURN_ADDRESS): New macros.
  (SCM_FRAME_PREVIOUS_SP):
  (SCM_FRAME_DYNAMIC_LINK):
  (SCM_FRAME_SET_DYNAMIC_LINK): Adapt for new frame size.
* libguile/vm-engine.c (halt): Set frame size to 3.
  (call, call-label): Set mRA to 0.
* libguile/vm.c (push_interrupt_frame, reinstate_continuation_x):
  (scm_call_n): Set frame size to 3.  In push_interrupt_frame, init the
  mRA of the frame.
  (vm_builtin_call_with_values_code, vm_handle_interrupt_code): Allocate
  larger frames.
* module/language/cps/slot-allocation.scm (allocate-slots): Frame size
  is 3.
* module/system/vm/disassembler.scm (define-clobber-parser): Bump frame
  size.
This commit is contained in:
Andy Wingo 2018-07-16 15:42:05 +02:00
parent b1705bd0f0
commit 043432fd57
5 changed files with 33 additions and 24 deletions

View file

@ -321,7 +321,7 @@ VM_NAME (scm_thread *thread)
*/
VM_DEFINE_OP (0, halt, "halt", OP1 (X32))
{
size_t frame_size = 2;
size_t frame_size = 3;
/* Boot closure, then empty frame, then callee, then values. */
size_t first_value = 1 + frame_size + 1;
uint32_t nvals = FRAME_LOCALS_COUNT_FROM (first_value);
@ -373,6 +373,7 @@ VM_NAME (scm_thread *thread)
VP->fp = SCM_FRAME_SLOT (old_fp, proc - 1);
SCM_FRAME_SET_DYNAMIC_LINK (VP->fp, old_fp);
SCM_FRAME_SET_VIRTUAL_RETURN_ADDRESS (VP->fp, ip + 2);
SCM_FRAME_SET_MACHINE_RETURN_ADDRESS (VP->fp, 0);
RESET_FRAME (nlocals);
@ -416,6 +417,7 @@ VM_NAME (scm_thread *thread)
VP->fp = SCM_FRAME_SLOT (old_fp, proc - 1);
SCM_FRAME_SET_DYNAMIC_LINK (VP->fp, old_fp);
SCM_FRAME_SET_VIRTUAL_RETURN_ADDRESS (VP->fp, ip + 3);
SCM_FRAME_SET_MACHINE_RETURN_ADDRESS (VP->fp, 0);
RESET_FRAME (nlocals);