]> gitweb.factorcode.org Git - factor.git/blob - basis/compiler/constants/constants.factor
compiler: tweak ##write-barrier-imm
[factor.git] / basis / compiler / constants / constants.factor
1 ! Copyright (C) 2008, 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: math kernel layouts system strings words quotations byte-arrays
4 alien arrays literals sequences ;
5 IN: compiler.constants
6
7 ! These constants must match vm/memory.h
8 CONSTANT: card-bits 8
9 CONSTANT: deck-bits 18
10 : card-mark ( -- n ) HEX: 40 HEX: 80 bitor ; inline
11
12 ! These constants must match vm/layouts.h
13 : slot-offset ( slot tag -- n ) [ bootstrap-cells ] dip - ; inline
14
15 : header-offset ( -- n ) 0 object tag-number slot-offset ; inline
16 : float-offset ( -- n ) 8 float tag-number - ; inline
17 : string-offset ( -- n ) 4 string tag-number slot-offset ; inline
18 : string-aux-offset ( -- n ) 2 string tag-number slot-offset ; inline
19 : profile-count-offset ( -- n ) 8 \ word tag-number slot-offset ; inline
20 : byte-array-offset ( -- n ) 2 byte-array tag-number slot-offset ; inline
21 : alien-offset ( -- n ) 3 alien tag-number slot-offset ; inline
22 : underlying-alien-offset ( -- n ) 1 alien tag-number slot-offset ; inline
23 : tuple-class-offset ( -- n ) 1 tuple tag-number slot-offset ; inline
24 : word-xt-offset ( -- n ) 10 \ word tag-number slot-offset ; inline
25 : quot-xt-offset ( -- n ) 4 quotation tag-number slot-offset ; inline
26 : word-code-offset ( -- n ) 11 \ word tag-number slot-offset ; inline
27 : array-start-offset ( -- n ) 2 array tag-number slot-offset ; inline
28 : compiled-header-size ( -- n ) 4 bootstrap-cells ; inline
29
30 ! Relocation classes
31 CONSTANT: rc-absolute-cell 0
32 CONSTANT: rc-absolute 1
33 CONSTANT: rc-relative 2
34 CONSTANT: rc-absolute-ppc-2/2 3
35 CONSTANT: rc-absolute-ppc-2 4
36 CONSTANT: rc-relative-ppc-2 5
37 CONSTANT: rc-relative-ppc-3 6
38 CONSTANT: rc-relative-arm-3 7
39 CONSTANT: rc-indirect-arm 8
40 CONSTANT: rc-indirect-arm-pc 9
41
42 ! Relocation types
43 CONSTANT: rt-primitive 0
44 CONSTANT: rt-dlsym 1
45 CONSTANT: rt-dispatch 2
46 CONSTANT: rt-xt 3
47 CONSTANT: rt-xt-pic 4
48 CONSTANT: rt-xt-pic-tail 5
49 CONSTANT: rt-here 6
50 CONSTANT: rt-this 7
51 CONSTANT: rt-immediate 8
52 CONSTANT: rt-stack-chain 9
53 CONSTANT: rt-untagged 10
54 CONSTANT: rt-megamorphic-cache-hits 11
55 CONSTANT: rt-vm 12
56 CONSTANT: rt-cards-offset 13
57 CONSTANT: rt-decks-offset 14
58
59 : rc-absolute? ( n -- ? )
60     ${ rc-absolute-ppc-2/2 rc-absolute-cell rc-absolute } member? ;