]> gitweb.factorcode.org Git - factor.git/blob - vm/run.hpp
Merge branch 'bitfields' of git://factorcode.org/git/factor into bitfields
[factor.git] / vm / run.hpp
1 namespace factor
2 {
3
4 #define USER_ENV 70
5
6 enum special_object {
7         NAMESTACK_ENV,            /* used by library only */
8         CATCHSTACK_ENV,           /* used by library only, per-callback */
9
10         CURRENT_CALLBACK_ENV = 2, /* used by library only, per-callback */
11         WALKER_HOOK_ENV,          /* non-local exit hook, used by library only */
12         CALLCC_1_ENV,             /* used to pass the value in callcc1 */
13
14         BREAK_ENV            = 5, /* quotation called by throw primitive */
15         ERROR_ENV,                /* a marker consed onto kernel errors */
16
17         CELL_SIZE_ENV        = 7, /* sizeof(cell) */
18         CPU_ENV,                  /* CPU architecture */
19         OS_ENV,                   /* operating system name */
20
21         ARGS_ENV            = 10, /* command line arguments */
22         STDIN_ENV,                /* stdin FILE* handle */
23         STDOUT_ENV,               /* stdout FILE* handle */
24
25         IMAGE_ENV           = 13, /* image path name */
26         EXECUTABLE_ENV,           /* runtime executable path name */
27
28         EMBEDDED_ENV        = 15, /* are we embedded in another app? */
29         EVAL_CALLBACK_ENV,        /* used when Factor is embedded in a C app */
30         YIELD_CALLBACK_ENV,       /* used when Factor is embedded in a C app */
31         SLEEP_CALLBACK_ENV,       /* used when Factor is embedded in a C app */
32
33         COCOA_EXCEPTION_ENV = 19, /* Cocoa exception handler quotation */
34
35         BOOT_ENV            = 20, /* boot quotation */
36         GLOBAL_ENV,               /* global namespace */
37
38         /* Quotation compilation in quotations.c */
39         JIT_PROLOG          = 23,
40         JIT_PRIMITIVE_WORD,
41         JIT_PRIMITIVE,
42         JIT_WORD_JUMP,
43         JIT_WORD_CALL,
44         JIT_WORD_SPECIAL,
45         JIT_IF_WORD,
46         JIT_IF,
47         JIT_EPILOG,
48         JIT_RETURN,
49         JIT_PROFILING,
50         JIT_PUSH_IMMEDIATE,
51         JIT_DIP_WORD,
52         JIT_DIP,
53         JIT_2DIP_WORD,
54         JIT_2DIP,
55         JIT_3DIP_WORD,
56         JIT_3DIP,
57         JIT_EXECUTE_WORD,
58         JIT_EXECUTE_JUMP,
59         JIT_EXECUTE_CALL,
60         JIT_DECLARE_WORD,
61
62         /* Polymorphic inline cache generation in inline_cache.c */
63         PIC_LOAD            = 47,
64         PIC_TAG,
65         PIC_HI_TAG,
66         PIC_TUPLE,
67         PIC_HI_TAG_TUPLE,
68         PIC_CHECK_TAG,
69         PIC_CHECK,
70         PIC_HIT,
71         PIC_MISS_WORD,
72         PIC_MISS_TAIL_WORD,
73
74         /* Megamorphic cache generation in dispatch.c */
75         MEGA_LOOKUP         = 57,
76         MEGA_LOOKUP_WORD,
77         MEGA_MISS_WORD,
78
79         UNDEFINED_ENV       = 60, /* default quotation for undefined words */
80
81         STDERR_ENV          = 61, /* stderr FILE* handle */
82
83         STAGE2_ENV          = 62, /* have we bootstrapped? */
84
85         CURRENT_THREAD_ENV  = 63,
86
87         THREADS_ENV         = 64,
88         RUN_QUEUE_ENV       = 65,
89         SLEEP_QUEUE_ENV     = 66,
90 };
91
92 #define FIRST_SAVE_ENV BOOT_ENV
93 #define LAST_SAVE_ENV STAGE2_ENV
94
95 inline static bool save_env_p(cell i)
96 {
97         return (i >= FIRST_SAVE_ENV && i <= LAST_SAVE_ENV);
98 }
99
100 }
101
102