Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fix setting the PC and CF when changing callframe.

When trying to move the PC forward one op, increment by 4.
Also, before returning to the caller callframe, set the caller CF to point to
itself instead of the callee.
  • Loading branch information...
commit eb814820fdfdf15ccdbc55017e41b1f599aeeaff 1 parent ad01bd6
@nbrown nbrown authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 t/m0/integration/m0_poke_caller.m0
8 t/m0/integration/m0_poke_caller.m0
@@ -119,14 +119,14 @@ init_cf_retpc:
# 1 register needed
# Set the return PC for the current cf so that control flow will resume at
# the 'retpc' label.
- set_imm I13, 0, 10
+ set_imm I13, 0, 40
add_i RETPC, PC, I13
# 3 register needed (2x I, 1x P)
# Set the new call frame's PC to the 'post_set' label so that when it's
# activated, control flow will continue as normal.
- set_imm I12, 0, 4
+ set_imm I12, 0, 12
add_i I12, I12, PC
set_imm I9, 0, PC
set_ref P0, I9, I12
@@ -163,10 +163,12 @@ restore_cf:
# Set PCF[PC] to the invoke_cf + 1 so that when we invoke PCF with
# "set CF, PCF, x", control flow will continue at the next instruction.
- set_imm I1, 0, 3
+ set_imm I1, 0, 20
add_i I1, PC, I1
set_imm I9, 0, PC
set_ref PCF, I9, I1
+ set_imm I9, 0, CF
+ set_ref PCF, I9, PCF
set CF, PCF, x

0 comments on commit eb81482

Please sign in to comment.
Something went wrong with that request. Please try again.