3 // Special object count and identifiers must be kept in sync with:
4 // core/kernel/kernel.factor
5 // basis/bootstrap/image/image.factor
7 static const cell special_object_count = 80;
10 OBJ_WALKER_HOOK = 3, /* non-local exit hook, used by library only */
11 OBJ_CALLCC_1, /* used to pass the value in callcc1 */
13 ERROR_HANDLER_QUOT = 5, /* quotation called when VM throws an error */
14 OBJ_ERROR, /* a marker consed onto kernel errors */
16 OBJ_CELL_SIZE = 7, /* sizeof(cell) */
17 OBJ_CPU, /* CPU architecture */
18 OBJ_OS, /* operating system name */
20 OBJ_ARGS = 10, /* command line arguments */
21 OBJ_STDIN, /* stdin FILE* handle */
22 OBJ_STDOUT, /* stdout FILE* handle */
24 OBJ_IMAGE = 13, /* image path name */
25 OBJ_EXECUTABLE, /* runtime executable path name */
27 OBJ_EMBEDDED = 15, /* are we embedded in another app? */
28 OBJ_EVAL_CALLBACK, /* used when Factor is embedded in a C app */
29 OBJ_YIELD_CALLBACK, /* used when Factor is embedded in a C app */
30 OBJ_SLEEP_CALLBACK, /* used when Factor is embedded in a C app */
32 OBJ_STARTUP_QUOT = 20, /* startup quotation */
33 OBJ_GLOBAL, /* global namespace */
34 OBJ_SHUTDOWN_QUOT, /* shutdown quotation */
36 /* Quotation compilation in quotations.c */
58 /* External entry points. These are defined in the files in
59 bootstrap/assembler/ */
60 C_TO_FACTOR_WORD = 43,
61 LAZY_JIT_COMPILE_WORD,
62 UNWIND_NATIVE_FRAMES_WORD,
66 LEAF_SIGNAL_HANDLER_WORD,
70 /* Incremented on every modify-code-heap call; invalidates call( inline
72 REDEFINITION_COUNTER = 52,
74 /* Callback stub generation in callbacks.cpp */
77 /* Polymorphic inline cache generation in inline_cache.c */
87 /* Megamorphic cache generation in dispatch.c */
92 OBJ_UNDEFINED = 65, /* default quotation for undefined words */
94 OBJ_STDERR = 66, /* stderr FILE* handle */
96 OBJ_STAGE2 = 67, /* have we bootstrapped? */
98 OBJ_CURRENT_THREAD = 68,
102 OBJ_SLEEP_QUEUE = 71,
104 OBJ_VM_COMPILER = 72, /* version string of the compiler we were built with */
106 OBJ_WAITING_CALLBACKS = 73,
108 OBJ_SIGNAL_PIPE = 74, /* file descriptor for pipe used to communicate signals
110 OBJ_VM_COMPILE_TIME = 75, /* when the binary was built */
111 OBJ_VM_VERSION = 76, /* factor version */
112 OBJ_VM_GIT_LABEL = 77, /* git label (git describe --all --long) */
115 /* save-image-and-exit discards special objects that are filled in on startup
116 anyway, to reduce image size */
117 #define OBJ_FIRST_SAVE OBJ_STARTUP_QUOT
118 #define OBJ_LAST_SAVE OBJ_STAGE2
120 inline static bool save_special_p(cell i) {
121 return (i >= OBJ_FIRST_SAVE && i <= OBJ_LAST_SAVE);
124 template <typename Iterator> void object::each_slot(Iterator& iter) {
125 cell* start = (cell*)this + 1;
126 cell* end = start + slot_count();
128 while (start < end) {