Commit 51ab7a77 authored by pazsan's avatar pazsan

Constants compile to literals

parent 68acc307
......@@ -19,7 +19,7 @@
\ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
s" address-unit-bits" environment? drop constant bits/au
6 constant dodoes-tag
7 constant dodoes-tag
: write-cell { w^ w file-id -- ior }
\ write a cell to the file
......
......@@ -89,8 +89,9 @@
#define DOUSER 3
#define DODEFER 4
#define DOFIELD 5
#define DODOES 6
#define DOESJUMP 7
#define DOVAL 6
#define DODOES 7
#define DOESJUMP 8
/* the size of the DOESJUMP, which resides between DOES> and the does-code */
#define DOES_HANDLER_SIZE (2*sizeof(Cell))
......
......@@ -414,6 +414,7 @@ void gforth_relocate(Cell *image, const Char *bitstring,
case CF(DOCOL) :
case CF(DOVAR) :
case CF(DOCON) :
case CF(DOVAL) :
case CF(DOUSER) :
case CF(DODEFER) :
case CF(DOFIELD) : MAKE_CF(image+i,symbols[CF(token)]); break;
......
......@@ -20,12 +20,12 @@
-2 Doer: :docol
-3 Doer: :docon
-3 Doer: :dovalue
-4 Doer: :dovar
-5 Doer: :douser
-6 Doer: :dodefer
-7 Doer: :dofield
-8 Doer: :dodoes
-9 Doer: :doesjump
-8 Doer: :dovalue
-9 Doer: :dodoes
-&10 Doer: :doesjump
-&2 first-primitive \ this does not work for (at least) (DODOES),
\ so these routines are commented out
......@@ -266,7 +266,8 @@ has? peephole [IF]
\ dup >body POSTPONE literal ['] call peephole-compile, >does-code , EXIT
then
dup >code-address CASE
docon: OF >body ['] lit@ peephole-compile, , EXIT ENDOF
dovalue: OF >body ['] lit@ peephole-compile, , EXIT ENDOF
docon: OF >body @ ['] lit peephole-compile, , EXIT ENDOF
\ docon: OF >body POSTPONE literal ['] @ peephole-compile, EXIT ENDOF
\ docon is also used by VALUEs, so don't @ at compile time
docol: OF >body ['] call peephole-compile, , EXIT ENDOF
......
......@@ -203,6 +203,14 @@ INST_TAIL;
goto *next_code;
#endif /* defined(NO_IP) */
(dovalue) ( -- w ) gforth-internal paren_doval
""run-time routine for constants""
w = *(Cell *)PFA(CFA);
#ifdef NO_IP
INST_TAIL;
goto *next_code;
#endif /* defined(NO_IP) */
(dodoes) ( -- a_body R:a_retaddr ) gforth-internal paren_dodoes
""run-time routine for @code{does>}-defined words""
#ifdef NO_IP
......
......@@ -758,6 +758,7 @@ Defer discode ( addr u -- ) \ gforth
dup >code-address
CASE
docon: of seecon endof
dovalue: of seevalue endof
docol: of seecol endof
dovar: of seevar endof
[ [IFDEF] douser: ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment