void { long } cdecl [ sleep ] alien-callback ;
: ?callback ( word -- alien )
- dup optimized? [ execute ] [ drop f ] if ; inline
+ dup word-optimized? [ execute ] [ drop f ] if ; inline
: init-remote-control ( -- )
\ eval-callback ?callback OBJ-EVAL-CALLBACK set-special-object
: compile-unoptimized ( words -- )
[ [ subwords ] map ] keep suffix concat
- [ optimized? ] reject compile ;
+ [ word-optimized? ] reject compile ;
"debug-compiler" get [
[ '[ _ execute ] ] dip call-effect-slow ; inline
: execute-effect-unsafe? ( word effect -- ? )
- over optimized?
+ over word-optimized?
[ [ stack-effect { effect } declare ] dip effect<= ]
[ 2drop f ]
if ; inline
\ minor-gc { } { } define-primitive
\ modify-code-heap { array object object } { } define-primitive
\ nano-count { } { integer } define-primitive \ nano-count make-flushable
-\ optimized? { word } { object } define-primitive
\ profiling { object } { } define-primitive
\ (get-samples) { } { object } define-primitive
\ (clear-samples) { } { } define-primitive
-\ quot-compiled? { quotation } { object } define-primitive
\ quotation-code { quotation } { integer integer } define-primitive \ quotation-code make-flushable
+\ quotation-compiled? { quotation } { object } define-primitive
\ reset-dispatch-stats { } { } define-primitive
\ resize-array { integer array } { array } define-primitive
\ resize-byte-array { integer byte-array } { byte-array } define-primitive
\ set-alien-unsigned-cell { integer c-ptr integer } { } define-primitive
\ set-context-object { object fixnum } { } define-primitive
\ set-fpu-state { } { } define-primitive
-\ set-innermost-frame-quot { quotation callstack } { } define-primitive
+\ set-innermost-frame-quotation { quotation callstack } { } define-primitive
\ set-slot { object object fixnum } { } define-primitive
\ set-special-object { object fixnum } { } define-primitive
\ set-string-nth-fast { fixnum fixnum string } { } define-primitive
\ tag { object } { fixnum } define-primitive \ tag make-foldable
\ unimplemented { } { } define-primitive
\ word-code { word } { integer integer } define-primitive \ word-code make-flushable
+\ word-optimized? { word } { object } define-primitive
M: object add-breakpoint ;
-: (step-into-quot) ( quot -- ) add-breakpoint call ;
+: (step-into-quotation) ( quot -- ) add-breakpoint call ;
: (step-into-dip) ( quot -- ) add-breakpoint dip ;
: (step-into-3dip) ( quot -- ) add-breakpoint 3dip ;
-: (step-into-if) ( true false ? -- ) ? (step-into-quot) ;
+: (step-into-if) ( true false ? -- ) ? (step-into-quotation) ;
-: (step-into-dispatch) ( array n -- ) nth (step-into-quot) ;
+: (step-into-dispatch) ( array n -- ) nth (step-into-quotation) ;
: (step-into-execute) ( word -- )
{
{ [ dup single-generic? ] [ effective-method (step-into-execute) ] }
{ [ dup uses \ suspend swap member? ] [ execute break ] }
{ [ dup primitive? ] [ execute break ] }
- [ def>> (step-into-quot) ]
+ [ def>> (step-into-quotation) ]
} cond ;
\ (step-into-execute) t "step-into?" set-word-prop
current-continuation callstack >>call break ;
: (step-into-call-next-method) ( method -- )
- next-method-quot (step-into-quot) ;
+ next-method-quot (step-into-quotation) ;
<< {
- (step-into-quot)
+ (step-into-quotation)
(step-into-dip)
(step-into-2dip)
(step-into-3dip)
: (change-frame) ( callstack quot -- callstack' )
[ dup innermost-frame-executing quotation? ] dip '[
- clone [ >innermost-frame< @ ] [ set-innermost-frame-quot ] [ ] tri
+ clone
+ [ >innermost-frame< @ ]
+ [ set-innermost-frame-quotation ]
+ [ ] tri
] when ; inline
: change-frame ( continuation quot -- continuation' )
[ nip \ break suffix ] change-frame ;
{
- { call [ (step-into-quot) ] }
+ { call [ (step-into-quotation) ] }
{ dip [ (step-into-dip) ] }
{ 2dip [ (step-into-2dip) ] }
{ 3dip [ (step-into-3dip) ] }
! Quotations which were formerly compiled must remain
! compiled.
2dup [
- 2dup [ quot-compiled? ] [ quot-compiled? not ] bi* and
+ 2dup [ quotation-compiled? ] [ quotation-compiled? not ] bi* and
[ nip jit-compile ] [ 2drop ] if
] 2each ;
{ "innermost-frame-scan" "kernel.private" "primitive_innermost_stack_frame_scan" ( callstack -- n ) }
{ "set-context-object" "kernel.private" "primitive_set_context_object" ( obj n -- ) }
{ "set-datastack" "kernel.private" "primitive_set_datastack" ( array -- ) }
- { "set-innermost-frame-quot" "kernel.private" "primitive_set_innermost_stack_frame_quot" ( n callstack -- ) }
+ { "set-innermost-frame-quotation" "kernel.private" "primitive_set_innermost_stack_frame_quotation" ( n callstack -- ) }
{ "set-retainstack" "kernel.private" "primitive_set_retainstack" ( array -- ) }
{ "set-special-object" "kernel.private" "primitive_set_special_object" ( obj n -- ) }
{ "special-object" "kernel.private" "primitive_special_object" ( n -- obj ) }
{ "size" "memory" "primitive_size" ( obj -- n ) }
{ "(save-image)" "memory.private" "primitive_save_image" ( path1 path2 then-die? -- ) }
{ "jit-compile" "quotations" "primitive_jit_compile" ( quot -- ) }
- { "quot-compiled?" "quotations" "primitive_quot_compiled_p" ( quot -- ? ) }
{ "quotation-code" "quotations" "primitive_quotation_code" ( quot -- start end ) }
+ { "quotation-compiled?" "quotations" "primitive_quotation_compiled_p" ( quot -- ? ) }
{ "array>quotation" "quotations.private" "primitive_array_to_quotation" ( array -- quot ) }
{ "set-slot" "slots.private" "primitive_set_slot" ( value obj n -- ) }
{ "<string>" "strings" "primitive_string" ( n ch -- string ) }
{ "retainstack-for" "threads.private" "primitive_retainstack_for" ( context -- array ) }
{ "dispatch-stats" "tools.dispatch.private" "primitive_dispatch_stats" ( -- stats ) }
{ "reset-dispatch-stats" "tools.dispatch.private" "primitive_reset_dispatch_stats" ( -- ) }
- { "optimized?" "words" "primitive_optimized_p" ( word -- ? ) }
{ "word-code" "words" "primitive_word_code" ( word -- start end ) }
+ { "word-optimized?" "words" "primitive_word_optimized_p" ( word -- ? ) }
{ "(word)" "words.private" "primitive_word" ( name vocab hashcode -- word ) }
{ "profiling" "tools.profiler.sampling.private" "primitive_sampling_profiler" ( ? -- ) }
{ "(get-samples)" "tools.profiler.sampling.private" "primitive_get_samples" ( -- samples/f ) }
PRIMITIVE: set-context-object ( obj n -- )
PRIMITIVE: set-datastack ( array -- )
PRIMITIVE: set-fpu-state ( -- )
-PRIMITIVE: set-innermost-frame-quot ( n callstack -- )
+PRIMITIVE: set-innermost-frame-quotation ( n callstack -- )
PRIMITIVE: set-retainstack ( array -- )
PRIMITIVE: set-special-object ( obj n -- )
PRIMITIVE: signal-handler ( -- )
cache-counter ;
PRIMITIVE: jit-compile ( quot -- )
-PRIMITIVE: quot-compiled? ( quot -- ? )
PRIMITIVE: quotation-code ( quot -- start end )
+PRIMITIVE: quotation-compiled? ( quot -- ? )
<PRIVATE
PRIMITIVE: array>quotation ( array -- quot )
{ def quotation initial: [ ] } props pic-def pic-tail-def
{ sub-primitive read-only } ;
-PRIMITIVE: optimized? ( word -- ? )
PRIMITIVE: word-code ( word -- start end )
+PRIMITIVE: word-optimized? ( word -- ? )
<PRIVATE
PRIMITIVE: (word) ( name vocab hashcode -- word )
ctx->replace(code->code_block_for_address(addr)->scan(this, addr));
}
-/* Allocates memory (jit_compile_quot) */
-void factor_vm::primitive_set_innermost_stack_frame_quot() {
+/* Allocates memory (jit_compile_quotation) */
+void factor_vm::primitive_set_innermost_stack_frame_quotation() {
data_root<callstack> stack(ctx->pop(), this);
data_root<quotation> quot(ctx->pop(), this);
stack.untag_check(this);
quot.untag_check(this);
- jit_compile_quot(quot.value(), true);
+ jit_compile_quotation(quot.value(), true);
void* inner = stack->top();
cell addr = *(cell*)inner;
return w->entry_point;
else {
quotation* quot = untag<quotation>(tagged_quot);
- if (quot_compiled_p(quot))
+ if (quotation_compiled_p(quot))
return quot->entry_point;
else
return w->entry_point;
general_error(ERROR_UNDEFINED_SYMBOL, symbol, library);
}
-void undefined_symbol() { return current_vm()->undefined_symbol(); }
-
+void undefined_symbol() {
+ return current_vm()->undefined_symbol();
+}
}
where we might throw an error, so we have to throw an error here since
later steps destroy the current image. */
bool then_die = to_boolean(ctx->pop());
- byte_array* path2 = tagged<byte_array>(ctx->pop()).untag_check(this);
- byte_array* path1 = tagged<byte_array>(ctx->pop()).untag_check(this);
+ byte_array* path2 = untag_check<byte_array>(ctx->pop());
+ byte_array* path1 = untag_check<byte_array>(ctx->pop());
/* Copy the paths to non-gc memory to avoid them hanging around in
the saved image. */
_(full_gc) _(fwrite) _(get_samples) _(identity_hashcode) \
_(innermost_stack_frame_executing) _(innermost_stack_frame_scan) \
_(jit_compile) _(load_locals) _(lookup_method) _(mega_cache_miss) \
- _(minor_gc) _(modify_code_heap) _(nano_count) _(optimized_p) \
- _(quot_compiled_p) _(quotation_code) _(reset_dispatch_stats) \
- _(resize_array) _(resize_byte_array) _(resize_string) _(retainstack) \
- _(retainstack_for) _(sampling_profiler) _(save_image) \
- _(set_context_object) _(set_datastack) _(set_innermost_stack_frame_quot) \
+ _(minor_gc) _(modify_code_heap) _(nano_count) _(quotation_code) \
+ _(quotation_compiled_p) _(reset_dispatch_stats) _(resize_array) \
+ _(resize_byte_array) _(resize_string) _(retainstack) _(retainstack_for) \
+ _(sampling_profiler) _(save_image) _(set_context_object) \
+ _(set_datastack) _(set_innermost_stack_frame_quotation) \
_(set_retainstack) _(set_slot) _(set_special_object) \
_(set_string_nth_fast) _(size) _(sleep) _(special_object) _(string) \
_(strip_stack_traces) _(tuple) _(tuple_boa) _(unimplemented) \
- _(uninitialized_byte_array) _(word) _(word_code) _(wrapper)
+ _(uninitialized_byte_array) _(word) _(word_code) _(word_optimized_p) \
+ _(wrapper)
#define EACH_ALIEN_PRIMITIVE(_) \
_(signed_cell, fixnum, from_signed_cell, to_fixnum) \
literal(array_nth(elements, 0));
else {
if (compiling)
- parent->jit_compile_quot(quot.value(), relocate);
+ parent->jit_compile_quotation(quot.value(), relocate);
literal(quot.value());
}
}
}
/* Allocates memory */
-code_block* factor_vm::jit_compile_quot(cell owner_, cell quot_,
- bool relocating) {
+code_block* factor_vm::jit_compile_quotation(cell owner_, cell quot_,
+ bool relocating) {
data_root<object> owner(owner_, this);
data_root<quotation> quot(quot_, this);
}
/* Allocates memory */
-void factor_vm::jit_compile_quot(cell quot_, bool relocating) {
+void factor_vm::jit_compile_quotation(cell quot_, bool relocating) {
data_root<quotation> quot(quot_, this);
- if (!quot_compiled_p(quot.untagged())) {
+ if (!quotation_compiled_p(quot.untagged())) {
code_block* compiled =
- jit_compile_quot(quot.value(), quot.value(), relocating);
+ jit_compile_quotation(quot.value(), quot.value(), relocating);
quot.untagged()->entry_point = compiled->entry_point();
}
}
/* Allocates memory */
-void factor_vm::primitive_jit_compile() { jit_compile_quot(ctx->pop(), true); }
+void factor_vm::primitive_jit_compile() {
+ jit_compile_quotation(ctx->pop(), true);
+}
cell factor_vm::lazy_jit_compile_entry_point() {
return untag<word>(special_objects[LAZY_JIT_COMPILE_WORD])->entry_point;
cell factor_vm::lazy_jit_compile(cell quot_) {
data_root<quotation> quot(quot_, this);
- FACTOR_ASSERT(!quot_compiled_p(quot.untagged()));
+ FACTOR_ASSERT(!quotation_compiled_p(quot.untagged()));
- code_block* compiled = jit_compile_quot(quot.value(), quot.value(), true);
+ code_block* compiled =
+ jit_compile_quotation(quot.value(), quot.value(), true);
quot.untagged()->entry_point = compiled->entry_point();
return quot.value();
return parent->lazy_jit_compile(quot);
}
-bool factor_vm::quot_compiled_p(quotation* quot) {
+bool factor_vm::quotation_compiled_p(quotation* quot) {
return quot->entry_point != 0 &&
quot->entry_point != lazy_jit_compile_entry_point();
}
-void factor_vm::primitive_quot_compiled_p() {
- tagged<quotation> quot(ctx->pop());
- quot.untag_check(this);
- ctx->push(tag_boolean(quot_compiled_p(quot.untagged())));
+void factor_vm::primitive_quotation_compiled_p() {
+ quotation* quot = untag_check<quotation>(ctx->pop());
+ ctx->push(tag_boolean(quotation_compiled_p(quot)));
}
/* Allocates memory */
word* allot_word(cell name_, cell vocab_, cell hashcode_);
void primitive_word();
void primitive_word_code();
- void primitive_optimized_p();
+ void primitive_word_optimized_p();
void primitive_wrapper();
void jit_compile_word(cell word_, cell def_, bool relocating);
cell find_all_words();
void primitive_callstack_to_array();
void primitive_innermost_stack_frame_executing();
void primitive_innermost_stack_frame_scan();
- void primitive_set_innermost_stack_frame_quot();
+ void primitive_set_innermost_stack_frame_quotation();
void primitive_callstack_bounds();
template <typename Iterator, typename Fixup>
cell lazy_jit_compile_entry_point();
void primitive_array_to_quotation();
void primitive_quotation_code();
- code_block* jit_compile_quot(cell owner_, cell quot_, bool relocating);
- void jit_compile_quot(cell quot_, bool relocating);
+ code_block* jit_compile_quotation(cell owner_, cell quot_, bool relocating);
+ void jit_compile_quotation(cell quot_, bool relocating);
fixnum quot_code_offset_to_scan(cell quot_, cell offset);
cell lazy_jit_compile(cell quot);
- bool quot_compiled_p(quotation* quot);
- void primitive_quot_compiled_p();
+ bool quotation_compiled_p(quotation* quot);
+ void primitive_quotation_compiled_p();
cell find_all_quotations();
void initialize_all_quotations();
return;
code_block* compiled =
- jit_compile_quot(word.value(), def.value(), relocating);
+ jit_compile_quotation(word.value(), def.value(), relocating);
word->entry_point = compiled->entry_point();
if (to_boolean(word->pic_def))
- jit_compile_quot(word->pic_def, relocating);
+ jit_compile_quotation(word->pic_def, relocating);
if (to_boolean(word->pic_tail_def))
- jit_compile_quot(word->pic_tail_def, relocating);
+ jit_compile_quotation(word->pic_tail_def, relocating);
}
/* Allocates memory */
ctx->push(from_unsigned_cell((cell)w->code() + w->code()->size()));
}
-void factor_vm::primitive_optimized_p() {
+void factor_vm::primitive_word_optimized_p() {
word* w = untag_check<word>(ctx->peek());
ctx->replace(tag_boolean(w->code()->optimized_p()));
}