Update intrinsics
parent
f979ae5b82
commit
048d8daf09
|
@ -20,69 +20,44 @@ IN: cpu.x86.intrinsics
|
||||||
} define-intrinsic
|
} define-intrinsic
|
||||||
|
|
||||||
! Slots
|
! Slots
|
||||||
: %slot-literal-known-tag ( -- op )
|
: %constant-slot ( -- op )
|
||||||
"obj" operand
|
"obj" operand
|
||||||
"n" literal cells
|
"n" literal cells "tag" literal - [+] ;
|
||||||
"obj" operand-tag - [+] ;
|
|
||||||
|
|
||||||
: %slot-literal-any-tag ( -- op )
|
: %computed-slot ( -- op )
|
||||||
"obj" operand %untag
|
|
||||||
"obj" operand "n" literal cells [+] ;
|
|
||||||
|
|
||||||
: %slot-any ( -- op )
|
|
||||||
"obj" operand %untag
|
|
||||||
"n" operand fixnum>slot@
|
"n" operand fixnum>slot@
|
||||||
"obj" operand "n" operand [+] ;
|
"n" operand "obj" operand ADD
|
||||||
|
"n" operand "tag" literal neg [+] ;
|
||||||
|
|
||||||
\ slot {
|
\ (slot) {
|
||||||
! Slot number is literal and the tag is known
|
|
||||||
{
|
{
|
||||||
[ "val" operand %slot-literal-known-tag MOV ] T{ template
|
[ "val" operand %constant-slot MOV ] T{ template
|
||||||
{ input { { f "obj" known-tag } { small-slot "n" } } }
|
{ input { { f "obj" } { small-slot "n" } { small-slot "tag" } } }
|
||||||
{ scratch { { f "val" } } }
|
{ scratch { { f "val" } } }
|
||||||
{ output { "val" } }
|
{ output { "val" } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
! Slot number is literal
|
|
||||||
{
|
{
|
||||||
[ "obj" operand %slot-literal-any-tag MOV ] T{ template
|
[ "val" operand %computed-slot MOV ] T{ template
|
||||||
{ input { { f "obj" } { small-slot "n" } } }
|
{ input { { f "obj" } { f "n" } { small-slot "tag" } } }
|
||||||
{ output { "obj" } }
|
{ scratch { { f "val" } } }
|
||||||
}
|
{ output { "val" } }
|
||||||
}
|
|
||||||
! Slot number in a register
|
|
||||||
{
|
|
||||||
[ "obj" operand %slot-any MOV ] T{ template
|
|
||||||
{ input { { f "obj" } { f "n" } } }
|
|
||||||
{ output { "obj" } }
|
|
||||||
{ clobber { "n" } }
|
{ clobber { "n" } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} define-intrinsics
|
} define-intrinsics
|
||||||
|
|
||||||
\ (set-slot) {
|
\ (set-slot) {
|
||||||
! Slot number is literal and the tag is known
|
|
||||||
{
|
{
|
||||||
[ %slot-literal-known-tag "val" operand MOV ] T{ template
|
[ %constant-slot "val" operand MOV ] T{ template
|
||||||
{ input { { f "val" } { f "obj" known-tag } { small-slot "n" } } }
|
{ input { { f "val" } { f "obj" } { small-slot "n" } { small-slot "tag" } } }
|
||||||
{ scratch { { f "scratch" } } }
|
|
||||||
{ clobber { "obj" } }
|
{ clobber { "obj" } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
! Slot number is literal
|
|
||||||
{
|
{
|
||||||
[ %slot-literal-any-tag "val" operand MOV ] T{ template
|
[ %computed-slot "val" operand MOV ] T{ template
|
||||||
{ input { { f "val" } { f "obj" } { small-slot "n" } } }
|
{ input { { f "val" } { f "obj" } { small-slot "n" } { small-slot "tag" } } }
|
||||||
{ scratch { { f "scratch" } } }
|
{ clobber { "n" } }
|
||||||
{ clobber { "obj" } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
! Slot number in a register
|
|
||||||
{
|
|
||||||
[ %slot-any "val" operand MOV ] T{ template
|
|
||||||
{ input { { f "val" } { f "obj" } { f "n" } } }
|
|
||||||
{ scratch { { f "scratch" } } }
|
|
||||||
{ clobber { "obj" "n" } }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} define-intrinsics
|
} define-intrinsics
|
||||||
|
|
Loading…
Reference in New Issue