#! After word is compiled, put its XT at where, relative.
3list deferred-xts cons@ ;
-: compiled? ( word -- ? )
- #! This is a hack.
- dup "compiled" word-property [
- drop t
- ] [
- primitive?
- ] ifte ;
-
: compiling? ( word -- ? )
#! A word that is compiling or already compiled will not be
#! added to the list of words to be compiled.
deferred-xts off ;
: postpone-word ( word -- )
- dup compiled? [ drop ] [
- t over "compiled" set-word-property
- compile-words unique@
- ] ifte ;
+ dup compiled? [ drop ] [ compile-words unique@ ] ifte ;
! During compilation, these two variables store pending
! literals. Literals are either consumed at compile-time by
set-word-parameter
word-plist
set-word-plist
+ call-profiling
+ call-count
+ set-call-count
+ allot-profiling
+ allot-count
+ set-allot-count
+ compiled?
drop
dup
swap
(random-int)
type
size
- call-profiling
- call-count
- set-call-count
- allot-profiling
- allot-count
- set-allot-count
dump
cwd
cd
"<html>&'sgml'"
] [ "<html>&'sgml'" chars>entities ] unit-test
-[ "/file/foo/bar" ]
+[ "/foo/bar" ]
[
[
"/home/slava/doc/" "doc-root" set
primitive_set_word_parameter,
primitive_word_plist,
primitive_set_word_plist,
+ primitive_call_profiling,
+ primitive_word_call_count,
+ primitive_set_word_call_count,
+ primitive_allot_profiling,
+ primitive_word_allot_count,
+ primitive_set_word_allot_count,
+ primitive_word_compiledp,
primitive_drop,
primitive_dup,
primitive_swap,
primitive_random_int,
primitive_type,
primitive_size,
- primitive_call_profiling,
- primitive_word_call_count,
- primitive_set_word_call_count,
- primitive_allot_profiling,
- primitive_word_allot_count,
- primitive_set_word_allot_count,
primitive_dump,
primitive_cwd,
primitive_cd,
extern XT primitives[];
-#define PRIMITIVE_COUNT 195
+#define PRIMITIVE_COUNT 196
CELL primitive_to_xt(CELL primitive);
word->allot_count = to_fixnum(dpop());
}
+void primitive_word_compiledp(void)
+{
+ WORD* word = untag_word(dpeek());
+ /* is it bad to hardcode this? */
+ drepl(tag_boolean(word->xt != (CELL)docol
+ && word->xt != (CELL)dosym));
+}
+
void fixup_word(WORD* word)
{
update_xt(word);
void primitive_set_word_call_count(void);
void primitive_word_allot_count(void);
void primitive_set_word_allot_count(void);
+void primitive_word_compiledp(void);
void fixup_word(WORD* word);
void collect_word(WORD* word);