vm: remove DEFPUSHPOP macro

db4
Slava Pestov 2009-12-04 20:56:48 -05:00
parent 9f79cb0002
commit 9705768e3f
3 changed files with 22 additions and 23 deletions

View File

@ -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);
}

View File

@ -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"

View File

@ -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); \
}
}