]> gitweb.factorcode.org Git - factor.git/commitdiff
cpu.x86,bootstrap.assembler.*: making sure 0 is the relocation dummy value everywhere
authorBjörn Lindqvist <bjourne@gmail.com>
Thu, 19 May 2016 20:43:52 +0000 (22:43 +0200)
committerBjörn Lindqvist <bjourne@gmail.com>
Thu, 19 May 2016 20:43:52 +0000 (22:43 +0200)
In some places it was 0xffffffff, but it should always be 0 MOV for
consistency.

basis/bootstrap/assembler/x86.64.factor
basis/cpu/x86/x86-tests.factor
basis/cpu/x86/x86.factor

index 398d7bb85a93e82bc1fd7873963bf68cf2488c4c..5fb01a89dae4df499cd2480b9b438a4624be463c 100644 (file)
@@ -107,7 +107,7 @@ IN: bootstrap.x86
 \ lazy-jit-compile define-combinator-primitive
 
 [
-    temp2 0xffffffff MOV f rc-absolute-cell rel-literal
+    temp2 0 MOV f rc-absolute-cell rel-literal
     temp1 temp2 CMP
 ] PIC-CHECK-TUPLE jit-define
 
index b224efa62a4eb33e633124a7fb1248a874763c98..b79ff87e7d67108ba9056dbcbf5755f0bbb821dc 100644 (file)
@@ -12,6 +12,15 @@ IN: cpu.x86.tests
     assert=
 ] unit-test
 
+! (%compare-tagged)
+cpu x86.64? [
+    {
+        B{ 72 129 248 255 255 255 255 }
+    } [
+        init-relocation [ RAX RAX (%compare-tagged) ] B{ } make
+    ] unit-test
+] when
+
 ! %add-imm
 {
     B{ 72 255 192 }
@@ -21,6 +30,14 @@ IN: cpu.x86.tests
     [ RAX RAX 29 %add-imm ] B{ } make
 ] unit-test
 
+! %alien-invoke
+{ 1 } [
+    init-relocation init-gc-maps [
+        { } { } { } { } 0 0 { } "dll" T{ gc-map { scrub-d V{ 0 } } } %alien-invoke
+    ] B{ } make drop
+    gc-maps get length
+] unit-test
+
 ! %call-gc
 { V{ } } [
     init-relocation init-gc-maps
@@ -34,20 +51,22 @@ IN: cpu.x86.tests
     gc-maps get length
 ] unit-test
 
-! %alien-invoke
-{ 1 } [
-    init-relocation init-gc-maps [
-        { } { } { } { } 0 0 { } "dll" T{ gc-map { scrub-d V{ 0 } } } %alien-invoke
-    ] B{ } make drop
-    gc-maps get length
-] unit-test
-
 ! %clear
 { t } [
     [ D: 0 %clear ] B{ } make
     cpu x86.32? B{ 199 6 144 18 0 0 } B{ 73 199 6 144 18 0 0 } ? =
 ] unit-test
 
+! %dispatch
+cpu x86.64? [
+    {
+        B{ 72 187 0 0 0 0 0 0 0 0 72 255 100 3 6 0 }
+    }
+    [
+        init-relocation [ RAX RBX %dispatch ] B{ } make
+    ] unit-test
+] when
+
 ! %prologue
 { t } [
     [ 2 cells %prologue ] B{ } make
@@ -58,3 +77,13 @@ IN: cpu.x86.tests
     [ 8 cells %prologue ] B{ } make
     [ stack-reg 7 cells SUB ] B{ } make =
 ] unit-test
+
+!  %replace-imm
+cpu x86.64? [
+    {
+        B{ 73 199 6 0 0 0 0 }
+    }
+    [
+        init-relocation [ 34.0 D: 0 %replace-imm ] B{ } make
+    ] unit-test
+] when
index 2507365b154935ecbebe27e04b6f9cbe24dfc3a5..1a9af24b63b956d9aef16278f235ab6c57eaa86a 100644 (file)
@@ -87,7 +87,7 @@ M: x86 %replace-imm
     {
         { [ dup not ] [ drop \ f type-number MOV ] }
         { [ dup fixnum? ] [ tag-fixnum MOV ] }
-        [ [ 0xffffffff MOV ] dip rc-absolute rel-literal ]
+        [ [ 0 MOV ] dip rc-absolute rel-literal ]
     } cond ;
 
 M: x86 %clear ( loc -- )
@@ -598,9 +598,9 @@ M:: x86 %compare-imm-branch ( label src1 src2 cc -- )
 
 M:: x86 %dispatch ( src temp -- )
     ! Load jump table base.
-    temp 0xffffffff MOV
-    building get length :> start
+    temp 0 MOV
     0 rc-absolute-cell rel-here
+    building get length :> start
     ! Add jump table base
     temp src 0x7f [++] JMP
     building get length :> end