~ubuntu-branches/ubuntu/trusty/openjade1.3/trusty

« back to all changes in this revision

Viewing changes to style/VM.h

  • Committer: Bazaar Package Importer
  • Author(s): Yann Dirson
  • Date: 2002-04-09 00:01:50 UTC
  • Revision ID: james.westby@ubuntu.com-20020409000150-r9rkyalxlhvf9ba3
Tags: upstream-1.3.1
ImportĀ upstreamĀ versionĀ 1.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) 1996 James Clark
 
2
// See the file copying.txt for copying permission.
 
3
 
 
4
#ifndef VM_INCLUDED
 
5
#define VM_INCLUDED 1
 
6
 
 
7
#include "Collector.h"
 
8
#include "EvalContext.h"
 
9
#include "Location.h"
 
10
 
 
11
#ifdef DSSSL_NAMESPACE
 
12
namespace DSSSL_NAMESPACE {
 
13
#endif
 
14
 
 
15
class ELObj;
 
16
class ContinuationObj;
 
17
class Interpreter;
 
18
class Insn;
 
19
 
 
20
class VM : public EvalContext, private Collector::DynamicRoot  {
 
21
public:
 
22
  VM(Interpreter &);
 
23
  VM(EvalContext &, Interpreter &);
 
24
  virtual ~VM();
 
25
  ELObj **sp;
 
26
  Interpreter *interp;
 
27
  ELObj **closure;
 
28
  ELObj *protectClosure;
 
29
  ELObj **frame;
 
30
  int nActualArgs;
 
31
  Location closureLoc;
 
32
  ELObj *eval(const Insn *, ELObj **display = 0, ELObj *arg = 0);
 
33
  void initStack();
 
34
  void needStack(int);
 
35
  void pushFrame(const Insn *next, int argsPushed);
 
36
  const Insn *popFrame();
 
37
  void setClosureArgToCC();
 
38
  void trace(Collector &) const;
 
39
  Vector<const ProcessingMode *> modeStack;
 
40
private:
 
41
  void growStack(int);
 
42
  void init();
 
43
  void stackTrace();
 
44
 
 
45
  ELObj **slim;
 
46
  ELObj **sbase;
 
47
 
 
48
  struct ControlStackEntry {
 
49
    int frameSize;              // before pushing args
 
50
    ELObj **closure;
 
51
    ELObj *protectClosure;
 
52
    Location closureLoc;
 
53
    ContinuationObj *continuation;
 
54
    const Insn *next;
 
55
  };
 
56
 
 
57
  ControlStackEntry *csp;
 
58
  ControlStackEntry *csbase;
 
59
  ControlStackEntry *cslim;
 
60
  friend class ContinuationObj;
 
61
};
 
62
 
 
63
inline
 
64
void VM::needStack(int n)
 
65
{
 
66
  if (slim - sp < n)
 
67
    growStack(n);
 
68
}
 
69
 
 
70
#ifdef DSSSL_NAMESPACE
 
71
}
 
72
#endif
 
73
 
 
74
#endif /* not VM_INCLUDED */