Skip to content

Commit

Permalink
cpu.x86.*: fix %prepare-var-args
Browse files Browse the repository at this point in the history
EAX EAX XOR over RAX shaves off one byte
  • Loading branch information
bjourne committed Jul 29, 2016
1 parent 4f74f5b commit b2ed71e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion basis/cpu/x86/64/64.factor
Expand Up @@ -112,7 +112,7 @@ M: x86.64 %end-callback ( -- )
param-reg-0 vm-reg MOV
"end_callback" f f %c-invoke ;

M: x86.64 %prepare-var-args ( -- ) RAX RAX XOR ;
M: x86.64 %prepare-var-args ( -- ) EAX EAX XOR ;

M: x86.64 stack-cleanup 3drop 0 ;

Expand Down
2 changes: 0 additions & 2 deletions basis/cpu/x86/64/unix/unix.factor
Expand Up @@ -44,5 +44,3 @@ M: x86.64 dummy-stack-params? f ;
M: x86.64 dummy-int-params? f ;

M: x86.64 dummy-fp-params? f ;

M: x86.64 %prepare-var-args RAX RAX XOR ;
10 changes: 9 additions & 1 deletion basis/cpu/x86/x86-tests.factor
Expand Up @@ -2,7 +2,8 @@ USING: compiler.cfg.debugger compiler.cfg.instructions
compiler.cfg.registers compiler.codegen.gc-maps
compiler.codegen.relocation cpu.architecture cpu.x86 cpu.x86.assembler
cpu.x86.assembler.operands cpu.x86.features kernel kernel.private
layouts make math math.libm namespaces sequences system tools.test ;
layouts literals make math math.libm namespaces sequences system
tools.test ;
IN: cpu.x86.tests

{ } [
Expand Down Expand Up @@ -79,6 +80,13 @@ cpu x86.64? [
[ RCX 0 %load-immediate ] B{ } make
] unit-test

! %prepare-varargs
${
cpu x86.64? B{ 49 192 } B{ } ?
} [
[ %prepare-var-args ] B{ } make
] unit-test

! %prologue
{ t } [
[ 2 cells %prologue ] B{ } make
Expand Down

0 comments on commit b2ed71e

Please sign in to comment.