Fix problem which only seems to occur on Core Duo: we were relying on unspecified behavior, and that is SHL setting the overflow flag with a shift count greater than one
parent
d8be9e23ec
commit
a393fe218c
|
@ -27,10 +27,15 @@ M: cs-loc v>operand cs-loc-n cs-reg reg-stack ;
|
||||||
: %alien-invoke ( symbol dll -- )
|
: %alien-invoke ( symbol dll -- )
|
||||||
2dup dlsym CALL rel-relative rel-dlsym ;
|
2dup dlsym CALL rel-relative rel-dlsym ;
|
||||||
|
|
||||||
|
: with-aligned-stack ( n quot -- )
|
||||||
|
#! On Linux, there is no requirement to align stack frames,
|
||||||
|
#! so this is mostly a no-op.
|
||||||
|
swap slip stack-reg swap ADD ; inline
|
||||||
|
|
||||||
: compile-c-call* ( symbol dll args -- operands )
|
: compile-c-call* ( symbol dll args -- operands )
|
||||||
<reversed>
|
dup length cells [
|
||||||
[ [ PUSH ] each %alien-invoke ] keep
|
<reversed> [ PUSH ] each %alien-invoke
|
||||||
[ drop EDX POP ] each ;
|
] with-aligned-stack ;
|
||||||
|
|
||||||
GENERIC: push-return-reg ( reg-class -- )
|
GENERIC: push-return-reg ( reg-class -- )
|
||||||
GENERIC: pop-return-reg ( reg-class -- )
|
GENERIC: pop-return-reg ( reg-class -- )
|
||||||
|
|
|
@ -352,6 +352,9 @@ M: operand CMP OCT: 071 2-operand ;
|
||||||
: DIV ( dst -- ) BIN: 110 t HEX: f7 1-operand ;
|
: DIV ( dst -- ) BIN: 110 t HEX: f7 1-operand ;
|
||||||
: IDIV ( src -- ) BIN: 111 t HEX: f7 1-operand ;
|
: IDIV ( src -- ) BIN: 111 t HEX: f7 1-operand ;
|
||||||
|
|
||||||
|
GENERIC: IMUL2 ( dst src -- )
|
||||||
|
M: integer IMUL2 swap dup reg-code t HEX: 69 immediate-1/4 ;
|
||||||
|
|
||||||
: CDQ HEX: 99 assemble-1 ;
|
: CDQ HEX: 99 assemble-1 ;
|
||||||
: CQO HEX: 48 assemble-1 CDQ ;
|
: CQO HEX: 48 assemble-1 CDQ ;
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@ IN: compiler
|
||||||
"y" operand "x" operand MOV
|
"y" operand "x" operand MOV
|
||||||
! Tag the value, since division cancelled tags from both
|
! Tag the value, since division cancelled tags from both
|
||||||
! inputs
|
! inputs
|
||||||
"x" operand tag-bits SHL
|
"x" operand 1 tag-bits shift IMUL2
|
||||||
! Did it overflow?
|
! Did it overflow?
|
||||||
"end" get JNO
|
"end" get JNO
|
||||||
! There was an overflow, so make ECX into a bignum. we must
|
! There was an overflow, so make ECX into a bignum. we must
|
||||||
|
|
Loading…
Reference in New Issue