From 9705768e3f04c8798352a476140e1d91467d3a6a Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 4 Dec 2009 20:56:48 -0500 Subject: [PATCH] vm: remove DEFPUSHPOP macro --- vm/contexts.hpp | 25 ++++++++++++++++++++++--- vm/master.hpp | 1 - vm/stacks.hpp | 19 ------------------- 3 files changed, 22 insertions(+), 23 deletions(-) delete mode 100644 vm/stacks.hpp diff --git a/vm/contexts.hpp b/vm/contexts.hpp index ddbae5de78..5b9ac3b615 100644 --- a/vm/contexts.hpp +++ b/vm/contexts.hpp @@ -55,11 +55,30 @@ struct context { #define rs_bot (ctx->retainstack_region->start) #define rs_top (ctx->retainstack_region->end) -DEFPUSHPOP(d,ds) -DEFPUSHPOP(r,rs) +inline cell dpeek() +{ + return *(cell *)ds; +} + +inline void drepl(cell tagged) +{ + *(cell *)ds = tagged; +} + +inline cell dpop() +{ + cell value = dpeek(); + ds -= sizeof(cell); + return value; +} + +inline void dpush(cell tagged) +{ + ds += sizeof(cell); + drepl(tagged); +} VM_C_API void nest_stacks(stack_frame *magic_frame, factor_vm *vm); VM_C_API void unnest_stacks(factor_vm *vm); } - diff --git a/vm/master.hpp b/vm/master.hpp index 3059ea8b42..80c2f1050d 100755 --- a/vm/master.hpp +++ b/vm/master.hpp @@ -40,7 +40,6 @@ namespace factor #include "layouts.hpp" #include "platform.hpp" #include "primitives.hpp" -#include "stacks.hpp" #include "segments.hpp" #include "contexts.hpp" #include "run.hpp" diff --git a/vm/stacks.hpp b/vm/stacks.hpp deleted file mode 100644 index 4906d107bc..0000000000 --- a/vm/stacks.hpp +++ /dev/null @@ -1,19 +0,0 @@ -namespace factor -{ - -#define DEFPUSHPOP(prefix,ptr) \ - inline cell prefix##peek() { return *(cell *)ptr; } \ - inline void prefix##repl(cell tagged) { *(cell *)ptr = tagged; } \ - inline cell prefix##pop() \ - { \ - cell value = prefix##peek(); \ - ptr -= sizeof(cell); \ - return value; \ - } \ - inline void prefix##push(cell tagged) \ - { \ - ptr += sizeof(cell); \ - prefix##repl(tagged); \ - } - -}