-
Notifications
You must be signed in to change notification settings - Fork 23
/
STContext.h
62 lines (47 loc) · 1.71 KB
/
STContext.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/******************************************************************************
File: STContext.h
Description:
VM representation of Smalltalk Context class used for MethodContexts
and BlockClosures.
N.B. The classes here defined are well known to the VM, and must not
be modified in the image. Note also that these classes may also have
a representation in the assembler modules (so see istasm.inc)
******************************************************************************/
#pragma once
#include "ote.h"
#include "STObject.h"
#include "STBlockClosure.h"
// Turn off warning about zero length arrays
#pragma warning ( disable : 4200)
// Declare forward references
namespace ST { class Context; }
typedef TOTE<ST::Context> ContextOTE;
namespace ST
{
class Context : public Object
{
public:
// Outer environment, or SmallInteger frame pointer if a method env.
union
{
Oop m_frame;
OTE* m_outer;
};
BlockOTE* m_block;
Oop m_tempFrame[]; // Environment temps only - args always in Process stack
BOOL isBlockContext() const;
public:
// The environment pool must contain fixed size objects, so choose a suitable maximum number of
// temps permissible; very uncommonly exceed even 1 environment (shared) temporaries
// In fact quite often there are none since the Context is required just to support a ^-return
enum { MaxEnvironmentTemps = 1 };
enum { OuterIndex = ObjectFixedSize, BlockIndex, FixedSize };
enum { TempFrameStart = FixedSize };
static ContextOTE* __fastcall New(unsigned tempCount, Oop oopOuter);
};
///////////////////////////////////////////////////////////////////////////////
inline BOOL Context::isBlockContext() const
{
return !isIntegerObject(m_frame);
}
}