jitcraft/Stack.h
changeset 47 050939c6181e
parent 26 a48382113da6
child 59 b7d61ddb3c8d
     1.1 --- a/jitcraft/Stack.h	Tue Jul 03 13:53:34 2012 -0400
     1.2 +++ b/jitcraft/Stack.h	Wed Jul 04 19:39:00 2012 -0400
     1.3 @@ -1,4 +1,5 @@
     1.4 -/*
     1.5 +/* vim: set ts=4 sw=4 tw=99 et:
     1.6 + *
     1.7   * Copyright (C) 2012 David Anderson
     1.8   *
     1.9   * This file is part of JITCraft.
    1.10 @@ -22,12 +23,14 @@
    1.11  #include "Utility.h"
    1.12  #include "Code.h"
    1.13  #include "Functions.h"
    1.14 +#include "VirtualObjectVisitor.h"
    1.15  
    1.16  namespace jc {
    1.17  
    1.18  class Object;
    1.19  class Array;
    1.20  class Reference;
    1.21 +class Frame;
    1.22      
    1.23  union LocalSlot
    1.24  {
    1.25 @@ -43,14 +46,15 @@
    1.26  {
    1.27      LocalSlot *sp;
    1.28      bytecode *pc;
    1.29 +    Frame *fp;
    1.30  
    1.31 -    Top(LocalSlot *sp, bytecode *pc)
    1.32 -      : sp(sp), pc(pc)
    1.33 +    Top(LocalSlot *sp, bytecode *pc, Frame *fp)
    1.34 +      : sp(sp), pc(pc), fp(NULL)
    1.35      {
    1.36      }
    1.37  
    1.38      Top(LocalSlot *sp)
    1.39 -      : sp(sp), pc(NULL)
    1.40 +      : sp(sp), pc(NULL), fp(NULL)
    1.41      {
    1.42      }
    1.43  };
    1.44 @@ -104,6 +108,7 @@
    1.45          assert(slot < fun()->nargs());
    1.46          return *(reinterpret_cast<LocalSlot *>(this) - slot - 1);
    1.47      }
    1.48 +    void accept(VirtualObjectVisitor *visitor);
    1.49  };
    1.50  
    1.51  class Stack
    1.52 @@ -122,8 +127,8 @@
    1.53      bool initialize();
    1.54  
    1.55    public:
    1.56 -    Frame *pushFrame(Frame *prev, Function *fun);
    1.57 -    Frame *popFrame(Frame *frame);
    1.58 +    Frame *pushFrame(Function *fun);
    1.59 +    Frame *popFrame();
    1.60  
    1.61      Top *top() {
    1.62          return top_;
    1.63 @@ -134,6 +139,7 @@
    1.64      Top begin() {
    1.65          return Top((LocalSlot *)buffer_);
    1.66      }
    1.67 +    void accept(VirtualObjectVisitor *visitor);
    1.68  };
    1.69  
    1.70  }