Align PARK/UNPARK with THROW/CATCH.

This commit is contained in:
Brad Nelson
2023-01-14 22:53:30 -08:00
parent 2f79192ea0
commit 75d9185027
4 changed files with 23 additions and 13 deletions

View File

@ -285,9 +285,9 @@ static void forth_init(int argc, char *argv[],
g_sys->tib = src;
g_sys->ntib = src_len;
*++rp = (cell_t) start;
*++rp = (cell_t) fp;
*++rp = (cell_t) sp;
*++rp = (cell_t) start;
g_sys->rp = rp;
g_sys->runner = forth_run;
}

View File

@ -32,11 +32,11 @@ typedef uintptr_t ucell_t;
#define DUP (*++sp = tos)
#define PUSH DUP; tos = (cell_t)
#define PARK DUP; *++rp = (cell_t) fp; *++rp = (cell_t) sp; *++rp = (cell_t) ip
#define UNPARK ip = (cell_t *) *rp--; sp = (cell_t *) *rp--; fp = (float *) *rp--; DROP
#define THROWIT(n) rp = *g_sys->throw_handler; *g_sys->throw_handler = (cell_t *) *rp--; \
sp = (cell_t *) *rp--; fp = (float *) *rp--; ip = (cell_t *) *rp--; \
NIP; tos = (n);
#define PARK *++rp = (cell_t) ip; *++rp = (cell_t) fp; DUP; *++rp = (cell_t) sp;
#define UNPARK sp = (cell_t *) *rp--; DROP; fp = (float *) *rp--; ip = (cell_t *) *rp--;
#define THROWIT(n) \
rp = *g_sys->throw_handler; *g_sys->throw_handler = (cell_t *) *rp--; UNPARK; tos = (n);
#define TOFLAGS(xt) ((uint8_t *) (((cell_t *) (xt)) - 1))
#define TONAMELEN(xt) (TOFLAGS(xt) + 1)