]> gitweb.factorcode.org Git - factor.git/blob - basis/bootstrap/assembler/x86.windows.factor
factor: trim using lists
[factor.git] / basis / bootstrap / assembler / x86.windows.factor
1 ! Copyright (C) 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: compiler.constants cpu.x86.assembler
4 cpu.x86.assembler.operands layouts ;
5 IN: bootstrap.x86
6
7 : tib-exception-list-offset ( -- n ) 0 bootstrap-cells ;
8 : tib-stack-base-offset ( -- n ) 1 bootstrap-cells ;
9 : tib-stack-limit-offset ( -- n ) 2 bootstrap-cells ;
10
11 : jit-save-tib ( -- )
12     tib-exception-list-offset [] tib-segment PUSH
13     tib-stack-base-offset [] tib-segment PUSH
14     tib-stack-limit-offset [] tib-segment PUSH ;
15
16 : jit-restore-tib ( -- )
17     tib-stack-limit-offset [] tib-segment POP
18     tib-stack-base-offset [] tib-segment POP
19     tib-exception-list-offset [] tib-segment POP ;
20
21 :: jit-update-tib ( ctx-reg -- )
22     ! There's a redundant load here because we're not allowed
23     ! to clobber ctx-reg. Clobbers tib-temp.
24     ! Save callstack base in TIB
25     tib-temp ctx-reg context-callstack-seg-offset [+] MOV
26     tib-temp tib-temp segment-end-offset [+] MOV
27     tib-stack-base-offset [] tib-temp tib-segment MOV
28     ! Save callstack limit in TIB
29     tib-temp ctx-reg context-callstack-seg-offset [+] MOV
30     tib-temp tib-temp segment-start-offset [+] MOV
31     tib-stack-limit-offset [] tib-temp tib-segment MOV ;