-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathw3StackValue.h
48 lines (41 loc) · 1.2 KB
/
w3StackValue.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
// A WebAssembly codebase by Jay Krell
//
// https://webassembly.github.io/spec/core/binary/index.html
// https://webassembly.github.io/spec/core/_download/WebAssembly.pdf
#pragma once
#include "w3Frame.h"
#include "w3Label.h"
#include "w3Tag.h"
#include "w3TaggedValue.h"
struct w3StackValue
{
// TODO remove two level tagging
w3Tag tag;
//union {
TaggedValue value; // TODO: change to Value or otherwise remove redundant tag
w3Frame* frame; // TODO by value? Probably not. This was changed
// to resolve circular types, and for the initial frame that seemed
// wrong, but now that call/ret being implemented, seems right
//w3DecodedInstruction* instr;
w3Label label;
//};
w3StackValue() : tag (Tag_none), frame (0)
{
}
w3StackValue (w3Tag t) : tag (t), frame (0)
{
if ((t & 0x78) == 0x78)
{
tag = Tag_Value;
value.tag = t; //todo: remove?
}
}
w3StackValue (TaggedValue t) : tag (Tag_Value), frame (0)
{
value = t;
}
w3StackValue (w3Frame* f) : tag (Tag_Frame), frame (0)
{
// frame = f;
}
};