Revert "VM: removing the unused callstack-bounds primitive"

This reverts commit c55a6ef873.

This primitive is useful for fixing the macOS pthread bug and the javascriptcore library.
paths
Doug Coleman 2018-06-03 21:38:53 -05:00
parent 2e65fabf30
commit aa87e69d25
5 changed files with 13 additions and 1 deletions

View File

@ -313,6 +313,10 @@ CONSTANT: all-primitives {
{ object } { fixnum } f { object } { fixnum } f
} }
{ "become" ( old new -- ) "become" { array array } { } f } { "become" ( old new -- ) "become" { array array } { } f }
{
"callstack-bounds" ( -- start end ) "callstack_bounds"
{ } { alien alien } make-flushable
}
{ {
"check-datastack" ( array in# out# -- ? ) "check_datastack" "check-datastack" ( array in# out# -- ? ) "check_datastack"
{ array integer integer } { object } make-flushable { array integer integer } { object } make-flushable

View File

@ -37,6 +37,7 @@ PRIMITIVE: (execute) ( word -- )
PRIMITIVE: (identity-hashcode) ( obj -- code ) PRIMITIVE: (identity-hashcode) ( obj -- code )
PRIMITIVE: become ( old new -- ) PRIMITIVE: become ( old new -- )
PRIMITIVE: c-to-factor ( -- ) PRIMITIVE: c-to-factor ( -- )
PRIMITIVE: callstack-bounds ( -- start end )
PRIMITIVE: check-datastack ( array in# out# -- ? ) PRIMITIVE: check-datastack ( array in# out# -- ? )
PRIMITIVE: compute-identity-hashcode ( obj -- ) PRIMITIVE: compute-identity-hashcode ( obj -- )
PRIMITIVE: context-object ( n -- obj ) PRIMITIVE: context-object ( n -- obj )

View File

@ -104,4 +104,10 @@ void factor_vm::primitive_set_innermost_stack_frame_quotation() {
*(cell*)inner = quot->entry_point + offset; *(cell*)inner = quot->entry_point + offset;
} }
// Allocates memory (allot_alien)
void factor_vm::primitive_callstack_bounds() {
ctx->push(allot_alien(ctx->callstack_seg->start));
ctx->push(allot_alien(ctx->callstack_seg->end));
}
} }

View File

@ -11,7 +11,7 @@ namespace factor {
_(bignum_shift) _(bignum_subtract) _(bignum_to_fixnum) \ _(bignum_shift) _(bignum_subtract) _(bignum_to_fixnum) \
_(bignum_to_fixnum_strict) _(bignum_xor) _(bits_double) _(bits_float) \ _(bignum_to_fixnum_strict) _(bignum_xor) _(bits_double) _(bits_float) \
_(byte_array) _(callback) _(callback_room) \ _(byte_array) _(callback) _(callback_room) \
_(callstack_for) _(callstack_to_array) \ _(callstack_bounds) _(callstack_for) _(callstack_to_array) \
_(check_datastack) _(clone) _(code_blocks) _(code_room) \ _(check_datastack) _(clone) _(code_blocks) _(code_room) \
_(compact_gc) _(compute_identity_hashcode) _(context_object) \ _(compact_gc) _(compute_identity_hashcode) _(context_object) \
_(context_object_for) _(current_callback) _(data_room) \ _(context_object_for) _(current_callback) _(data_room) \

View File

@ -605,6 +605,7 @@ struct factor_vm {
void primitive_innermost_stack_frame_executing(); void primitive_innermost_stack_frame_executing();
void primitive_innermost_stack_frame_scan(); void primitive_innermost_stack_frame_scan();
void primitive_set_innermost_stack_frame_quotation(); void primitive_set_innermost_stack_frame_quotation();
void primitive_callstack_bounds();
template <typename Iterator, typename Fixup> template <typename Iterator, typename Fixup>
void iterate_callstack(context* ctx, Iterator& iterator, Fixup& fixup); void iterate_callstack(context* ctx, Iterator& iterator, Fixup& fixup);