]> gitweb.factorcode.org Git - factor.git/commitdiff
Stop wearing monocle and use the term "entry point" instead of "XT" throughout VM...
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 18 Jan 2010 07:51:27 +0000 (20:51 +1300)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Mon, 18 Jan 2010 07:54:00 +0000 (20:54 +1300)
38 files changed:
basis/compiler/codegen/fixup/fixup.factor
basis/compiler/constants/constants.factor
basis/cpu/ppc/bootstrap.factor
basis/cpu/ppc/ppc.factor
basis/cpu/x86/32/32.factor
basis/cpu/x86/32/bootstrap.factor
basis/cpu/x86/64/64.factor
basis/cpu/x86/64/bootstrap.factor
basis/cpu/x86/bootstrap.factor
basis/stack-checker/known-words/known-words.factor
basis/tools/disassembler/disassembler.factor
basis/tools/disassembler/gdb/gdb.factor
basis/tools/disassembler/udis/udis.factor
basis/tools/disassembler/utils/utils.factor
core/bootstrap/primitives.factor
core/quotations/quotations-docs.factor
core/words/words-docs.factor
core/words/words-tests.factor
vm/callbacks.cpp
vm/callbacks.hpp
vm/callstack.cpp
vm/code_block_visitor.hpp
vm/code_blocks.cpp
vm/code_blocks.hpp
vm/code_heap.cpp
vm/compaction.cpp
vm/debug.cpp
vm/entry_points.cpp
vm/image.cpp
vm/inline_cache.cpp
vm/instruction_operands.cpp
vm/instruction_operands.hpp
vm/layouts.hpp
vm/primitives.cpp
vm/profiler.cpp
vm/quotations.cpp
vm/vm.hpp
vm/words.cpp

index efdc02cc1fa962fa0285a8f754cd0e5a551a15ca..9555ac32df8079098743afd106a7fe4af46d08b2 100644 (file)
@@ -62,13 +62,13 @@ MEMO: cached-string>symbol ( symbol -- obj ) string>symbol ;
     [ add-dlsym-parameters ] dip rt-dlsym rel-fixup ;
 
 : rel-word ( word class -- )
-    [ add-literal ] dip rt-xt rel-fixup ;
+    [ add-literal ] dip rt-entry-point rel-fixup ;
 
 : rel-word-pic ( word class -- )
-    [ add-literal ] dip rt-xt-pic rel-fixup ;
+    [ add-literal ] dip rt-entry-point-pic rel-fixup ;
 
 : rel-word-pic-tail ( word class -- )
-    [ add-literal ] dip rt-xt-pic-tail rel-fixup ;
+    [ add-literal ] dip rt-entry-point-pic-tail rel-fixup ;
 
 : rel-primitive ( word class -- )
     [ def>> first add-parameter ] dip rt-primitive rel-fixup ;
index 499a1b192fb2f3ba163816a34e84f43b171082e2..26255a66372463f45059b81b59ee9891cdf61a89 100644 (file)
@@ -20,8 +20,8 @@ CONSTANT: deck-bits 18
 : alien-offset ( -- n ) 4 alien type-number slot-offset ; inline
 : underlying-alien-offset ( -- n ) 1 alien type-number slot-offset ; inline
 : tuple-class-offset ( -- n ) 1 tuple type-number slot-offset ; inline
-: word-xt-offset ( -- n ) 10 \ word type-number slot-offset ; inline
-: quot-xt-offset ( -- n ) 4 quotation type-number slot-offset ; inline
+: word-entry-point-offset ( -- n ) 10 \ word type-number slot-offset ; inline
+: quot-entry-point-offset ( -- n ) 4 quotation type-number slot-offset ; inline
 : word-code-offset ( -- n ) 11 \ word type-number slot-offset ; inline
 : array-start-offset ( -- n ) 2 array type-number slot-offset ; inline
 : compiled-header-size ( -- n ) 4 bootstrap-cells ; inline
@@ -49,19 +49,17 @@ CONSTANT: rc-absolute-2 10
 ! Relocation types
 CONSTANT: rt-primitive 0
 CONSTANT: rt-dlsym 1
-CONSTANT: rt-dispatch 2
-CONSTANT: rt-xt 3
-CONSTANT: rt-xt-pic 4
-CONSTANT: rt-xt-pic-tail 5
-CONSTANT: rt-here 6
-CONSTANT: rt-this 7
-CONSTANT: rt-literal 8
-CONSTANT: rt-context 9
-CONSTANT: rt-untagged 10
-CONSTANT: rt-megamorphic-cache-hits 11
-CONSTANT: rt-vm 12
-CONSTANT: rt-cards-offset 13
-CONSTANT: rt-decks-offset 14
+CONSTANT: rt-entry-point 2
+CONSTANT: rt-entry-point-pic 3
+CONSTANT: rt-entry-point-pic-tail 4
+CONSTANT: rt-here 5
+CONSTANT: rt-this 6
+CONSTANT: rt-literal 7
+CONSTANT: rt-untagged 8
+CONSTANT: rt-megamorphic-cache-hits 9
+CONSTANT: rt-vm 10
+CONSTANT: rt-cards-offset 11
+CONSTANT: rt-decks-offset 12
 
 : rc-absolute? ( n -- ? )
     ${ rc-absolute-ppc-2/2 rc-absolute-cell rc-absolute } member? ;
index e3c212bd482648af6f250a1bbd405e13112a37fe..c5815d56ebf8570f07ce1d77b4d8b739f8806841 100644 (file)
@@ -1,10 +1,9 @@
 ! Copyright (C) 2007, 2010 Slava Pestov.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
 USING: bootstrap.image.private kernel kernel.private namespaces\r
-system cpu.ppc.assembler compiler.codegen.fixup compiler.units\r
-compiler.constants math math.private math.ranges layouts words vocabs\r
-slots.private locals locals.backend generic.single.private fry\r
-sequences ;\r
+system cpu.ppc.assembler compiler.units compiler.constants math\r
+math.private math.ranges layouts words vocabs slots.private\r
+locals locals.backend generic.single.private fry sequences ;\r
 FROM: cpu.ppc.assembler => B ;\r
 IN: bootstrap.ppc\r
 \r
@@ -66,7 +65,7 @@ CONSTANT: ctx-reg 16
 \r
     0 vm-reg LOAD32 rc-absolute-ppc-2/2 rt-vm jit-rel\r
 \r
-    0 2 LOAD32 rc-absolute-ppc-2/2 rt-xt jit-rel\r
+    0 2 LOAD32 rc-absolute-ppc-2/2 rt-entry-point jit-rel\r
     2 MTLR\r
     BLRL\r
 \r
@@ -132,19 +131,19 @@ CONSTANT: ctx-reg 16
     jit-restore-context\r
 ] jit-primitive jit-define\r
 \r
-[ 0 BL rc-relative-ppc-3 rt-xt-pic jit-rel ] jit-word-call jit-define\r
+[ 0 BL rc-relative-ppc-3 rt-entry-point-pic jit-rel ] jit-word-call jit-define\r
 \r
 [\r
     0 6 LOAD32 rc-absolute-ppc-2/2 rt-here jit-rel\r
-    0 B rc-relative-ppc-3 rt-xt-pic-tail jit-rel\r
+    0 B rc-relative-ppc-3 rt-entry-point-pic-tail jit-rel\r
 ] jit-word-jump jit-define\r
 \r
 [\r
     3 ds-reg 0 LWZ\r
     ds-reg dup 4 SUBI\r
     0 3 \ f type-number CMPI\r
-    [ BEQ ] [ 0 B rc-relative-ppc-3 rt-xt jit-rel ] jit-conditional*\r
-    0 B rc-relative-ppc-3 rt-xt jit-rel\r
+    [ BEQ ] [ 0 B rc-relative-ppc-3 rt-entry-point jit-rel ] jit-conditional*\r
+    0 B rc-relative-ppc-3 rt-entry-point jit-rel\r
 ] jit-if jit-define\r
 \r
 : jit->r ( -- )\r
@@ -195,19 +194,19 @@ CONSTANT: ctx-reg 16
 \r
 [\r
     jit->r\r
-    0 BL rc-relative-ppc-3 rt-xt jit-rel\r
+    0 BL rc-relative-ppc-3 rt-entry-point jit-rel\r
     jit-r>\r
 ] jit-dip jit-define\r
 \r
 [\r
     jit-2>r\r
-    0 BL rc-relative-ppc-3 rt-xt jit-rel\r
+    0 BL rc-relative-ppc-3 rt-entry-point jit-rel\r
     jit-2r>\r
 ] jit-2dip jit-define\r
 \r
 [\r
     jit-3>r\r
-    0 BL rc-relative-ppc-3 rt-xt jit-rel\r
+    0 BL rc-relative-ppc-3 rt-entry-point jit-rel\r
     jit-3r>\r
 ] jit-3dip jit-define\r
 \r
@@ -256,7 +255,7 @@ CONSTANT: ctx-reg 16
 ] pic-check-tuple jit-define\r
 \r
 [\r
-    [ BNE ] [ 0 B rc-relative-ppc-3 rt-xt jit-rel ] jit-conditional*\r
+    [ BNE ] [ 0 B rc-relative-ppc-3 rt-entry-point jit-rel ] jit-conditional*\r
 ] pic-hit jit-define\r
 \r
 ! Inline cache miss entry points\r
@@ -308,7 +307,7 @@ CONSTANT: ctx-reg 16
         5 4 0 STW\r
         ! ... goto get(cache + 4)\r
         3 3 4 LWZ\r
-        3 3 word-xt-offset LWZ\r
+        3 3 word-entry-point-offset LWZ\r
         3 MTCTR\r
         BCTR\r
     ]\r
@@ -322,7 +321,7 @@ CONSTANT: ctx-reg 16
 [\r
     3 ds-reg 0 LWZ\r
     ds-reg dup 4 SUBI\r
-    5 3 quot-xt-offset LWZ\r
+    5 3 quot-entry-point-offset LWZ\r
 ]\r
 [ 5 MTLR BLRL ]\r
 [ 5 MTCTR BCTR ] \ (call) define-combinator-primitive\r
@@ -330,7 +329,7 @@ CONSTANT: ctx-reg 16
 [\r
     3 ds-reg 0 LWZ\r
     ds-reg dup 4 SUBI\r
-    4 3 word-xt-offset LWZ\r
+    4 3 word-entry-point-offset LWZ\r
 ]\r
 [ 4 MTLR BLRL ]\r
 [ 4 MTCTR BCTR ] \ (execute) define-combinator-primitive\r
@@ -338,7 +337,7 @@ CONSTANT: ctx-reg 16
 [\r
     3 ds-reg 0 LWZ\r
     ds-reg dup 4 SUBI\r
-    4 3 word-xt-offset LWZ\r
+    4 3 word-entry-point-offset LWZ\r
     4 MTCTR BCTR\r
 ] jit-execute jit-define\r
 \r
@@ -348,7 +347,7 @@ CONSTANT: ctx-reg 16
     ! Save ctx->callstack_bottom\r
     1 ctx-reg context-callstack-bottom-offset STW\r
     ! Call quotation\r
-    5 3 quot-xt-offset LWZ\r
+    5 3 quot-entry-point-offset LWZ\r
     5 MTLR\r
     BLRL\r
     jit-save-context\r
@@ -370,7 +369,7 @@ CONSTANT: ctx-reg 16
     0 MTLR\r
 \r
     ! Call quotation\r
-    4 3 quot-xt-offset LWZ\r
+    4 3 quot-entry-point-offset LWZ\r
     4 MTCTR\r
     BCTR\r
 ] \ unwind-native-frames define-sub-primitive\r
@@ -409,7 +408,7 @@ CONSTANT: ctx-reg 16
     0 2 LOAD32 "lazy_jit_compile" f rc-absolute-ppc-2/2 jit-dlsym\r
     2 MTLR\r
     BLRL\r
-    5 3 quot-xt-offset LWZ\r
+    5 3 quot-entry-point-offset LWZ\r
 ]\r
 [ 5 MTLR BLRL ]\r
 [ 5 MTCTR BCTR ]\r
index 48423279737d89141775c1344c9950b1856acd01..a914b3551e7de1800403cc827331a05450319a1f 100644 (file)
@@ -81,7 +81,7 @@ M: ppc %inc-r ( n -- ) rs-reg (%inc) ;
 HOOK: reserved-area-size os ( -- n )
 
 ! The start of the stack frame contains the size of this frame
-! as well as the currently executing XT
+! as well as the currently executing code block
 : factor-area-size ( -- n ) 2 cells ; foldable
 : next-save ( n -- i ) cell - ; foldable
 : xt-save ( n -- i ) 2 cells - ; foldable
@@ -702,7 +702,7 @@ M: ppc %alien-invoke ( symbol dll -- )
 M: ppc %alien-callback ( quot -- )
     3 4 %restore-context
     3 swap %load-reference
-    4 3 quot-xt-offset LWZ
+    4 3 quot-entry-point-offset LWZ
     4 MTLR
     BLRL
     3 4 %save-context ;
index 0f98170d66659634834a37213cfd9b284fb92c81..3348ef0e963f06e3e1a3ae03ffd652c3c1cfbfed 100644 (file)
@@ -244,7 +244,7 @@ M: x86.32 %alien-indirect ( -- )
 M: x86.32 %alien-callback ( quot -- )
     EAX EDX %restore-context
     EAX swap %load-reference
-    EAX quot-xt-offset [+] CALL
+    EAX quot-entry-point-offset [+] CALL
     EAX EDX %save-context ;
 
 M: x86.32 %callback-value ( ctype -- )
index bcab5a54ee4b93c0f52e2589d80b09d01dc301fa..35c5e4bc7baddaba630b062da4a4dc86d0affbb9 100644 (file)
@@ -30,7 +30,7 @@ IN: bootstrap.x86
 [
     ! save stack frame size
     stack-frame-size PUSH
-    ! push XT
+    ! push entry point
     0 PUSH rc-absolute-cell rt-this jit-rel
     ! alignment
     ESP stack-frame-size 3 bootstrap-cells - SUB
@@ -74,7 +74,7 @@ IN: bootstrap.x86
     EDX stack-reg stack-frame-size 4 - [+] LEA
     ctx-reg context-callstack-bottom-offset [+] EDX MOV
     ! call the quotation
-    EAX quot-xt-offset [+] CALL
+    EAX quot-entry-point-offset [+] CALL
     ! save ds, rs registers
     jit-save-context
 ] \ c-to-factor define-sub-primitive
@@ -83,8 +83,8 @@ IN: bootstrap.x86
     EAX ds-reg [] MOV
     ds-reg bootstrap-cell SUB
 ]
-[ EAX quot-xt-offset [+] CALL ]
-[ EAX quot-xt-offset [+] JMP ]
+[ EAX quot-entry-point-offset [+] CALL ]
+[ EAX quot-entry-point-offset [+] JMP ]
 \ (call) define-combinator-primitive
 
 [
@@ -108,7 +108,7 @@ IN: bootstrap.x86
     jit-restore-context
 
     ! Call quotation
-    EAX quot-xt-offset [+] JMP
+    EAX quot-entry-point-offset [+] JMP
 ] \ unwind-native-frames define-sub-primitive
 
 [
@@ -150,8 +150,8 @@ IN: bootstrap.x86
     ! Call VM
     0 CALL "lazy_jit_compile" f rc-relative jit-dlsym
 ]
-[ EAX quot-xt-offset [+] CALL ]
-[ EAX quot-xt-offset [+] JMP ]
+[ EAX quot-entry-point-offset [+] CALL ]
+[ EAX quot-entry-point-offset [+] JMP ]
 \ lazy-jit-compile define-combinator-primitive
 
 ! Inline cache miss entry points
index 676c96ce50787e2b0bfd6dc111e811f2bce5662c..d3196397c311a0d0c915477f1182e395407e6a38 100644 (file)
@@ -234,7 +234,7 @@ M: x86.64 %alien-indirect ( -- )
 M: x86.64 %alien-callback ( quot -- )
     param-reg-0 param-reg-1 %restore-context
     param-reg-0 swap %load-reference
-    param-reg-0 quot-xt-offset [+] CALL
+    param-reg-0 quot-entry-point-offset [+] CALL
     param-reg-0 param-reg-1 %save-context ;
 
 M: x86.64 %callback-value ( ctype -- )
index 74943a94bb99fe09b899e60a12220a7113d05528..ddfc6dbd6fce49b842539c8e3dc5c283fa0f1fec 100644 (file)
@@ -27,11 +27,11 @@ IN: bootstrap.x86
 : rex-length ( -- n ) 1 ;
 
 [
-    ! load XT
+    ! load entry point
     safe-reg 0 MOV rc-absolute-cell rt-this jit-rel
     ! save stack frame size
     stack-frame-size PUSH
-    ! push XT
+    ! push entry point
     safe-reg PUSH
     ! alignment
     RSP stack-frame-size 3 bootstrap-cells - SUB
@@ -67,7 +67,7 @@ IN: bootstrap.x86
     safe-reg stack-reg stack-frame-size 8 - [+] LEA
     ctx-reg context-callstack-bottom-offset [+] safe-reg MOV
     ! call the quotation
-    arg1 quot-xt-offset [+] CALL
+    arg1 quot-entry-point-offset [+] CALL
     jit-save-context
 ] \ c-to-factor define-sub-primitive
 
@@ -75,8 +75,8 @@ IN: bootstrap.x86
     arg1 ds-reg [] MOV
     ds-reg bootstrap-cell SUB
 ]
-[ arg1 quot-xt-offset [+] CALL ]
-[ arg1 quot-xt-offset [+] JMP ]
+[ arg1 quot-entry-point-offset [+] CALL ]
+[ arg1 quot-entry-point-offset [+] JMP ]
 \ (call) define-combinator-primitive
 
 [
@@ -97,7 +97,7 @@ IN: bootstrap.x86
     jit-restore-context
 
     ! Call quotation
-    arg1 quot-xt-offset [+] JMP
+    arg1 quot-entry-point-offset [+] JMP
 ] \ unwind-native-frames define-sub-primitive
 
 [
@@ -133,8 +133,8 @@ IN: bootstrap.x86
     safe-reg 0 MOV "lazy_jit_compile" f rc-absolute-cell jit-dlsym
     safe-reg CALL
 ]
-[ return-reg quot-xt-offset [+] CALL ]
-[ return-reg quot-xt-offset [+] JMP ]
+[ return-reg quot-entry-point-offset [+] CALL ]
+[ return-reg quot-entry-point-offset [+] JMP ]
 \ lazy-jit-compile define-combinator-primitive
 
 ! Inline cache miss entry points
index 96d21972d50ebb7d717a3d36b0761d71a5b087fb..2304f9c9f3761f49a597550c658289601bd20548 100644 (file)
@@ -34,7 +34,7 @@ big-endian off
     vm-reg 0 MOV rc-absolute-cell rt-vm jit-rel
 
     ! Call into Factor code
-    safe-reg 0 MOV rc-absolute-cell rt-xt jit-rel
+    safe-reg 0 MOV rc-absolute-cell rt-entry-point jit-rel
     safe-reg CALL
 
     ! Tear down register shadow area
@@ -61,9 +61,9 @@ big-endian off
     temp0 profile-count-offset [+] 1 tag-fixnum ADD
     ! Load word->code
     temp0 temp0 word-code-offset [+] MOV
-    ! Compute word XT
+    ! Compute word entry point
     temp0 compiled-header-size ADD
-    ! Jump to XT
+    ! Jump to entry point
     temp0 JMP
 ] jit-profiling jit-define
 
@@ -78,11 +78,11 @@ big-endian off
 
 [
     temp3 0 MOV rc-absolute-cell rt-here jit-rel
-    0 JMP rc-relative rt-xt-pic-tail jit-rel
+    0 JMP rc-relative rt-entry-point-pic-tail jit-rel
 ] jit-word-jump jit-define
 
 [
-    0 CALL rc-relative rt-xt-pic jit-rel
+    0 CALL rc-relative rt-entry-point-pic jit-rel
 ] jit-word-call jit-define
 
 [
@@ -93,9 +93,9 @@ big-endian off
     ! compare boolean with f
     temp0 \ f type-number CMP
     ! jump to true branch if not equal
-    0 JNE rc-relative rt-xt jit-rel
+    0 JNE rc-relative rt-entry-point jit-rel
     ! jump to false branch if equal
-    0 JMP rc-relative rt-xt jit-rel
+    0 JMP rc-relative rt-entry-point jit-rel
 ] jit-if jit-define
 
 : jit->r ( -- )
@@ -148,19 +148,19 @@ big-endian off
 
 [
     jit->r
-    0 CALL rc-relative rt-xt jit-rel
+    0 CALL rc-relative rt-entry-point jit-rel
     jit-r>
 ] jit-dip jit-define
 
 [
     jit-2>r
-    0 CALL rc-relative rt-xt jit-rel
+    0 CALL rc-relative rt-entry-point jit-rel
     jit-2r>
 ] jit-2dip jit-define
 
 [
     jit-3>r
-    0 CALL rc-relative rt-xt jit-rel
+    0 CALL rc-relative rt-entry-point jit-rel
     jit-3r>
 ] jit-3dip jit-define
 
@@ -170,14 +170,14 @@ big-endian off
     ! pop stack
     ds-reg bootstrap-cell SUB
 ]
-[ temp0 word-xt-offset [+] CALL ]
-[ temp0 word-xt-offset [+] JMP ]
+[ temp0 word-entry-point-offset [+] CALL ]
+[ temp0 word-entry-point-offset [+] JMP ]
 \ (execute) define-combinator-primitive
 
 [
     temp0 ds-reg [] MOV
     ds-reg bootstrap-cell SUB
-    temp0 word-xt-offset [+] JMP
+    temp0 word-entry-point-offset [+] JMP
 ] jit-execute jit-define
 
 [
@@ -224,7 +224,7 @@ big-endian off
     temp1 temp2 CMP
 ] pic-check-tuple jit-define
 
-[ 0 JE rc-relative rt-xt jit-rel ] pic-hit jit-define
+[ 0 JE rc-relative rt-entry-point jit-rel ] pic-hit jit-define
 
 ! ! ! Megamorphic caches
 
@@ -248,7 +248,7 @@ big-endian off
     temp1 [] 1 ADD
     ! goto get(cache + bootstrap-cell)
     temp0 temp0 bootstrap-cell [+] MOV
-    temp0 word-xt-offset [+] JMP
+    temp0 word-entry-point-offset [+] JMP
     ! fall-through on miss
 ] mega-lookup jit-define
 
index b217f4d659628781381d6dc04c386cda6adc9223..d683e5d6467e96c1311379d86e100f8e7536b9e3 100644 (file)
@@ -486,8 +486,8 @@ M: bad-executable summary
 \ (word) { object object object } { word } define-primitive
 \ (word) make-flushable
 
-\ word-xt { word } { integer integer } define-primitive
-\ word-xt make-flushable
+\ word-code { word } { integer integer } define-primitive
+\ word-code make-flushable
 
 \ special-object { fixnum } { object } define-primitive
 \ special-object make-flushable
@@ -662,8 +662,8 @@ M: bad-executable summary
 \ array>quotation { array } { quotation } define-primitive
 \ array>quotation make-flushable
 
-\ quotation-xt { quotation } { integer } define-primitive
-\ quotation-xt make-flushable
+\ quotation-code { quotation } { integer integer } define-primitive
+\ quotation-code make-flushable
 
 \ <tuple> { tuple-layout } { tuple } define-primitive
 \ <tuple> make-flushable
index 4aec909e883966f4ad2b48b329a73818053f7357..c0b3c9a586cedb2f8e506bc515f63280a9a65993 100644 (file)
@@ -7,12 +7,16 @@ IN: tools.disassembler
 
 GENERIC: disassemble ( obj -- )
 
+<PRIVATE
+
 SYMBOL: disassembler-backend
 
 HOOK: disassemble* disassembler-backend ( from to -- lines )
 
 TR: tabs>spaces "\t" "\s" ;
 
+PRIVATE>
+
 M: byte-array disassemble 
     [
         [ malloc-byte-array &free alien-address dup ]
@@ -22,7 +26,7 @@ M: byte-array disassemble
 
 M: pair disassemble first2 disassemble* [ tabs>spaces print ] each ;
 
-M: word disassemble word-xt 2array disassemble ;
+M: word disassemble word-code 2array disassemble ;
 
 M: quotation disassemble [ dup infer define-temp ] with-compilation-unit disassemble ;
 
index c4c724b69607c77755b911e72195d01a8aeba157..dda666ce6a38dffa0cefe8ea3726142a6cfa63a4 100644 (file)
@@ -1,9 +1,9 @@
-! Copyright (C) 2008 Slava Pestov, Jorge Acereda Macia.
+! Copyright (C) 2008, 2010 Slava Pestov, Jorge Acereda Macia.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: io.files io.files.temp io words alien kernel math.parser
-alien.syntax io.launcher assocs arrays sequences
-namespaces make system math io.encodings.ascii
-accessors tools.disassembler ;
+alien.syntax io.launcher assocs arrays sequences namespaces make
+system math io.encodings.ascii accessors tools.disassembler
+tools.disassembler.private ;
 IN: tools.disassembler.gdb
 
 SINGLETON: gdb-disassembler
index effb2d6f0e0ca71d5aebc0ff28582cbe82fc678a..82c47a5c84899557046af18d8fc6cf716a95693d 100644 (file)
@@ -1,11 +1,11 @@
-! Copyright (C) 2008 Slava Pestov, Jorge Acereda Macia.
+! Copyright (C) 2008, 2010 Slava Pestov, Jorge Acereda Macia.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: tools.disassembler namespaces combinators
 alien alien.syntax alien.c-types lexer parser kernel
 sequences layouts math math.order alien.libraries
 math.parser system make fry arrays libc destructors
-tools.disassembler.utils splitting alien.data
-classes.struct ;
+tools.disassembler.utils tools.disassembler.private splitting
+alien.data classes.struct ;
 IN: tools.disassembler.udis
 
 <<
@@ -105,7 +105,7 @@ FUNCTION: char* ud_lookup_mnemonic ( int c ) ;
     dup UD_SYN_INTEL ud_set_syntax ;
 
 : with-ud ( quot: ( ud -- ) -- )
-    [ [ [ <ud> ] dip call ] with-destructors ] with-words-xt ; inline
+    [ [ [ <ud> ] dip call ] with-destructors ] with-word-entry-points ; inline
 
 SINGLETON: udis-disassembler
 
index fb936cf08a780f0f7068386c004b49dc1322cb41..60e094ac34e9e42e12c089376bf342b21b62d698 100644 (file)
@@ -2,13 +2,13 @@ USING: accessors arrays binary-search kernel math math.order
 math.parser namespaces sequences sorting splitting vectors vocabs words ;
 IN: tools.disassembler.utils
 
-SYMBOL: words-xt
+SYMBOL: word-entry-points
 SYMBOL: smallest-xt
 SYMBOL: greatest-xt
 
-: (words-xt) ( -- assoc )
-    vocabs [ words ] map concat [ [ word-xt ] keep 3array ] map
-    [ [ first ] bi@ <=> ] sort >vector ;
+: (word-entry-points) ( -- assoc )
+    vocabs [ words ] map concat [ [ word-code ] keep 3array ] map
+    [ first ] sort-with ;
 
 : complete-address ( n seq -- str )
     [ first - ] [ third name>> ] bi
@@ -18,7 +18,7 @@ SYMBOL: greatest-xt
     dup [ smallest-xt get < ] [ greatest-xt get > ] bi or [
         drop f
     ] [
-        words-xt get over [ swap first <=> ] curry search nip
+        word-entry-points get over [ swap first <=> ] curry search nip
         2dup second <= [
             [ complete-address ] [ drop f ] if*
         ] [
@@ -33,9 +33,11 @@ SYMBOL: greatest-xt
 : resolve-call ( str -- str' )
     "0x" split1-last [ resolve-xt "0x" glue ] when* ;
 
-: with-words-xt ( quot -- )
-    [ (words-xt)
-      [ words-xt set ]
-      [ first first smallest-xt set ]
-      [ last second greatest-xt set ] tri
-    ] prepose with-scope ; inline
+: with-word-entry-points ( quot -- )
+    [
+        (word-entry-points)
+        [ word-entry-points set ]
+        [ first first smallest-xt set ]
+        [ last second greatest-xt set ] tri
+        call
+    ] with-scope ; inline
index 2a791bf42dae9db130e23c39802c9e4423b1f2df..b9d7a84c7e470064d3c34215edf7d54bb83a1acc 100644 (file)
@@ -420,7 +420,7 @@ tuple
     { "float-u>" "math.private" (( x y -- ? )) }
     { "float-u>=" "math.private" (( x y -- ? )) }
     { "(word)" "words.private" (( name vocab -- word )) }
-    { "word-xt" "words" (( word -- start end )) }
+    { "word-code" "words" (( word -- start end )) }
     { "special-object" "kernel.private" (( n -- obj )) }
     { "set-special-object" "kernel.private" (( obj n -- )) }
     { "(exists?)" "io.files.private" (( path -- ? )) }
@@ -496,7 +496,7 @@ tuple
     { "(clone)" "kernel" (( obj -- newobj )) }
     { "<string>" "strings" (( n ch -- string )) }
     { "array>quotation" "quotations.private" (( array -- quot )) }
-    { "quotation-xt" "quotations" (( quot -- xt )) }
+    { "quotation-code" "quotations" (( quot -- start end )) }
     { "<tuple>" "classes.tuple.private" (( layout -- tuple )) }
     { "profiling" "tools.profiler.private" (( ? -- )) }
     { "become" "kernel.private" (( old new -- )) }
index b6be8d36f33c731c5747a2f4028f555fd0778d1e..e99a7ef695e6e6f75c3cbf6d3a8ce16fb876e901 100644 (file)
@@ -3,7 +3,9 @@ vectors kernel combinators ;
 IN: quotations
 
 ARTICLE: "quotations" "Quotations"
-"A quotation is an anonymous function (a value denoting a snippet of code) which can be used as a value and called. Quotations are delimited by square brackets (" { $snippet "[ ]" } "); see " { $link "syntax-quots" } " for details on their syntax."
+"A quotation is an anonymous function (a value denoting a snippet of code) which can be used as a value and called using the " { $link "call" } "."
+$nl
+"Quotation literals appearing in source code are delimited by square brackets, for example " { $snippet "[ 2 + ]" } "; see " { $link "syntax-quots" } " for details on their syntax."
 $nl
 "Quotations form a class of objects:"
 { $subsections
index a13bfb0740015a37f6949f5987de5f875446b213..5722575ffdab0c75ccedcb781044e22ca7db2f57 100644 (file)
@@ -133,8 +133,8 @@ $nl
 ARTICLE: "word.private" "Word implementation details"
 "The " { $snippet "def" } " slot of a word holds a " { $link quotation } " instance that is called when the word is executed."
 $nl
-"An " { $emphasis "XT" } " (execution token) is the machine code address of a word:"
-{ $subsections word-xt } ;
+"A primitive to get the memory range storing the machine code for a word:"
+{ $subsections word-code } ;
 
 ARTICLE: "words.introspection" "Word introspection"
 "Word introspection facilities and implementation details are found in the " { $vocab-link "words" } " vocabulary."
@@ -209,9 +209,9 @@ HELP: remove-word-prop
 { $description "Removes a word property, so future lookups will output " { $link f } " until it is set again. Word property names are conventionally strings." }
 { $side-effects "word" } ;
 
-HELP: word-xt ( word -- start end )
+HELP: word-code ( word -- start end )
 { $values { "word" word } { "start" "the word's start address" } { "end" "the word's end address" } }
-{ $description "Outputs the machine code address of the word's definition." } ;
+{ $description "Outputs the memory range containing the word's machine code." } ;
 
 HELP: define
 { $values { "word" word } { "def" quotation } }
index cb4ecb1e06b7f523aaf7d14086556fffaf5f2473..4f30e9a89957a00f0da4ee17a5979588f1d3f10a 100644 (file)
@@ -127,4 +127,4 @@ DEFER: x
     ] map harvest
 ] unit-test
 
-[ "hi" word-xt ] must-fail
+[ "hi" word-code ] must-fail
index ebb66bae129d860cdf3fea9f2166341b0fd81e60..416c1395d43444b45e582db45947f3be8535152b 100644 (file)
@@ -38,7 +38,7 @@ void callback_heap::store_callback_operand(code_block *stub, cell index, cell va
 
 void callback_heap::update(code_block *stub)
 {
-       store_callback_operand(stub,1,(cell)callback_xt(stub));
+       store_callback_operand(stub,1,(cell)callback_entry_point(stub));
        stub->flush_icache();
 }
 
@@ -60,7 +60,7 @@ code_block *callback_heap::add(cell owner, cell return_rewind)
        stub->parameters = false_object;
        stub->relocation = false_object;
 
-       memcpy(stub->xt(),insns->data<void>(),size);
+       memcpy(stub->entry_point(),insns->data<void>(),size);
 
        /* Store VM pointer */
        store_callback_operand(stub,0,(cell)parent);
@@ -99,7 +99,7 @@ void factor_vm::primitive_callback()
        tagged<word> w(ctx->pop());
 
        w.untag_check(this);
-       ctx->push(allot_alien(callbacks->add(w.value(),return_rewind)->xt()));
+       ctx->push(allot_alien(callbacks->add(w.value(),return_rewind)->entry_point()));
 }
 
 }
index 0bed3f406d3ddad3391faad268fd314150ad953d..607984ad233c9136c927bdf2c084136c394433e2 100644 (file)
@@ -4,13 +4,13 @@ namespace factor
 /* The callback heap is used to store the machine code that alien-callbacks
 actually jump to when C code invokes them.
 
-The callback heap has entries that look like code_blocks from the code heap,
-but callback heap entries are allocated contiguously, never deallocated, and all
+The callback heap has entries that look like code_blocks from the code heap, but
+callback heap entries are allocated contiguously, never deallocated, and all
 fields but the owner are set to false_object. The owner points to the callback
-bottom word, whose XT is the callback body itself, generated by the optimizing
-compiler. The machine code that follows a callback stub consists of a single
-CALLBACK_STUB machine code template, which performs a jump to a "far" address
-(on PowerPC and x86-64, its loaded into a register first).
+bottom word, whose entry point is the callback body itself, generated by the
+optimizing compiler. The machine code that follows a callback stub consists of a
+single CALLBACK_STUB machine code template, which performs a jump to a "far"
+address (on PowerPC and x86-64, its loaded into a register first).
 
 GC updates the CALLBACK_STUB code if the code block of the callback bottom word
 is ever moved. The callback stub itself won't move, though, and is never
@@ -32,10 +32,10 @@ struct callback_heap {
        explicit callback_heap(cell size, factor_vm *parent);
        ~callback_heap();
 
-       void *callback_xt(code_block *stub)
+       void *callback_entry_point(code_block *stub)
        {
                word *w = (word *)UNTAG(stub->owner);
-               return w->xt;
+               return w->entry_point;
        }
 
        void store_callback_operand(code_block *stub, cell index, cell value);
index b6742534b90a31ee91df7431bd2dab1f6c08f22d..4aa9321353517b92c4260cfe5fd631dab0a6eb7d 100755 (executable)
@@ -6,7 +6,7 @@ namespace factor
 void factor_vm::check_frame(stack_frame *frame)
 {
 #ifdef FACTOR_DEBUG
-       check_code_pointer((cell)frame->xt);
+       check_code_pointer((cell)frame->entry_point);
        assert(frame->size != 0);
 #endif
 }
@@ -63,7 +63,7 @@ void factor_vm::primitive_callstack()
 code_block *factor_vm::frame_code(stack_frame *frame)
 {
        check_frame(frame);
-       return (code_block *)frame->xt - 1;
+       return (code_block *)frame->entry_point - 1;
 }
 
 code_block_type factor_vm::frame_type(stack_frame *frame)
@@ -105,10 +105,10 @@ cell factor_vm::frame_scan(stack_frame *frame)
                        if(obj.type_p(QUOTATION_TYPE))
                        {
                                char *return_addr = (char *)FRAME_RETURN_ADDRESS(frame,this);
-                               char *quot_xt = (char *)(frame_code(frame) + 1);
+                               char *quot_entry_point = (char *)(frame_code(frame) + 1);
 
                                return tag_fixnum(quot_code_offset_to_scan(
-                                       obj.value(),(cell)(return_addr - quot_xt)));
+                                       obj.value(),(cell)(return_addr - quot_entry_point)));
                        }    
                        else
                                return false_object;
@@ -190,9 +190,9 @@ void factor_vm::primitive_set_innermost_stack_frame_quot()
        jit_compile_quot(quot.value(),true);
 
        stack_frame *inner = innermost_stack_frame(callstack.untagged());
-       cell offset = (char *)FRAME_RETURN_ADDRESS(inner,this) - (char *)inner->xt;
-       inner->xt = quot->xt;
-       FRAME_RETURN_ADDRESS(inner,this) = (char *)quot->xt + offset;
+       cell offset = (char *)FRAME_RETURN_ADDRESS(inner,this) - (char *)inner->entry_point;
+       inner->entry_point = quot->entry_point;
+       FRAME_RETURN_ADDRESS(inner,this) = (char *)quot->entry_point + offset;
 }
 
 }
index dce82843f810a434114428e64d16933ce1d98411..ac5d140783f45d62691a1bba121607b6a065c90b 100644 (file)
@@ -42,12 +42,12 @@ struct call_frame_code_block_visitor {
 
        void operator()(stack_frame *frame)
        {
-               cell offset = (cell)FRAME_RETURN_ADDRESS(frame,parent) - (cell)frame->xt;
+               cell offset = (cell)FRAME_RETURN_ADDRESS(frame,parent) - (cell)frame->entry_point;
 
                code_block *new_block = visitor(parent->frame_code(frame));
-               frame->xt = new_block->xt();
+               frame->entry_point = new_block->entry_point();
 
-               FRAME_RETURN_ADDRESS(frame,parent) = (void *)((cell)frame->xt + offset);
+               FRAME_RETURN_ADDRESS(frame,parent) = (void *)((cell)frame->entry_point + offset);
        }
 };
 
@@ -64,14 +64,14 @@ void code_block_visitor<Visitor>::visit_object_code_block(object *obj)
                        if(w->profiling)
                                w->profiling = visitor(w->profiling);
 
-                       parent->update_word_xt(w);
+                       parent->update_word_entry_point(w);
                        break;
                }
        case QUOTATION_TYPE:
                {
                        quotation *q = (quotation *)obj;
                        if(q->code)
-                               parent->set_quot_xt(q,visitor(q->code));
+                               parent->set_quot_entry_point(q,visitor(q->code));
                        break;
                }
        case CALLSTACK_TYPE:
@@ -93,7 +93,9 @@ struct embedded_code_pointers_visitor {
        void operator()(instruction_operand op)
        {
                relocation_type type = op.rel_type();
-               if(type == RT_XT || type == RT_XT_PIC || type == RT_XT_PIC_TAIL)
+               if(type == RT_ENTRY_POINT
+                       || type == RT_ENTRY_POINT_PIC
+                       || type == RT_ENTRY_POINT_PIC_TAIL)
                        op.store_code_block(visitor(op.load_code_block()));
        }
 };
index aaa4369a1dee8b16101c89053935a3b15d81f4e2..3e599786e705223397898ec9fa856781e66fc06e 100755 (executable)
@@ -3,44 +3,44 @@
 namespace factor
 {
 
-cell factor_vm::compute_xt_address(cell obj)
+cell factor_vm::compute_entry_point_address(cell obj)
 {
        switch(tagged<object>(obj).type())
        {
        case WORD_TYPE:
-               return (cell)untag<word>(obj)->xt;
+               return (cell)untag<word>(obj)->entry_point;
        case QUOTATION_TYPE:
-               return (cell)untag<quotation>(obj)->xt;
+               return (cell)untag<quotation>(obj)->entry_point;
        default:
                critical_error("Expected word or quotation",obj);
                return 0;
        }
 }
 
-cell factor_vm::compute_xt_pic_address(word *w, cell tagged_quot)
+cell factor_vm::compute_entry_point_pic_address(word *w, cell tagged_quot)
 {
        if(!to_boolean(tagged_quot) || max_pic_size == 0)
-               return (cell)w->xt;
+               return (cell)w->entry_point;
        else
        {
                quotation *quot = untag<quotation>(tagged_quot);
                if(quot_compiled_p(quot))
-                       return (cell)quot->xt;
+                       return (cell)quot->entry_point;
                else
-                       return (cell)w->xt;
+                       return (cell)w->entry_point;
        }
 }
 
-cell factor_vm::compute_xt_pic_address(cell w_)
+cell factor_vm::compute_entry_point_pic_address(cell w_)
 {
        tagged<word> w(w_);
-       return compute_xt_pic_address(w.untagged(),w->pic_def);
+       return compute_entry_point_pic_address(w.untagged(),w->pic_def);
 }
 
-cell factor_vm::compute_xt_pic_tail_address(cell w_)
+cell factor_vm::compute_entry_point_pic_tail_address(cell w_)
 {
        tagged<word> w(w_);
-       return compute_xt_pic_address(w.untagged(),w->pic_tail_def);
+       return compute_entry_point_pic_address(w.untagged(),w->pic_tail_def);
 }
 
 cell factor_vm::code_block_owner(code_block *compiled)
@@ -74,25 +74,28 @@ struct update_word_references_relocation_visitor {
        {
                switch(op.rel_type())
                {
-               case RT_XT:
+               case RT_ENTRY_POINT:
                        {
                                code_block *compiled = op.load_code_block();
                                cell owner = compiled->owner;
-                               if(to_boolean(owner)) op.store_value(parent->compute_xt_address(owner));
+                               if(to_boolean(owner))
+                                       op.store_value(parent->compute_entry_point_address(owner));
                                break;
                        }
-               case RT_XT_PIC:
+               case RT_ENTRY_POINT_PIC:
                        {
                                code_block *compiled = op.load_code_block();
                                cell owner = parent->code_block_owner(compiled);
-                               if(to_boolean(owner)) op.store_value(parent->compute_xt_pic_address(owner));
+                               if(to_boolean(owner))
+                                       op.store_value(parent->compute_entry_point_pic_address(owner));
                                break;
                        }
-               case RT_XT_PIC_TAIL:
+               case RT_ENTRY_POINT_PIC_TAIL:
                        {
                                code_block *compiled = op.load_code_block();
                                cell owner = parent->code_block_owner(compiled);
-                               if(to_boolean(owner)) op.store_value(parent->compute_xt_pic_tail_address(owner));
+                               if(to_boolean(owner))
+                                       op.store_value(parent->compute_entry_point_pic_tail_address(owner));
                                break;
                        }
                default:
@@ -111,7 +114,7 @@ void factor_vm::update_word_references(code_block *compiled)
                initialize_code_block(compiled);
        /* update_word_references() is always applied to every block in
           the code heap. Since it resets all call sites to point to
-          their canonical XT (cold entry point for non-tail calls,
+          their canonical entry point (cold entry point for non-tail calls,
           standard entry point for tail calls), it means that no PICs
           are referenced after this is done. So instead of polluting
           the code heap with dead PICs that will be freed on the next
@@ -193,11 +196,6 @@ cell factor_vm::compute_dlsym_address(array *literals, cell index)
        }
 }
 
-cell factor_vm::compute_context_address()
-{
-       return (cell)&ctx;
-}
-
 cell factor_vm::compute_vm_address(cell arg)
 {
        return (cell)this + untag_fixnum(arg);
@@ -218,10 +216,7 @@ void factor_vm::store_external_address(instruction_operand op)
                op.store_value(compute_dlsym_address(parameters,index));
                break;
        case RT_THIS:
-               op.store_value((cell)compiled->xt());
-               break;
-       case RT_CONTEXT:
-               op.store_value(compute_context_address());
+               op.store_value((cell)compiled->entry_point());
                break;
        case RT_MEGAMORPHIC_CACHE_HITS:
                op.store_value((cell)&dispatch_stats.megamorphic_cache_hits);
@@ -244,7 +239,10 @@ void factor_vm::store_external_address(instruction_operand op)
 cell factor_vm::compute_here_address(cell arg, cell offset, code_block *compiled)
 {
        fixnum n = untag_fixnum(arg);
-       return n >= 0 ? ((cell)compiled->xt() + offset + n) : ((cell)compiled->xt() - n);
+       if(n >= 0)
+               return (cell)compiled->entry_point() + offset + n;
+       else
+               return (cell)compiled->entry_point() - n;
 }
 
 struct initial_code_block_visitor {
@@ -267,14 +265,14 @@ struct initial_code_block_visitor {
                case RT_LITERAL:
                        op.store_value(next_literal());
                        break;
-               case RT_XT:
-                       op.store_value(parent->compute_xt_address(next_literal()));
+               case RT_ENTRY_POINT:
+                       op.store_value(parent->compute_entry_point_address(next_literal()));
                        break;
-               case RT_XT_PIC:
-                       op.store_value(parent->compute_xt_pic_address(next_literal()));
+               case RT_ENTRY_POINT_PIC:
+                       op.store_value(parent->compute_entry_point_pic_address(next_literal()));
                        break;
-               case RT_XT_PIC_TAIL:
-                       op.store_value(parent->compute_xt_pic_tail_address(next_literal()));
+               case RT_ENTRY_POINT_PIC_TAIL:
+                       op.store_value(parent->compute_entry_point_pic_tail_address(next_literal()));
                        break;
                case RT_HERE:
                        op.store_value(parent->compute_here_address(next_literal(),op.rel_offset(),op.parent_code_block()));
@@ -320,7 +318,7 @@ void factor_vm::fixup_labels(array *labels, code_block *compiled)
                relocation_entry new_entry(RT_HERE,rel_class,offset);
 
                instruction_operand op(new_entry,compiled,0);
-               op.store_value(target + (cell)compiled->xt());
+               op.store_value(target + (cell)compiled->entry_point());
        }
 }
 
index 35abe2234288cf45676956425018e484e878ebaa..baf763357c5911f379c928160d708ab10141dd06 100644 (file)
@@ -43,7 +43,7 @@ struct code_block
                return size;
        }
 
-       void *xt() const
+       void *entry_point() const
        {
                return (void *)(this + 1);
        }
index ac1c0157d2265aadec51a7384539f0243c001e27..b0435bb11f9ebd016d9b35c8b9575452fed01446 100755 (executable)
@@ -141,7 +141,7 @@ void factor_vm::primitive_modify_code_heap()
                        break;
                }
 
-               update_word_xt(word.untagged());
+               update_word_entry_point(word.untagged());
        }
 
        update_code_heap_words();
index 240a725a08aab91ee9ce163fbd76516c5f44f7bf..5e52c70b0c852cd1385b9865e7e2d2d99da02873 100644 (file)
@@ -104,16 +104,16 @@ struct code_block_compaction_relocation_visitor {
 
        void operator()(instruction_operand op)
        {
-               cell old_offset = op.rel_offset() + (cell)old_address->xt();
+               cell old_offset = op.rel_offset() + (cell)old_address->entry_point();
 
                switch(op.rel_type())
                {
                case RT_LITERAL:
                        op.store_value(slot_forwarder.visit_pointer(op.load_value(old_offset)));
                        break;
-               case RT_XT:
-               case RT_XT_PIC:
-               case RT_XT_PIC_TAIL:
+               case RT_ENTRY_POINT:
+               case RT_ENTRY_POINT_PIC:
+               case RT_ENTRY_POINT_PIC_TAIL:
                        op.store_code_block(code_forwarder.visit_code_block(op.load_code_block(old_offset)));
                        break;
                case RT_HERE:
index dc87c5f301d1366d5752a2f0fdc89dbd100ae52c..419eb690ff9577ff8fc3ca120fbf42b10d6aeff2 100755 (executable)
@@ -171,7 +171,7 @@ struct stack_frame_printer {
                std::cout << std::hex << (cell)parent->frame_executing(frame) << std::dec;
                std::cout << std::endl;
                std::cout << "word/quot xt: ";
-               std::cout << std::hex << (cell)frame->xt << std::dec;
+               std::cout << std::hex << (cell)frame->entry_point << std::dec;
                std::cout << std::endl;
                std::cout << "return address: ";
                std::cout << std::hex << (cell)FRAME_RETURN_ADDRESS(frame,parent) << std::dec;
index f5f37ce00e0410722a88a84437466d020137a8e3..e07e343a964faa913f8603b2e9639893e5de1697 100644 (file)
@@ -13,7 +13,7 @@ void factor_vm::c_to_factor(cell quot)
        {
                tagged<word> c_to_factor_word(special_objects[C_TO_FACTOR_WORD]);
                code_block *c_to_factor_block = callbacks->add(c_to_factor_word.value(),0);
-               c_to_factor_func = (c_to_factor_func_type)c_to_factor_block->xt();
+               c_to_factor_func = (c_to_factor_func_type)c_to_factor_block->entry_point();
        }
 
        c_to_factor_func(quot);
@@ -22,7 +22,7 @@ void factor_vm::c_to_factor(cell quot)
 void factor_vm::unwind_native_frames(cell quot, stack_frame *to)
 {
        tagged<word> unwind_native_frames_word(special_objects[UNWIND_NATIVE_FRAMES_WORD]);
-       unwind_native_frames_func_type unwind_native_frames_func = (unwind_native_frames_func_type)unwind_native_frames_word->xt;
+       unwind_native_frames_func_type unwind_native_frames_func = (unwind_native_frames_func_type)unwind_native_frames_word->entry_point;
        unwind_native_frames_func(quot,to);
 }
 
index cda07c9b0e072705d39587768c0a8bcdde9add3d..68701c47363468047ca183c50bc55b762a7a496b 100755 (executable)
@@ -178,16 +178,16 @@ struct code_block_fixup_relocation_visitor {
        void operator()(instruction_operand op)
        {
                code_block *compiled = op.parent_code_block();
-               cell old_offset = op.rel_offset() + (cell)compiled->xt() - code_offset;
+               cell old_offset = op.rel_offset() + (cell)compiled->entry_point() - code_offset;
 
                switch(op.rel_type())
                {
                case RT_LITERAL:
                        op.store_value(data_visitor.visit_pointer(op.load_value(old_offset)));
                        break;
-               case RT_XT:
-               case RT_XT_PIC:
-               case RT_XT_PIC_TAIL:
+               case RT_ENTRY_POINT:
+               case RT_ENTRY_POINT_PIC:
+               case RT_ENTRY_POINT_PIC_TAIL:
                        op.store_code_block(code_visitor(op.load_code_block(old_offset)));
                        break;
                case RT_HERE:
index 092b210cc8f4484e2b2abf40a2eb94814b8c45b3..c8a1b228790132942e9af38d322d5f1e6bff062d 100755 (executable)
@@ -11,10 +11,10 @@ void factor_vm::init_inline_caching(int max_size)
 void factor_vm::deallocate_inline_cache(cell return_address)
 {
        /* Find the call target. */
-       void *old_xt = get_call_target(return_address);
-       check_code_pointer((cell)old_xt);
+       void *old_entry_point = get_call_target(return_address);
+       check_code_pointer((cell)old_entry_point);
 
-       code_block *old_block = (code_block *)old_xt - 1;
+       code_block *old_block = (code_block *)old_entry_point - 1;
 
        /* Free the old PIC since we know its unreachable */
        if(old_block->pic_p())
@@ -148,7 +148,7 @@ code_block *factor_vm::compile_inline_cache(fixnum index,
 /* A generic word's definition performs general method lookup. */
 void *factor_vm::megamorphic_call_stub(cell generic_word)
 {
-       return untag<word>(generic_word)->xt;
+       return untag<word>(generic_word)->entry_point;
 }
 
 cell factor_vm::inline_cache_size(cell cache_entries)
@@ -226,7 +226,7 @@ void *factor_vm::inline_cache_miss(cell return_address_)
                        generic_word.value(),
                        methods.value(),
                        new_cache_entries.value(),
-                       tail_call_site)->xt();
+                       tail_call_site)->entry_point();
        }
 
        /* Install the new stub. */
index e022b093c4312157b7769d1b4a1af2f922b849b9..db869d9d01574d03e1f0a66a5b7083fe549c6418 100644 (file)
@@ -4,7 +4,7 @@ namespace factor
 {
 
 instruction_operand::instruction_operand(relocation_entry rel_, code_block *compiled_, cell index_) :
-       rel(rel_), compiled(compiled_), index(index_), pointer((cell)compiled_->xt() + rel_.rel_offset()) {}
+       rel(rel_), compiled(compiled_), index(index_), pointer((cell)compiled_->entry_point() + rel_.rel_offset()) {}
 
 /* Load a 32-bit value from a PowerPC LIS/ORI sequence */
 fixnum instruction_operand::load_value_2_2()
@@ -132,7 +132,7 @@ void instruction_operand::store_value(fixnum absolute_value)
 
 void instruction_operand::store_code_block(code_block *compiled)
 {
-       store_value((cell)compiled->xt());
+       store_value((cell)compiled->entry_point());
 }
 
 }
index 0798e5178f49617219f5d944fd7bc1adde8330c0..703e1a21f437a13f600025d3d95ed88861cbd95f 100644 (file)
@@ -6,22 +6,18 @@ enum relocation_type {
        RT_PRIMITIVE,
        /* arg is a literal table index, holding an array pair (symbol/dll) */
        RT_DLSYM,
-       /* a pointer to a compiled word reference */
-       RT_DISPATCH,
        /* a word or quotation's general entry point */
-       RT_XT,
+       RT_ENTRY_POINT,
        /* a word's PIC entry point */
-       RT_XT_PIC,
+       RT_ENTRY_POINT_PIC,
        /* a word's tail-call PIC entry point */
-       RT_XT_PIC_TAIL,
+       RT_ENTRY_POINT_PIC_TAIL,
        /* current offset */
        RT_HERE,
        /* current code block */
        RT_THIS,
        /* data heap literal */
        RT_LITERAL,
-       /* address of ctx var */
-       RT_CONTEXT,
        /* untagged fixnum literal */
        RT_UNTAGGED,
        /* address of megamorphic_cache_hits var */
@@ -102,14 +98,13 @@ struct relocation_entry {
                        return 1;
                case RT_DLSYM:
                        return 2;
-               case RT_XT:
-               case RT_XT_PIC:
-               case RT_XT_PIC_TAIL:
+               case RT_ENTRY_POINT:
+               case RT_ENTRY_POINT_PIC:
+               case RT_ENTRY_POINT_PIC_TAIL:
                case RT_LITERAL:
                case RT_HERE:
                case RT_UNTAGGED:
                case RT_THIS:
-               case RT_CONTEXT:
                case RT_MEGAMORPHIC_CACHE_HITS:
                case RT_CARDS_OFFSET:
                case RT_DECKS_OFFSET:
index 2a3eee921475defc309ec77473089305654ef920..9b574e554d359ebb6307296837e889dddb9c4c77 100644 (file)
@@ -232,8 +232,8 @@ struct word : public object {
        cell counter;
        /* TAGGED machine code for sub-primitive */
        cell subprimitive;
-       /* UNTAGGED execution token: jump here to execute word */
-       void *xt;
+       /* UNTAGGED entry point: jump here to execute word */
+       void *entry_point;
        /* UNTAGGED compiled code block */
        code_block *code;
        /* UNTAGGED profiler stub */
@@ -266,8 +266,8 @@ struct quotation : public object {
        cell cached_effect;
        /* tagged */
        cell cache_counter;
-       /* UNTAGGED */
-       void *xt;
+       /* UNTAGGED entry point; jump here to call quotation */
+       void *entry_point;
        /* UNTAGGED compiled code block */
        code_block *code;
 };
@@ -302,7 +302,8 @@ struct dll : public object {
 };
 
 struct stack_frame {
-       void *xt;
+       /* Updated by procedure prologue with procedure start address */
+       void *entry_point;
        /* Frame size in bytes */
        cell size;
 };
index 5521b26a3f9ac4b973f6217be14d9c42cef4efb8..7efcf887b0a9f9eaf981339a1b3d60743f9a32b3 100644 (file)
@@ -48,7 +48,7 @@ PRIMITIVE_FORWARD(float_lesseq)
 PRIMITIVE_FORWARD(float_greater)
 PRIMITIVE_FORWARD(float_greatereq)
 PRIMITIVE_FORWARD(word)
-PRIMITIVE_FORWARD(word_xt)
+PRIMITIVE_FORWARD(word_code)
 PRIMITIVE_FORWARD(special_object)
 PRIMITIVE_FORWARD(set_special_object)
 PRIMITIVE_FORWARD(existsp)
@@ -98,7 +98,7 @@ PRIMITIVE_FORWARD(wrapper)
 PRIMITIVE_FORWARD(clone)
 PRIMITIVE_FORWARD(string)
 PRIMITIVE_FORWARD(array_to_quotation)
-PRIMITIVE_FORWARD(quotation_xt)
+PRIMITIVE_FORWARD(quotation_code)
 PRIMITIVE_FORWARD(tuple)
 PRIMITIVE_FORWARD(profiling)
 PRIMITIVE_FORWARD(become)
@@ -181,7 +181,7 @@ const primitive_type primitives[] = {
        primitive_float_greater,
        primitive_float_greatereq,
        primitive_word,
-       primitive_word_xt,
+       primitive_word_code,
        primitive_special_object,
        primitive_set_special_object,
        primitive_existsp,
@@ -257,7 +257,7 @@ const primitive_type primitives[] = {
        primitive_clone,
        primitive_string,
        primitive_array_to_quotation,
-       primitive_quotation_xt,
+       primitive_quotation_code,
        primitive_tuple,
        primitive_profiling,
        primitive_become,
index c7acc8fe67b3f7fdc36a008f506a87af3d2342b7..fea78692eac3e91f70f7c372503beba87a240b6c 100755 (executable)
@@ -52,7 +52,7 @@ void factor_vm::set_profiling(bool profiling)
                        word->counter = tag_fixnum(0);
                }
 
-               update_word_xt(word.untagged());
+               update_word_entry_point(word.untagged());
        }
 
        update_code_heap_words();
index e4836fe96bfed65e3f70faeb39c253b9ea275dbf..2861ff338861f7db25797aeb48f3bcf3a7efab76 100755 (executable)
@@ -267,10 +267,10 @@ void quotation_jit::iterate_quotation()
        }
 }
 
-void factor_vm::set_quot_xt(quotation *quot, code_block *code)
+void factor_vm::set_quot_entry_point(quotation *quot, code_block *code)
 {
        quot->code = code;
-       quot->xt = code->xt();
+       quot->entry_point = code->entry_point();
 }
 
 /* Allocates memory */
@@ -296,7 +296,7 @@ void factor_vm::jit_compile_quot(cell quot_, bool relocating)
        if(!quot_compiled_p(quot.untagged()))
        {
                code_block *compiled = jit_compile_quot(quot.value(),quot.value(),relocating);
-               set_quot_xt(quot.untagged(),compiled);
+               set_quot_entry_point(quot.untagged(),compiled);
        }
 }
 
@@ -318,15 +318,17 @@ void factor_vm::primitive_array_to_quotation()
        quot->array = ctx->peek();
        quot->cached_effect = false_object;
        quot->cache_counter = false_object;
-       set_quot_xt(quot,lazy_jit_compile_block());
+       set_quot_entry_point(quot,lazy_jit_compile_block());
 
        ctx->replace(tag<quotation>(quot));
 }
 
-void factor_vm::primitive_quotation_xt()
+void factor_vm::primitive_quotation_code()
 {
-       quotation *quot = untag_check<quotation>(ctx->peek());
-       ctx->replace(allot_cell((cell)quot->xt));
+       quotation *quot = untag_check<quotation>(ctx->pop());
+
+       ctx->push(allot_cell((cell)quot->code->entry_point()));
+       ctx->push(allot_cell((cell)quot->code + quot->code->size()));
 }
 
 /* Allocates memory */
@@ -381,7 +383,7 @@ void factor_vm::initialize_all_quotations()
        {
                data_root<quotation> quot(array_nth(quotations.untagged(),i),this);
                if(!quot->code)
-                       set_quot_xt(quot.untagged(),lazy_jit_compile_block());
+                       set_quot_entry_point(quot.untagged(),lazy_jit_compile_block());
        }
 }
 
index 348a7128cc4e6ed8e210eedf7e516f1c80b56afe..eec98281c459c4c3bf83bdd54ddfc2d867d63a2b 100755 (executable)
--- a/vm/vm.hpp
+++ b/vm/vm.hpp
@@ -393,8 +393,8 @@ struct factor_vm
        //words
        word *allot_word(cell name_, cell vocab_, cell hashcode_);
        void primitive_word();
-       void primitive_word_xt();
-       void update_word_xt(word *w_);
+       void primitive_word_code();
+       void update_word_entry_point(word *w_);
        void primitive_optimized_p();
        void primitive_wrapper();
        void jit_compile_word(cell word_, cell def_, bool relocating);
@@ -503,17 +503,16 @@ struct factor_vm
        void primitive_fclose();
 
        //code_block
-       cell compute_xt_address(cell obj);
-       cell compute_xt_pic_address(word *w, cell tagged_quot);
-       cell compute_xt_pic_address(cell w_);
-       cell compute_xt_pic_tail_address(cell w_);
+       cell compute_entry_point_address(cell obj);
+       cell compute_entry_point_pic_address(word *w, cell tagged_quot);
+       cell compute_entry_point_pic_address(cell w_);
+       cell compute_entry_point_pic_tail_address(cell w_);
        cell code_block_owner(code_block *compiled);
        void update_word_references(code_block *compiled);
        void check_code_address(cell address);
        cell compute_primitive_address(cell arg);
        void undefined_symbol();
        cell compute_dlsym_address(array *literals, cell index);
-       cell compute_context_address();
        cell compute_vm_address(cell arg);
        void store_external_address(instruction_operand op);
        cell compute_here_address(cell arg, cell offset, code_block *compiled);
@@ -600,8 +599,8 @@ struct factor_vm
        void primitive_jit_compile();
        code_block *lazy_jit_compile_block();
        void primitive_array_to_quotation();
-       void primitive_quotation_xt();
-       void set_quot_xt(quotation *quot, code_block *code);
+       void primitive_quotation_code();
+       void set_quot_entry_point(quotation *quot, code_block *code);
        code_block *jit_compile_quot(cell owner_, cell quot_, bool relocating);
        void jit_compile_quot(cell quot_, bool relocating);
        fixnum quot_code_offset_to_scan(cell quot_, cell offset);
index 4b3dad71df381de25553d5038d3ec210a1f6b0ff..6cbc8376de17d015ede60d5e2fa590360e4135c7 100644 (file)
@@ -33,7 +33,7 @@ void factor_vm::compile_all_words()
                if(!word->code || !word->code->optimized_p())
                        jit_compile_word(word.value(),word->def,false);
 
-               update_word_xt(word.untagged());
+               update_word_entry_point(word.untagged());
        }
 }
 
@@ -64,7 +64,7 @@ word *factor_vm::allot_word(cell name_, cell vocab_, cell hashcode_)
                initialize_code_block(new_word->profiling);
        }
 
-       update_word_xt(new_word.untagged());
+       update_word_entry_point(new_word.untagged());
 
        return new_word.untagged();
 }
@@ -78,30 +78,30 @@ void factor_vm::primitive_word()
        ctx->push(tag<word>(allot_word(name,vocab,hashcode)));
 }
 
-/* word-xt ( word -- start end ) */
-void factor_vm::primitive_word_xt()
+/* word-code ( word -- start end ) */
+void factor_vm::primitive_word_code()
 {
        data_root<word> w(ctx->pop(),this);
        w.untag_check(this);
 
        if(profiling_p)
        {
-               ctx->push(allot_cell((cell)w->profiling->xt()));
+               ctx->push(allot_cell((cell)w->profiling->entry_point()));
                ctx->push(allot_cell((cell)w->profiling + w->profiling->size()));
        }
        else
        {
-               ctx->push(allot_cell((cell)w->code->xt()));
+               ctx->push(allot_cell((cell)w->code->entry_point()));
                ctx->push(allot_cell((cell)w->code + w->code->size()));
        }
 }
 
-void factor_vm::update_word_xt(word *w)
+void factor_vm::update_word_entry_point(word *w)
 {
        if(profiling_p && w->profiling)
-               w->xt = w->profiling->xt();
+               w->entry_point = w->profiling->entry_point();
        else
-               w->xt = w->code->xt();
+               w->entry_point = w->code->entry_point();
 }
 
 void factor_vm::primitive_optimized_p()