Rename a few symbols for consistency

slava 2006-10-28 06:43:33 +00:00
parent fe1420ae9e
commit cd1ee7daf7
5 changed files with 119 additions and 119 deletions

View File

@ -94,7 +94,7 @@ M: #if generate-node
end-basic-block end-basic-block
<label> dup %jump-t <label> dup %jump-t
] H{ ] H{
{ +input { { f "flag" } } } { +input+ { { f "flag" } } }
} with-template generate-if ; } with-template generate-if ;
! #call ! #call
@ -141,8 +141,8 @@ M: #call-label generate-node
#! Output the jump table insn and return a list of #! Output the jump table insn and return a list of
#! label/branch pairs. #! label/branch pairs.
[ end-basic-block %dispatch ] H{ [ end-basic-block %dispatch ] H{
{ +input { { f "n" } } } { +input+ { { f "n" } } }
{ +scratch { { f "scratch" } } } { +scratch+ { { f "scratch" } } }
} with-template } with-template
node-children [ <label> dup %target 2array ] map ; node-children [ <label> dup %target 2array ] map ;

View File

@ -206,21 +206,21 @@ SYMBOL: phantom-r
: phantom-append ( seq stack -- ) : phantom-append ( seq stack -- )
over length over adjust-phantom swap nappend ; over length over adjust-phantom swap nappend ;
SYMBOL: +input SYMBOL: +input+
SYMBOL: +output SYMBOL: +output+
SYMBOL: +scratch SYMBOL: +scratch+
SYMBOL: +clobber SYMBOL: +clobber+
: fix-spec ( spec -- spec ) : fix-spec ( spec -- spec )
H{ H{
{ +input { } } { +input+ { } }
{ +output { } } { +output+ { } }
{ +scratch { } } { +scratch+ { } }
{ +clobber { } } { +clobber+ { } }
} swap hash-union ; } swap hash-union ;
: output-vregs ( -- seq seq ) : output-vregs ( -- seq seq )
+output +clobber [ get [ get ] map ] 2apply ; +output+ +clobber+ [ get [ get ] map ] 2apply ;
: outputs-clash? ( -- ? ) : outputs-clash? ( -- ? )
output-vregs append phantoms append output-vregs append phantoms append
@ -241,8 +241,8 @@ SYMBOL: +clobber
[ second reg-spec>class eq? ] contains-with? ; [ second reg-spec>class eq? ] contains-with? ;
: requests-class? ( class -- ? ) : requests-class? ( class -- ? )
dup +input get (requests-class?) swap dup +input+ get (requests-class?) swap
+scratch get (requests-class?) or ; +scratch+ get (requests-class?) or ;
: ?fp-scratch ( -- n ) : ?fp-scratch ( -- n )
T{ float-regs f 8 } requests-class? 1 0 ? ; T{ float-regs f 8 } requests-class? 1 0 ? ;
@ -253,11 +253,11 @@ SYMBOL: +clobber
] unless* ; ] unless* ;
: guess-vregs ( -- int# float# ) : guess-vregs ( -- int# float# )
+input get { } additional-vregs ?fp-scratch + +input+ get { } additional-vregs ?fp-scratch +
+scratch get 0 <column> requested-vregs >r + r> ; +scratch+ get 0 <column> requested-vregs >r + r> ;
: alloc-scratch ( -- ) : alloc-scratch ( -- )
+scratch get [ first2 >r spec>vreg r> set ] each ; +scratch+ get [ first2 >r spec>vreg r> set ] each ;
: template-inputs ( -- ) : template-inputs ( -- )
! Ensure we have enough to hold any new stack elements we ! Ensure we have enough to hold any new stack elements we
@ -265,12 +265,12 @@ SYMBOL: +clobber
guess-vregs ensure-vregs guess-vregs ensure-vregs
! Split the template into available (fast) parts and those ! Split the template into available (fast) parts and those
! that require allocating registers and reading the stack ! that require allocating registers and reading the stack
+input get match-template fast-input slow-input +input+ get match-template fast-input slow-input
! Finally allocate scratch registers ! Finally allocate scratch registers
alloc-scratch ; alloc-scratch ;
: template-outputs ( -- ) : template-outputs ( -- )
+output get [ get ] map phantom-d get phantom-append ; +output+ get [ get ] map phantom-d get phantom-append ;
: with-template ( quot spec -- ) : with-template ( quot spec -- )
fix-spec [ template-inputs call template-outputs ] bind fix-spec [ template-inputs call template-outputs ] bind

View File

@ -44,8 +44,8 @@ M: float-regs (%replace)
! Floats ! Floats
: define-float-op ( word op -- ) : define-float-op ( word op -- )
[ [ "x" operand "y" operand ] % , ] [ ] make H{ [ [ "x" operand "y" operand ] % , ] [ ] make H{
{ +input { { float "x" } { float "y" } } } { +input+ { { float "x" } { float "y" } } }
{ +output { "x" } } { +output+ { "x" } }
} define-intrinsic ; } define-intrinsic ;
{ {
@ -61,7 +61,7 @@ M: float-regs (%replace)
[ [
[ end-basic-block "x" operand "y" operand UCOMISD ] % , [ end-basic-block "x" operand "y" operand UCOMISD ] % ,
] [ ] make H{ ] [ ] make H{
{ +input { { float "x" } { float "y" } } } { +input+ { { float "x" } { float "y" } } }
} define-if-intrinsic ; } define-if-intrinsic ;
{ {

View File

@ -23,16 +23,16 @@ math-internals namespaces sequences words ;
"obj" operand dup untag "obj" operand dup untag
cell log2 [ 0 LWZ ] generate-slot cell log2 [ 0 LWZ ] generate-slot
] H{ ] H{
{ +input { { f "obj" } { f "n" } } } { +input+ { { f "obj" } { f "n" } } }
{ +output { "obj" } } { +output+ { "obj" } }
} define-intrinsic } define-intrinsic
\ char-slot [ \ char-slot [
1 [ string-offset LHZ ] generate-slot 1 [ string-offset LHZ ] generate-slot
"obj" operand dup tag-fixnum "obj" operand dup tag-fixnum
] H{ ] H{
{ +input { { f "n" } { f "obj" } } } { +input+ { { f "n" } { f "obj" } } }
{ +output { "obj" } } { +output+ { "obj" } }
} define-intrinsic } define-intrinsic
: generate-set-slot ( size quot -- ) : generate-set-slot ( size quot -- )
@ -56,9 +56,9 @@ math-internals namespaces sequences words ;
"obj" operand dup untag "obj" operand dup untag
cell log2 [ 0 STW ] generate-set-slot generate-write-barrier cell log2 [ 0 STW ] generate-set-slot generate-write-barrier
] H{ ] H{
{ +input { { f "val" } { f "obj" } { f "slot" } } } { +input+ { { f "val" } { f "obj" } { f "slot" } } }
{ +scratch { { f "x" } } } { +scratch+ { { f "x" } } }
{ +clobber { "obj" "slot" } } { +clobber+ { "obj" "slot" } }
} define-intrinsic } define-intrinsic
\ set-char-slot [ \ set-char-slot [
@ -66,15 +66,15 @@ math-internals namespaces sequences words ;
"val" operand dup untag-fixnum "val" operand dup untag-fixnum
1 [ string-offset STH ] generate-set-slot 1 [ string-offset STH ] generate-set-slot
] H{ ] H{
{ +input { { f "val" } { f "slot" } { f "obj" } } } { +input+ { { f "val" } { f "slot" } { f "obj" } } }
{ +scratch { { f "x" } } } { +scratch+ { { f "x" } } }
{ +clobber { "val" "slot" "obj" } } { +clobber+ { "val" "slot" "obj" } }
} define-intrinsic } define-intrinsic
: define-fixnum-op ( word op -- ) : define-fixnum-op ( word op -- )
[ [ "x" operand "y" operand "x" operand ] % , ] [ ] make H{ [ [ "x" operand "y" operand "x" operand ] % , ] [ ] make H{
{ +input { { f "x" } { f "y" } } } { +input+ { { f "x" } { f "y" } } }
{ +output { "x" } } { +output+ { "x" } }
} define-intrinsic ; } define-intrinsic ;
{ {
@ -98,23 +98,23 @@ math-internals namespaces sequences words ;
"r" operand "x" operand "y" operand DIVW "r" operand "x" operand "y" operand DIVW
generate-fixnum-mod generate-fixnum-mod
] H{ ] H{
{ +input { { f "x" } { f "y" } } } { +input+ { { f "x" } { f "y" } } }
{ +scratch { { f "r" } { f "s" } } } { +scratch+ { { f "r" } { f "s" } } }
{ +output { "s" } } { +output+ { "s" } }
} define-intrinsic } define-intrinsic
\ fixnum-bitnot [ \ fixnum-bitnot [
"x" operand dup NOT "x" operand dup NOT
"x" operand dup untag "x" operand dup untag
] H{ ] H{
{ +input { { f "x" } } } { +input+ { { f "x" } } }
{ +output { "x" } } { +output+ { "x" } }
} define-intrinsic } define-intrinsic
: define-fixnum-jump ( word op -- ) : define-fixnum-jump ( word op -- )
[ [
[ end-basic-block "x" operand 0 "y" operand CMP ] % , [ end-basic-block "x" operand 0 "y" operand CMP ] % ,
] [ ] make H{ { +input { { f "x" } { f "y" } } } } ] [ ] make H{ { +input+ { { f "x" } { f "y" } } } }
define-if-intrinsic ; define-if-intrinsic ;
{ {
@ -144,10 +144,10 @@ math-internals namespaces sequences words ;
"r" operand "y" operand "x" operand ADDO. "r" operand "y" operand "x" operand ADDO.
\ ADD simple-overflow \ ADD simple-overflow
] H{ ] H{
{ +input { { f "x" } { f "y" } } } { +input+ { { f "x" } { f "y" } } }
{ +scratch { { f "r" } } } { +scratch+ { { f "r" } } }
{ +output { "r" } } { +output+ { "r" } }
{ +clobber { "x" "y" } } { +clobber+ { "x" "y" } }
} define-intrinsic } define-intrinsic
\ fixnum- [ \ fixnum- [
@ -156,10 +156,10 @@ math-internals namespaces sequences words ;
"r" operand "y" operand "x" operand SUBFO. "r" operand "y" operand "x" operand SUBFO.
\ SUBF simple-overflow \ SUBF simple-overflow
] H{ ] H{
{ +input { { f "x" } { f "y" } } } { +input+ { { f "x" } { f "y" } } }
{ +scratch { { f "r" } } } { +scratch+ { { f "r" } } }
{ +output { "r" } } { +output+ { "r" } }
{ +clobber { "x" "y" } } { +clobber+ { "x" "y" } }
} define-intrinsic } define-intrinsic
\ fixnum* [ \ fixnum* [
@ -181,10 +181,10 @@ math-internals namespaces sequences words ;
"end" get resolve-label "end" get resolve-label
"s" operand 12 MR "s" operand 12 MR
] H{ ] H{
{ +input { { f "x" } { f "y" } } } { +input+ { { f "x" } { f "y" } } }
{ +scratch { { f "r" } { f "s" } } } { +scratch+ { { f "r" } { f "s" } } }
{ +output { "s" } } { +output+ { "s" } }
{ +clobber { "x" "y" } } { +clobber+ { "x" "y" } }
} define-intrinsic } define-intrinsic
: generate-fixnum/i : generate-fixnum/i
@ -213,10 +213,10 @@ math-internals namespaces sequences words ;
"r" operand "x" operand tag-fixnum "r" operand "x" operand tag-fixnum
"end" get resolve-label "end" get resolve-label
] H{ ] H{
{ +input { { f "x" } { f "y" } } } { +input+ { { f "x" } { f "y" } } }
{ +scratch { { f "r" } { f "s" } } } { +scratch+ { { f "r" } { f "s" } } }
{ +output { "x" } } { +output+ { "x" } }
{ +clobber { "y" } } { +clobber+ { "y" } }
} define-intrinsic } define-intrinsic
\ fixnum/mod [ \ fixnum/mod [
@ -229,16 +229,16 @@ math-internals namespaces sequences words ;
"r" operand "x" operand tag-fixnum "r" operand "x" operand tag-fixnum
"end" get resolve-label "end" get resolve-label
] H{ ] H{
{ +input { { f "x" } { f "y" } } } { +input+ { { f "x" } { f "y" } } }
{ +scratch { { f "r" } { f "s" } } } { +scratch+ { { f "r" } { f "s" } } }
{ +output { "x" "s" } } { +output+ { "x" "s" } }
{ +clobber { "y" } } { +clobber+ { "y" } }
} define-intrinsic } define-intrinsic
: define-float-op ( word op -- ) : define-float-op ( word op -- )
[ [ "x" operand "x" operand "y" operand ] % , ] [ ] make H{ [ [ "x" operand "x" operand "y" operand ] % , ] [ ] make H{
{ +input { { float "x" } { float "y" } } } { +input+ { { float "x" } { float "y" } } }
{ +output { "x" } } { +output+ { "x" } }
} define-intrinsic ; } define-intrinsic ;
{ {
@ -253,7 +253,7 @@ math-internals namespaces sequences words ;
: define-float-jump ( word op -- ) : define-float-jump ( word op -- )
[ [
[ end-basic-block "x" operand 0 "y" operand FCMPU ] % , [ end-basic-block "x" operand 0 "y" operand FCMPU ] % ,
] [ ] make H{ { +input { { float "x" } { float "y" } } } } ] [ ] make H{ { +input+ { { float "x" } { float "y" } } } }
define-if-intrinsic ; define-if-intrinsic ;
{ {
@ -270,9 +270,9 @@ math-internals namespaces sequences words ;
"in" operand "out" operand tag-mask ANDI "in" operand "out" operand tag-mask ANDI
"out" operand dup tag-fixnum "out" operand dup tag-fixnum
] H{ ] H{
{ +input { { f "in" } } } { +input+ { { f "in" } } }
{ +scratch { { f "out" } } } { +scratch+ { { f "out" } } }
{ +output { "out" } } { +output+ { "out" } }
} define-intrinsic } define-intrinsic
\ type [ \ type [
@ -299,9 +299,9 @@ math-internals namespaces sequences words ;
f type tag-bits shift "x" operand LI f type tag-bits shift "x" operand LI
"end" get resolve-label "end" get resolve-label
] H{ ] H{
{ +input { { f "obj" } } } { +input+ { { f "obj" } } }
{ +scratch { { f "x" } { f "y" } } } { +scratch+ { { f "x" } { f "y" } } }
{ +output { "x" } } { +output+ { "x" } }
} define-intrinsic } define-intrinsic
: userenv ( reg -- ) : userenv ( reg -- )
@ -314,10 +314,10 @@ math-internals namespaces sequences words ;
"x" operand "n" operand "x" operand ADD "x" operand "n" operand "x" operand ADD
"x" operand dup 0 LWZ "x" operand dup 0 LWZ
] H{ ] H{
{ +input { { f "n" } } } { +input+ { { f "n" } } }
{ +scratch { { f "x" } } } { +scratch+ { { f "x" } } }
{ +output { "x" } } { +output+ { "x" } }
{ +clobber { "n" } } { +clobber+ { "n" } }
} define-intrinsic } define-intrinsic
\ setenv [ \ setenv [
@ -326,7 +326,7 @@ math-internals namespaces sequences words ;
"x" operand "n" operand "x" operand ADD "x" operand "n" operand "x" operand ADD
"val" operand "x" operand 0 STW "val" operand "x" operand 0 STW
] H{ ] H{
{ +input { { f "val" } { f "n" } } } { +input+ { { f "val" } { f "n" } } }
{ +scratch { { f "x" } } } { +scratch+ { { f "x" } } }
{ +clobber { "n" } } { +clobber+ { "n" } }
} define-intrinsic } define-intrinsic

View File

@ -9,8 +9,8 @@ IN: compiler
"in" operand tag-mask AND "in" operand tag-mask AND
"in" operand tag-bits SHL "in" operand tag-bits SHL
] H{ ] H{
{ +input { { f "in" } } } { +input+ { { f "in" } } }
{ +output { "in" } } { +output+ { "in" } }
} define-intrinsic } define-intrinsic
\ type [ \ type [
@ -44,9 +44,9 @@ IN: compiler
"obj" operand f type tag-bits shift MOV "obj" operand f type tag-bits shift MOV
"end" get resolve-label "end" get resolve-label
] H{ ] H{
{ +input { { f "obj" } } } { +input+ { { f "obj" } } }
{ +scratch { { f "x" } { f "y" } } } { +scratch+ { { f "x" } { f "y" } } }
{ +output { "obj" } } { +output+ { "obj" } }
} define-intrinsic } define-intrinsic
! Slots ! Slots
@ -61,9 +61,9 @@ IN: compiler
! load slot value ! load slot value
"obj" operand dup [] MOV "obj" operand dup [] MOV
] H{ ] H{
{ +input { { f "obj" } { f "n" } } } { +input+ { { f "obj" } { f "n" } } }
{ +output { "obj" } } { +output+ { "obj" } }
{ +clobber { "n" } } { +clobber+ { "n" } }
} define-intrinsic } define-intrinsic
: card-offset 1 getenv ; inline : card-offset 1 getenv ; inline
@ -84,8 +84,8 @@ IN: compiler
"slot" operand [] "val" operand MOV "slot" operand [] "val" operand MOV
generate-write-barrier generate-write-barrier
] H{ ] H{
{ +input { { f "val" } { f "obj" } { f "slot" } } } { +input+ { { f "val" } { f "obj" } { f "slot" } } }
{ +clobber { "obj" "slot" } } { +clobber+ { "obj" "slot" } }
} define-intrinsic } define-intrinsic
: char-reg cell 8 = RBX EBX ? ; inline : char-reg cell 8 = RBX EBX ? ; inline
@ -101,9 +101,9 @@ IN: compiler
"obj" operand char-reg MOV "obj" operand char-reg MOV
char-reg POP char-reg POP
] H{ ] H{
{ +input { { f "n" } { f "obj" } } } { +input+ { { f "n" } { f "obj" } } }
{ +output { "obj" } } { +output+ { "obj" } }
{ +clobber { "n" } } { +clobber+ { "n" } }
} define-intrinsic } define-intrinsic
\ set-char-slot [ \ set-char-slot [
@ -115,15 +115,15 @@ IN: compiler
"obj" operand string-offset [+] char-reg-16 MOV "obj" operand string-offset [+] char-reg-16 MOV
char-reg POP char-reg POP
] H{ ] H{
{ +input { { f "val" } { f "slot" } { f "obj" } } } { +input+ { { f "val" } { f "slot" } { f "obj" } } }
{ +clobber { "val" "slot" "obj" } } { +clobber+ { "val" "slot" "obj" } }
} define-intrinsic } define-intrinsic
! Fixnums ! Fixnums
: define-fixnum-op ( word op -- ) : define-fixnum-op ( word op -- )
[ [ "x" operand "y" operand ] % , ] [ ] make H{ [ [ "x" operand "y" operand ] % , ] [ ] make H{
{ +input { { f "x" } { f "y" } } } { +input+ { { f "x" } { f "y" } } }
{ +output { "x" } } { +output+ { "x" } }
} define-intrinsic ; } define-intrinsic ;
{ {
@ -140,8 +140,8 @@ IN: compiler
"x" operand NOT "x" operand NOT
"x" operand tag-mask XOR "x" operand tag-mask XOR
] H{ ] H{
{ +input { { f "x" } } } { +input+ { { f "x" } } }
{ +output { "x" } } { +output+ { "x" } }
} define-intrinsic } define-intrinsic
! This has specific register requirements. Inputs are in ! This has specific register requirements. Inputs are in
@ -150,9 +150,9 @@ IN: compiler
prepare-division prepare-division
"y" operand IDIV "y" operand IDIV
] H{ ] H{
{ +input { { 0 "x" } { 1 "y" } } } { +input+ { { 0 "x" } { 1 "y" } } }
{ +scratch { { 2 "out" } } } { +scratch+ { { 2 "out" } } }
{ +output { "out" } } { +output+ { "out" } }
} define-intrinsic } define-intrinsic
: ?MOV ( dst src -- ) 2dup = [ 2drop ] [ MOV ] if ; : ?MOV ( dst src -- ) 2dup = [ 2drop ] [ MOV ] if ;
@ -179,10 +179,10 @@ IN: compiler
: simple-overflow-template ( word insn -- ) : simple-overflow-template ( word insn -- )
[ simple-overflow ] curry H{ [ simple-overflow ] curry H{
{ +input { { f "x" } { f "y" } } } { +input+ { { f "x" } { f "y" } } }
{ +scratch { { f "z" } } } { +scratch+ { { f "z" } } }
{ +output { "z" } } { +output+ { "z" } }
{ +clobber { "x" "y" } } { +clobber+ { "x" "y" } }
} define-intrinsic ; } define-intrinsic ;
\ fixnum+ \ ADD simple-overflow-template \ fixnum+ \ ADD simple-overflow-template
@ -204,8 +204,8 @@ IN: compiler
T{ int-regs } return-reg bignum-tag OR T{ int-regs } return-reg bignum-tag OR
"end" get resolve-label "end" get resolve-label
] H{ ] H{
{ +input { { 0 "x" } { 1 "y" } } } { +input+ { { 0 "x" } { 1 "y" } } }
{ +output { "x" } } { +output+ { "x" } }
} define-intrinsic } define-intrinsic
: generate-fixnum/mod : generate-fixnum/mod
@ -238,22 +238,22 @@ IN: compiler
"end" get resolve-label ; "end" get resolve-label ;
\ fixnum/i [ generate-fixnum/mod ] H{ \ fixnum/i [ generate-fixnum/mod ] H{
{ +input { { 0 "x" } { 1 "y" } } } { +input+ { { 0 "x" } { 1 "y" } } }
{ +scratch { { 2 "out" } } } { +scratch+ { { 2 "out" } } }
{ +output { "x" } } { +output+ { "x" } }
{ +clobber { "x" "y" } } { +clobber+ { "x" "y" } }
} define-intrinsic } define-intrinsic
\ fixnum/mod [ generate-fixnum/mod ] H{ \ fixnum/mod [ generate-fixnum/mod ] H{
{ +input { { 0 "x" } { 1 "y" } } } { +input+ { { 0 "x" } { 1 "y" } } }
{ +scratch { { 2 "out" } } } { +scratch+ { { 2 "out" } } }
{ +output { "x" "out" } } { +output+ { "x" "out" } }
{ +clobber { "x" "y" } } { +clobber+ { "x" "y" } }
} define-intrinsic } define-intrinsic
: define-fixnum-jump ( word op -- ) : define-fixnum-jump ( word op -- )
[ end-basic-block "x" operand "y" operand CMP ] swap add [ end-basic-block "x" operand "y" operand CMP ] swap add
H{ { +input { { f "x" } { f "y" } } } } define-if-intrinsic ; H{ { +input+ { { f "x" } { f "y" } } } } define-if-intrinsic ;
{ {
{ fixnum< JL } { fixnum< JL }
@ -275,15 +275,15 @@ IN: compiler
\ getenv [ \ getenv [
%userenv "n" operand dup [] MOV %userenv "n" operand dup [] MOV
] H{ ] H{
{ +input { { f "n" } } } { +input+ { { f "n" } } }
{ +scratch { { f "x" } } } { +scratch+ { { f "x" } } }
{ +output { "n" } } { +output+ { "n" } }
} define-intrinsic } define-intrinsic
\ setenv [ \ setenv [
%userenv "n" operand [] "val" operand MOV %userenv "n" operand [] "val" operand MOV
] H{ ] H{
{ +input { { f "val" } { f "n" } } } { +input+ { { f "val" } { f "n" } } }
{ +scratch { { f "x" } } } { +scratch+ { { f "x" } } }
{ +clobber { "n" } } { +clobber+ { "n" } }
} define-intrinsic } define-intrinsic