diff --git a/basis/compiler/cfg/instructions/instructions.factor b/basis/compiler/cfg/instructions/instructions.factor index 29d9f4a5fd..812e206c95 100644 --- a/basis/compiler/cfg/instructions/instructions.factor +++ b/basis/compiler/cfg/instructions/instructions.factor @@ -84,6 +84,8 @@ INSN: ##epilogue ; INSN: ##return ; +INSN: ##safepoint ; + ! Dummy instruction that simply inhibits TCO INSN: ##no-tco ; diff --git a/basis/compiler/cfg/scheduling/scheduling.factor b/basis/compiler/cfg/scheduling/scheduling.factor index 68effe02f5..05c738d8fd 100644 --- a/basis/compiler/cfg/scheduling/scheduling.factor +++ b/basis/compiler/cfg/scheduling/scheduling.factor @@ -57,6 +57,7 @@ UNION: final-insn ##branch ##dispatch conditional-branch-insn +##safepoint ##epilogue ##return ##callback-outputs ; diff --git a/basis/compiler/codegen/codegen.factor b/basis/compiler/codegen/codegen.factor index 53fdb458c6..3434085685 100755 --- a/basis/compiler/codegen/codegen.factor +++ b/basis/compiler/codegen/codegen.factor @@ -160,6 +160,7 @@ CODEGEN: ##inc-r %inc-r CODEGEN: ##call %call CODEGEN: ##jump %jump CODEGEN: ##return %return +CODEGEN: ##safepoint %safepoint CODEGEN: ##slot %slot CODEGEN: ##slot-imm %slot-imm CODEGEN: ##set-slot %set-slot diff --git a/basis/cpu/architecture/architecture.factor b/basis/cpu/architecture/architecture.factor index 265bb8894e..561787e2ba 100644 --- a/basis/cpu/architecture/architecture.factor +++ b/basis/cpu/architecture/architecture.factor @@ -495,6 +495,8 @@ HOOK: %call-gc cpu ( gc-map -- ) HOOK: %prologue cpu ( n -- ) HOOK: %epilogue cpu ( n -- ) +HOOK: %safepoint cpu ( -- ) + HOOK: test-instruction? cpu ( -- ? ) M: object test-instruction? f ; diff --git a/basis/cpu/x86/32/32.factor b/basis/cpu/x86/32/32.factor index d12d16181d..eba669b909 100755 --- a/basis/cpu/x86/32/32.factor +++ b/basis/cpu/x86/32/32.factor @@ -218,6 +218,9 @@ M:: x86.32 stack-cleanup ( stack-size return abi -- n ) M: x86.32 %cleanup ( n -- ) [ ESP swap SUB ] unless-zero ; +M: x86.32 %safepoint + 0 EAX MOVABS rc-absolute rel-safepoint ; + M: x86.32 dummy-stack-params? f ; M: x86.32 dummy-int-params? f ; diff --git a/basis/cpu/x86/64/64.factor b/basis/cpu/x86/64/64.factor index b675107bce..c7ef46aac2 100644 --- a/basis/cpu/x86/64/64.factor +++ b/basis/cpu/x86/64/64.factor @@ -130,6 +130,9 @@ M: x86.64 stack-cleanup 3drop 0 ; M: x86.64 %cleanup 0 assert= ; +M: x86.64 %safepoint + 0 [RIP+] EAX MOV rc-relative rel-safepoint ; + M: x86.64 long-long-on-stack? f ; M: x86.64 float-on-stack? f ;