-
Notifications
You must be signed in to change notification settings - Fork 2
/
constants.go
61 lines (56 loc) · 1.61 KB
/
constants.go
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
package gytes
const MAGIC = 0xCAFEBABE
const MIN_VERSION = 45
const MAJ_VERSION = 58
/*
Source: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.4
-----------------------------------
Constant type |Value|
-----------------------------------
CONSTANT_Class | 7 |
CONSTANT_Fieldref | 9 |
CONSTANT_Methodref | 10 |
CONSTANT_InterfaceMethodref | 11 |
CONSTANT_String | 8 |
CONSTANT_Integer | 3 |
CONSTANT_Float | 4 |
CONSTANT_Long | 5 |
CONSTANT_Double | 6 |
CONSTANT_NameAndType | 12 |
CONSTANT_Utf8 | 1 |
CONSTANT_MethodHandle | 15 |
CONSTANT_MethodType | 16 |
CONSTANT_InvokeDynamic | 18 |
-----------------------------------
*/
const (
ConstClass = 7
ConstFieldref = 9
ConstMethodref = 10
ConstInterfaceMethodref = 11
ConstString = 8
ConstInteger = 3
ConstFloat = 4
ConstLong = 5
ConstDouble = 6
ConstNameAndType = 12
ConstUtf8 = 1
ConstMethodHandle = 15
ConstMethodType = 16
ConstInvokeDynamic = 18
)
var ConstSizeMap = map[int]int{
ConstClass: 3,
ConstFieldref: 5,
ConstMethodref: 5,
ConstInterfaceMethodref: 5,
ConstString: 3,
ConstInteger: 5,
ConstFloat: 5,
ConstLong: 9,
ConstDouble: 9,
ConstNameAndType: 5,
ConstMethodHandle: 4,
ConstMethodType: 3,
ConstInvokeDynamic: 5,
}