bootstrap.x86: using 32 bit regs as operands when it's safe to do so

It shaves off a few bytes as e.g and eax, 0xf is one byte shorter than and rax, 0xf
locals-and-roots
Björn Lindqvist 2016-05-30 02:39:06 +02:00
parent 4509371f7c
commit 8f2738cd82
1 changed files with 14 additions and 9 deletions

View File

@ -7,6 +7,11 @@ locals.backend math math.private memory namespaces sequences
slots.private strings.private vocabs ;
IN: bootstrap.x86
: temp0/32 ( -- reg )
temp0 32-bit-version-of ;
: temp1/32 ( -- reg )
temp1 32-bit-version-of ;
big-endian off
! C to Factor entry point
@ -231,19 +236,19 @@ big-endian off
temp1 ds-reg 0x7f [+] MOV f rc-absolute-1 rel-untagged
] PIC-LOAD jit-define
[ temp1 tag-mask get AND ] PIC-TAG jit-define
[ temp1/32 tag-mask get AND ] PIC-TAG jit-define
[
temp0 temp1 MOV
temp1 tag-mask get AND
temp1 tuple type-number CMP
temp1/32 tag-mask get AND
temp1/32 tuple type-number CMP
[ JNE ]
[ temp1 temp0 tuple-class-offset [+] MOV ]
jit-conditional
] PIC-TUPLE jit-define
[
temp1 0x7f CMP f rc-absolute-1 rel-untagged
temp1/32 0x7f CMP f rc-absolute-1 rel-untagged
] PIC-CHECK-TAG jit-define
[ 0 JE f rc-relative rel-word ] PIC-HIT jit-define
@ -253,9 +258,9 @@ big-endian off
[
! class = ...
temp0 temp1 MOV
temp1 tag-mask get AND
temp1 tag-bits get SHL
temp1 tuple type-number tag-fixnum CMP
temp1/32 tag-mask get AND
temp1/32 tag-bits get SHL
temp1/32 tuple type-number tag-fixnum CMP
[ JNE ]
[ temp1 temp0 tuple-class-offset [+] MOV ]
jit-conditional
@ -484,9 +489,9 @@ big-endian off
! load from stack
temp0 ds-reg [] MOV
! compute tag
temp0 tag-mask get AND
temp0/32 tag-mask get AND
! tag the tag
temp0 tag-bits get SHL
temp0/32 tag-bits get SHL
! push to stack
ds-reg [] temp0 MOV
] }