ESP [] vm-reg MOV
"new_context" jit-call
- ! Save pointer to quotation and parameter, pop them off the
- ! datastack
+ ! Save pointer to quotation and parameter
EBX ds-reg MOV
ds-reg 8 SUB
- ! Make the new context the active context
+ ! Make the new context active
EAX jit-set-context
! Push parameter
] \ (start-context) define-sub-primitive
[
- ! Load context from datastack
+ ! Load context and parameter from datastack
EAX ds-reg [] MOV
EAX EAX alien-offset [+] MOV
- ds-reg 4 SUB
+ EBX ds-reg -4 [+] MOV
+ ds-reg 8 SUB
- ! Make it the active context
+ ! Make the new context active
EAX jit-set-context
! Twiddle stack for return
ESP 4 ADD
+
+ ! Store parameter to datastack
+ ds-reg 4 ADD
+ ds-reg [] EBX MOV
] \ (set-context) define-sub-primitive
<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >>
arg1 vm-reg MOV
"new_context" jit-call
- ! Load quotation from datastack
+ ! Load quotation and parameter from datastack
arg1 ds-reg [] MOV
-
- ! Load parameter from datastack
arg2 ds-reg -8 [+] MOV
-
ds-reg 16 SUB
- ! Make the new context the active context
+ ! Make the new context active
return-reg jit-set-context
! Push parameter
] \ (start-context) define-sub-primitive
[
- ! Load context from datastack
+ ! Load context and parameter from datastack
temp0 ds-reg [] MOV
temp0 temp0 alien-offset [+] MOV
- ds-reg 8 SUB
+ temp1 ds-reg -8 [+] MOV
+ ds-reg 16 SUB
- ! Make it the active context
+ ! Make the new context active
temp0 jit-set-context
! Twiddle stack for return
RSP 8 ADD
+
+ ! Store parameter to datastack
+ ds-reg 8 ADD
+ ds-reg [] temp1 MOV
] \ (set-context) define-sub-primitive
<< "vocab:cpu/x86/bootstrap.factor" parse-file suffix! >>
\ delete-context { c-ptr } { } define-primitive
-\ (start-context) { object quotation } { } define-primitive
+\ (start-context) { object quotation } { object } define-primitive
-\ (set-context) { alien } { } define-primitive
+\ (set-context) { object alien } { object } define-primitive
\ special-object { fixnum } { object } define-primitive
\ special-object make-flushable
{ "fixnum<=" "math.private" (( x y -- z )) }
{ "fixnum>" "math.private" (( x y -- ? )) }
{ "fixnum>=" "math.private" (( x y -- ? )) }
- { "(set-context)" "threads.private" (( context -- )) }
- { "(start-context)" "threads.private" (( obj quot -- )) }
+ { "(set-context)" "threads.private" (( obj context -- obj' )) }
+ { "(start-context)" "threads.private" (( obj quot -- obj' )) }
} [ first3 make-sub-primitive ] each
! Primitive words