]> gitweb.factorcode.org Git - factor.git/commitdiff
Revert "VM: removing the unused callstack-bounds primitive"
authorDoug Coleman <doug.coleman@gmail.com>
Mon, 4 Jun 2018 02:38:53 +0000 (21:38 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Mon, 4 Jun 2018 03:12:28 +0000 (22:12 -0500)
This reverts commit c55a6ef87324d1a22fa0f5e935d9575005e15bd4.

This primitive is useful for fixing the macOS pthread bug and the javascriptcore library.

basis/bootstrap/image/primitives/primitives.factor
core/kernel/kernel.factor
vm/callstack.cpp
vm/primitives.hpp
vm/vm.hpp

index d28a096808b3a2164c5453e4053d7a803e59c072..6554f741628a97d9b0c3700f92fc5e612fbf9a5e 100644 (file)
@@ -313,6 +313,10 @@ CONSTANT: all-primitives {
                 { object } { fixnum } 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"
                 { array integer integer } { object } make-flushable
index 155dffc436b5938ea59d5599b8662af5b1813aab..cc2d132fda75524e7abe78645256c0f0149c55d6 100644 (file)
@@ -37,6 +37,7 @@ PRIMITIVE: (execute) ( word -- )
 PRIMITIVE: (identity-hashcode) ( obj -- code )
 PRIMITIVE: become ( old new -- )
 PRIMITIVE: c-to-factor ( -- )
+PRIMITIVE: callstack-bounds ( -- start end )
 PRIMITIVE: check-datastack ( array in# out# -- ? )
 PRIMITIVE: compute-identity-hashcode ( obj -- )
 PRIMITIVE: context-object ( n -- obj )
index 808e7dbb7e5c7ac85c9012afc2b82e92969bec65..bd0d6c67cce6f4ff21086a75703460e05deafa2b 100644 (file)
@@ -104,4 +104,10 @@ void factor_vm::primitive_set_innermost_stack_frame_quotation() {
   *(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));
+}
+
 }
index a0a0c4c22a50858827c90453e075a3cb04c80da8..8c88658f718d43548de85f1f9128967bb36596a9 100644 (file)
@@ -11,7 +11,7 @@ namespace factor {
       _(bignum_shift) _(bignum_subtract) _(bignum_to_fixnum)                   \
       _(bignum_to_fixnum_strict) _(bignum_xor) _(bits_double) _(bits_float)    \
       _(byte_array) _(callback) _(callback_room)                               \
-      _(callstack_for) _(callstack_to_array)                                   \
+      _(callstack_bounds) _(callstack_for) _(callstack_to_array)               \
       _(check_datastack) _(clone) _(code_blocks) _(code_room)                  \
       _(compact_gc) _(compute_identity_hashcode) _(context_object)             \
       _(context_object_for) _(current_callback) _(data_room)                   \
index be6acf1ae8f8bfa827d25a818bd3121f77fe5093..5ef2443f5e0454d832ea7bc00fbc81b8cd50b36e 100644 (file)
--- a/vm/vm.hpp
+++ b/vm/vm.hpp
@@ -605,6 +605,7 @@ struct factor_vm {
   void primitive_innermost_stack_frame_executing();
   void primitive_innermost_stack_frame_scan();
   void primitive_set_innermost_stack_frame_quotation();
+  void primitive_callstack_bounds();
 
   template <typename Iterator, typename Fixup>
   void iterate_callstack(context* ctx, Iterator& iterator, Fixup& fixup);