jitcraft/Stack.h
changeset 69 dfce0539a77d
parent 68 b40b0e18a918
child 73 ef5492aa8d8b
     1.1 --- a/jitcraft/Stack.h	Tue Jul 10 02:11:13 2012 -0700
     1.2 +++ b/jitcraft/Stack.h	Wed Jul 11 01:12:54 2012 -0700
     1.3 @@ -32,6 +32,7 @@
     1.4  class Reference;
     1.5  class Frame;
     1.6  class Stack;
     1.7 +class Zone;
     1.8      
     1.9  union LocalSlot
    1.10  {
    1.11 @@ -99,6 +100,10 @@
    1.12      bool isNative() const {
    1.13          return callee_ && callee_->is(MapKind_Native);
    1.14      }
    1.15 +    Native *native() const {
    1.16 +        assert(isNative());
    1.17 +        return native_;
    1.18 +    }
    1.19      Code *code() const {
    1.20          assert(code_);
    1.21          return code_;
    1.22 @@ -175,7 +180,7 @@
    1.23      static const size_t STACK_SIZE = 1024 * 1024;
    1.24  
    1.25    public:
    1.26 -    Stack();
    1.27 +    Stack(Zone *zone);
    1.28      ~Stack();
    1.29  
    1.30      bool initialize();
    1.31 @@ -198,11 +203,27 @@
    1.32      void popNativeFrame(NativeArgs &args);
    1.33  
    1.34    private:
    1.35 +    Zone *zone_;
    1.36      char *buffer_;
    1.37      char *end_;
    1.38      Top top_;
    1.39  };
    1.40  
    1.41 +class StackIter
    1.42 +{
    1.43 +    bytecode *pc_;
    1.44 +    Frame *fp_;
    1.45 +
    1.46 +  public:
    1.47 +    StackIter(Zone *zone);
    1.48 +
    1.49 +    bool done() const;
    1.50 +    const char *function() const;
    1.51 +    unsigned lineNumber() const;
    1.52 +    const char *source() const;
    1.53 +    void prev();
    1.54 +};
    1.55 +
    1.56  }
    1.57  
    1.58  #endif // _include_jc_stack_h_