Commit 61f4cf29 authored by Anton Ertl's avatar Anton Ertl

reworked ALIVE_DEBUGGING

parent c1d7767a
......@@ -131,16 +131,18 @@ extern Char *gforth_memset(Char * s, Cell c, UCell n);
#define SAVE_DIVISOR(x) ((void)0)
#endif
/* ALIVE_DEBUGGING(x) makes x appear to be used (in the debugging engine);
we use this in words like DROP to avoid the dead-code elimination
of the load of the bottom stack item, in order to get precise stack
underflow errors */
/* ALIVE_DEBUGGING(x) makes x appear to be used (in the debugging
engine); we use this in words like DROP to avoid the dead-code
elimination of the load of the bottom stack item, in order to get
precise stack underflow errors; if x is a memory reference (e.g,
"*lp"), this will not have an effect, so you have to replace the
memory reference with something that does something with the
resulting value (e.g., casting it to a Cell if it is not
already) */
#ifdef GFORTH_DEBUGGING
#define ALIVE_DEBUGGING(x) { Cell xx=(x); asm volatile(""::"X"(xx):"memory"); } while(0)
#define ALIVE_DEBUGGINGF(x) { Float xx=(x); asm volatile(""::"X"(xx):"memory"); } while(0)
#define ALIVE_DEBUGGING(x) do { asm volatile(""::"X"(x):"memory"); } while(0)
#else
#define ALIVE_DEBUGGING(x) ((void)0)
#define ALIVE_DEBUGGINGF(x) ((void)0)
#endif
/* conversion on fetch */
......
......@@ -289,7 +289,7 @@ VM_JUMP(EXEC1(EXTRA_CODEXT(a_cfa)));
branch-lp+!# ( #a_target #nlocals -- ) gforth branch_lp_plus_store_number
/* this will probably not be used */
lp += nlocals;
ALIVE_DEBUGGING(*lp);
ALIVE_DEBUGGING((Cell)*lp);
SET_IP((Xt *)a_target);
\+
......@@ -313,7 +313,7 @@ $6
$1-lp+!`#' ( $7 `#'a_target `#'nlocals $2 ) $3_lp_plus_store_number
$4 $5 lp += nlocals;
ALIVE_DEBUGGING(*lp);
ALIVE_DEBUGGING((Cell)*lp);
SET_IP((Xt *)a_target);
ifelse(condbranch_opt,`1',`INST_TAIL; NEXT_P2;',`/* condbranch_opt=0 */')
}
......@@ -2510,7 +2510,7 @@ fnegate ( r1 -- r2 ) float f_negate
r2 = - r1;
fdrop ( r -- ) float f_drop
ALIVE_DEBUGGINGF(r);
ALIVE_DEBUGGING(r);
fdup ( r -- r r ) float f_dupe
......@@ -2866,18 +2866,18 @@ lp+!# ( #noffset -- ) gforth lp_plus_store_number
local stack, a positive immediate argument drops memory from the local
stack""
lp += noffset;
ALIVE_DEBUGGING(*lp);
ALIVE_DEBUGGING((Cell)*lp);
lp- ( -- ) new lp_minus
lp += -sizeof(Cell);
lp+ ( -- ) new lp_plus
lp += sizeof(Float);
ALIVE_DEBUGGING(*lp);
ALIVE_DEBUGGING((Cell)*lp);
lp+2 ( -- ) new lp_plus_two
lp += 2*sizeof(Float);
ALIVE_DEBUGGING(*lp);
ALIVE_DEBUGGING((Cell)*lp);
lp! ( c_addr -- ) gforth lp_store
lp = (Address)c_addr;
......
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