version 1.145, 2003/10/09 20:25:59
|
version 1.146, 2003/10/16 18:48:03
|
Line 267 struct%
|
Line 267 struct%
|
cell% 2* field prim-name |
cell% 2* field prim-name |
cell% 2* field prim-wordset |
cell% 2* field prim-wordset |
cell% 2* field prim-c-name |
cell% 2* field prim-c-name |
|
cell% 2* field prim-c-name-orig \ for reprocessed prims, the original name |
cell% 2* field prim-doc |
cell% 2* field prim-doc |
cell% 2* field prim-c-code |
cell% 2* field prim-c-code |
cell% 2* field prim-forth-code |
cell% 2* field prim-forth-code |
Line 302 variable in-part \ true if processing a
|
Line 303 variable in-part \ true if processing a
|
r> to prim |
r> to prim |
throw ; |
throw ; |
|
|
|
: prim-c-name-2! ( c-addr u -- ) |
|
2dup prim prim-c-name 2! prim prim-c-name-orig 2! ; |
|
|
1000 constant max-combined |
1000 constant max-combined |
create combined-prims max-combined cells allot |
create combined-prims max-combined cells allot |
variable num-combined |
variable num-combined |
Line 1505 variable reprocessed-num 0 reprocessed-n
|
Line 1509 variable reprocessed-num 0 reprocessed-n
|
\ This is intended as initializer for a structure like this |
\ This is intended as initializer for a structure like this |
|
|
\ struct cost { |
\ struct cost { |
\ int loads; /* number of stack loads */ |
\ char loads; /* number of stack loads */ |
\ int stores; /* number of stack stores */ |
\ char stores; /* number of stack stores */ |
\ int updates; /* number of stack pointer updates */ |
\ char updates; /* number of stack pointer updates */ |
\ int offset; /* offset into super2 table */ |
\ char branch; /* is it a branch (SET_IP) */ |
\ int length; /* number of components */ |
\ char state_in; /* state on entry */ |
|
\ char state_out; /* state on exit */ |
|
\ short offset; /* offset into super2 table */ |
|
\ char length; /* number of components */ |
\ }; |
\ }; |
|
|
\ How do you know which primitive or combined instruction this |
\ How do you know which primitive or combined instruction this |
Line 1539 variable reprocessed-num 0 reprocessed-n
|
Line 1546 variable reprocessed-num 0 reprocessed-n
|
loop ; |
loop ; |
|
|
: output-num-part ( p -- ) |
: output-num-part ( p -- ) |
." N_" prim-c-name 2@ type ." ," ; |
." N_" prim-c-name-orig 2@ type ." ," ; |
\ prim-num @ 4 .r ." ," ; |
\ prim-num @ 4 .r ." ," ; |
|
|
: output-name-comment ( -- ) |
: output-name-comment ( -- ) |
Line 1577 variable offset-super2 0 offset-super2
|
Line 1584 variable offset-super2 0 offset-super2
|
output-name-comment |
output-name-comment |
cr ; |
cr ; |
|
|
: output-super2 ( -- ) |
: output-super2-simple ( -- ) |
\ table of superinstructions without requirement for existing prefixes |
prim prim-c-name 2@ prim prim-c-name-orig 2@ d= if |
combined if |
|
['] output-num-part map-combined |
|
else |
|
prim output-num-part |
prim output-num-part |
endif |
output-name-comment |
|
cr |
|
endif ; |
|
|
|
: output-super2-combined ( -- ) |
|
['] output-num-part map-combined |
output-name-comment |
output-name-comment |
cr ; |
cr ; |
|
|
Line 1744 Variable c-flag
|
Line 1753 Variable c-flag
|
(( {{ prim create-prim }} |
(( {{ prim create-prim }} |
` ( white ** {{ start }} stack-effect {{ end prim prim-stack-string 2! }} ` ) white ** |
` ( white ** {{ start }} stack-effect {{ end prim prim-stack-string 2! }} ` ) white ** |
(( {{ start }} forth-ident {{ end prim prim-wordset 2! }} white ** |
(( {{ start }} forth-ident {{ end prim prim-wordset 2! }} white ** |
(( {{ start }} c-ident {{ end prim prim-c-name 2! }} )) ?? |
(( {{ start }} c-ident {{ end 2dup prim-c-name-2! }} )) ?? |
)) ?? nleof |
)) ?? nleof |
(( ` " ` " {{ start }} (( noquote ++ ` " )) ++ {{ end 1- prim prim-doc 2! }} ` " white ** nleof )) ?? |
(( ` " ` " {{ start }} (( noquote ++ ` " )) ++ {{ end 1- prim prim-doc 2! }} ` " white ** nleof )) ?? |
{{ skipsynclines off line @ c-line ! filename 2@ c-filename 2! start }} |
{{ skipsynclines off line @ c-line ! filename 2@ c-filename 2! start }} |
Line 1766 Variable c-flag
|
Line 1775 Variable c-flag
|
line @ name-line ! filename 2@ name-filename 2! |
line @ name-line ! filename 2@ name-filename 2! |
function-number @ prim prim-num ! |
function-number @ prim prim-num ! |
start }} [ifdef] vmgen c-ident [else] forth-ident [then] {{ end |
start }} [ifdef] vmgen c-ident [else] forth-ident [then] {{ end |
2dup prim prim-name 2! prim prim-c-name 2! }} white ** |
2dup prim prim-name 2! prim-c-name-2! }} white ** |
(( ` / white ** {{ start }} c-ident {{ end prim prim-c-name 2! }} white ** )) ?? |
(( ` / white ** {{ start }} c-ident {{ end prim-c-name-2! }} white ** )) ?? |
(( simple-primitive || combined-primitive )) |
(( simple-primitive || combined-primitive )) |
{{ 1 function-number +! }} |
{{ 1 function-number +! }} |
)) <- primitive ( -- ) |
)) <- primitive ( -- ) |