diff -r ce072f38628c -r fb3cd08bc7fb src/Stack.h --- a/src/Stack.h Sat Dec 22 16:42:20 2012 -0800 +++ b/src/Stack.h Sat Dec 22 18:22:14 2012 -0800 @@ -66,7 +66,14 @@ Object *callee_; }; Code *code_; + + // Position of the LIFO stack at function entry. Address lifoPosition_; + + // Loop nesting level, for LIFO stack balancing. LIFO stack balancing + // is not strictly required, but it helps to avoid unnecessary waste, + // since once the LIFO stack is depleted, we must use the heap instead. + unsigned loopDepth_; public: Frame(Frame *prev, bytecode *prevpc, Function *fun, Code *code, Address lifoPosition) @@ -74,7 +81,8 @@ prevpc_(prevpc), fun_(fun), code_(code), - lifoPosition_(lifoPosition) + lifoPosition_(lifoPosition), + loopDepth_(0) { } @@ -87,8 +95,11 @@ { } + Address *loopStack() { + return reinterpret_cast
(this + 1); + } LocalSlot *locals() { - return reinterpret_cast