compiler.*, stack-checker.*: fixes to make the tests work on 32bit too
parent
76139dca56
commit
a79309680c
|
@ -1,6 +1,6 @@
|
|||
USING: alien.c-types classes.struct compiler.cfg.builder.alien.boxing
|
||||
compiler.cfg.instructions compiler.test cpu.architecture kernel make
|
||||
system tools.test ;
|
||||
compiler.cfg.instructions compiler.cfg.registers compiler.test
|
||||
cpu.architecture kernel make system tools.test ;
|
||||
IN: compiler.cfg.builder.alien.boxing.tests
|
||||
|
||||
STRUCT: some-struct
|
||||
|
@ -16,53 +16,109 @@ STRUCT: some-struct
|
|||
int base-type flatten-c-type
|
||||
] unit-test
|
||||
|
||||
cpu x86.64? [
|
||||
{
|
||||
{ { int-rep f f } { int-rep f f } }
|
||||
} [
|
||||
some-struct base-type base-type flatten-c-type
|
||||
] unit-test
|
||||
] when
|
||||
|
||||
! unbox
|
||||
cpu x86.32?
|
||||
{
|
||||
{ 20 }
|
||||
{ { int-rep f f } }
|
||||
} [
|
||||
20 int base-type unbox
|
||||
{
|
||||
{ int-rep t f }
|
||||
{ int-rep t f }
|
||||
{ int-rep t f }
|
||||
{ int-rep t f }
|
||||
}
|
||||
} {
|
||||
{
|
||||
{ int-rep f f }
|
||||
{ int-rep f f }
|
||||
}
|
||||
} ? [
|
||||
some-struct base-type base-type flatten-c-type
|
||||
] unit-test
|
||||
|
||||
cpu x86.64? [
|
||||
! unbox
|
||||
cpu x86.32?
|
||||
{
|
||||
{ 1 }
|
||||
{ { int-rep f f } }
|
||||
{
|
||||
{ 2 3 }
|
||||
{ { int-rep f f } { int-rep f f } }
|
||||
V{
|
||||
T{ ##unbox-any-c-ptr { dst 1 } { src 20 } }
|
||||
T{ ##load-memory-imm
|
||||
{ dst 2 }
|
||||
{ base 1 }
|
||||
{ offset 0 }
|
||||
{ rep int-rep }
|
||||
}
|
||||
T{ ##load-memory-imm
|
||||
{ dst 3 }
|
||||
{ base 1 }
|
||||
{ offset 8 }
|
||||
{ rep int-rep }
|
||||
}
|
||||
}
|
||||
} [
|
||||
[ 20 some-struct base-type unbox ] V{ } make
|
||||
] cfg-unit-test
|
||||
] when
|
||||
T{ ##unbox
|
||||
{ dst 1 }
|
||||
{ src 20 }
|
||||
{ unboxer "to_fixnum" }
|
||||
{ rep int-rep }
|
||||
}
|
||||
}
|
||||
} {
|
||||
{ 20 }
|
||||
{ { int-rep f f } }
|
||||
{ }
|
||||
} ? [
|
||||
reset-vreg-counter [ 20 int base-type unbox ] { } make
|
||||
] unit-test
|
||||
|
||||
cpu x86.32?
|
||||
{
|
||||
{ 2 3 4 5 }
|
||||
{
|
||||
{ int-rep t f }
|
||||
{ int-rep t f }
|
||||
{ int-rep t f }
|
||||
{ int-rep t f }
|
||||
}
|
||||
{
|
||||
T{ ##unbox-any-c-ptr { dst 1 } { src 20 } }
|
||||
T{ ##load-memory-imm
|
||||
{ dst 2 }
|
||||
{ base 1 }
|
||||
{ offset 0 }
|
||||
{ rep int-rep }
|
||||
}
|
||||
T{ ##load-memory-imm
|
||||
{ dst 3 }
|
||||
{ base 1 }
|
||||
{ offset 4 }
|
||||
{ rep int-rep }
|
||||
}
|
||||
T{ ##load-memory-imm
|
||||
{ dst 4 }
|
||||
{ base 1 }
|
||||
{ offset 8 }
|
||||
{ rep int-rep }
|
||||
}
|
||||
T{ ##load-memory-imm
|
||||
{ dst 5 }
|
||||
{ base 1 }
|
||||
{ offset 12 }
|
||||
{ rep int-rep }
|
||||
}
|
||||
}
|
||||
} {
|
||||
{ 2 3 }
|
||||
{ { int-rep f f } { int-rep f f } }
|
||||
{
|
||||
T{ ##unbox-any-c-ptr { dst 1 } { src 20 } }
|
||||
T{ ##load-memory-imm
|
||||
{ dst 2 }
|
||||
{ base 1 }
|
||||
{ offset 0 }
|
||||
{ rep int-rep }
|
||||
}
|
||||
T{ ##load-memory-imm
|
||||
{ dst 3 }
|
||||
{ base 1 }
|
||||
{ offset 8 }
|
||||
{ rep int-rep }
|
||||
}
|
||||
}
|
||||
} ? [
|
||||
[ 20 some-struct base-type unbox ] { } make
|
||||
] cfg-unit-test
|
||||
|
||||
! unbox-parameter
|
||||
{
|
||||
{ 1 }
|
||||
{ { int-rep f f } }
|
||||
V{ T{ ##unbox-any-c-ptr { dst 1 } { src 77 } } }
|
||||
{ T{ ##unbox-any-c-ptr { dst 1 } { src 77 } } }
|
||||
} [
|
||||
[ 77 c-string base-type unbox-parameter ] V{ } make
|
||||
[ 77 c-string base-type unbox-parameter ] { } make
|
||||
] cfg-unit-test
|
||||
|
||||
! unboxing is only needed on 32bit archs
|
||||
|
@ -70,7 +126,7 @@ cpu x86.32?
|
|||
{
|
||||
{ 1 }
|
||||
{ { int-rep f f } }
|
||||
V{
|
||||
{
|
||||
T{ ##unbox
|
||||
{ dst 1 }
|
||||
{ src 77 }
|
||||
|
@ -78,7 +134,8 @@ cpu x86.32?
|
|||
{ rep int-rep }
|
||||
}
|
||||
}
|
||||
}
|
||||
{ { 77 } { { int-rep f f } } V{ } } ? [
|
||||
[ 77 int base-type unbox-parameter ] V{ } make
|
||||
} {
|
||||
{ 77 } { { int-rep f f } } { }
|
||||
} ? [
|
||||
[ 77 int base-type unbox-parameter ] { } make
|
||||
] cfg-unit-test
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
USING: accessors alien.c-types alien.private kernel kernel.private
|
||||
math namespaces stack-checker.alien stack-checker.state
|
||||
stack-checker.values threads.private tools.test ;
|
||||
USING: accessors alien alien.c-types alien.private kernel
|
||||
kernel.private literals math namespaces stack-checker.alien
|
||||
stack-checker.state stack-checker.values system threads.private
|
||||
tools.test ;
|
||||
IN: stack-checker.alien.tests
|
||||
|
||||
! alien-inputs/outputs
|
||||
|
@ -31,7 +32,17 @@ IN: stack-checker.alien.tests
|
|||
] unit-test
|
||||
|
||||
! wrap-callback-quot
|
||||
{
|
||||
${
|
||||
cpu x86.32?
|
||||
[
|
||||
[
|
||||
{ integer integer } declare [ [ ] dip ] dip
|
||||
"hello" >integer
|
||||
] [
|
||||
dup current-callback eq?
|
||||
[ drop ] [ wait-for-callback ] if
|
||||
] do-callback
|
||||
]
|
||||
[
|
||||
[
|
||||
{ fixnum fixnum } declare [ [ ] dip ] dip
|
||||
|
@ -40,9 +51,8 @@ IN: stack-checker.alien.tests
|
|||
dup current-callback eq?
|
||||
[ drop ] [ wait-for-callback ] if
|
||||
] do-callback
|
||||
]
|
||||
] ?
|
||||
} [
|
||||
alien-node-params new
|
||||
int >>return { int int } >>parameters
|
||||
int { int int } cdecl alien-node-params boa
|
||||
[ "hello" ] wrap-callback-quot
|
||||
] unit-test
|
||||
|
|
Loading…
Reference in New Issue