Check-in [6433e05e8a]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add constants for class file header.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 6433e05e8a1132de94bb0dd4aa3537186e03065a
User & Date: stephanie.gawroriski 2019-10-12 17:02:40
Context
2019-10-12
17:07
Add data type ordinals. check-in: 62e84e7f73 user: stephanie.gawroriski tags: trunk
17:02
Add constants for class file header. check-in: 6433e05e8a user: stephanie.gawroriski tags: trunk
16:33
Add base classes for the constant pools. check-in: 6bc6217b70 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added runt/klib/supervisor/cc/squirreljme/jvm/lib/ClassFileConstants.java.

















































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.lib;

/**
 * This interface defines all of the class file constants which is used to
 * remove the usages of magic numbers.
 *
 * @since 2019/10/12
 */
public interface ClassFileConstants
{
	/** The magic number for the header. */
	public static final int MAGIC_NUMBER =
		0x00586572;
	
	/** Magic number for the end of file. */
	public static final int END_MAGIC_NUMBER =
		0x42796521;
	
	/** The size of the header without the magic number. */
	public static final byte HEADER_SIZE_WITHOUT_MAGIC =
		108;
	
	/** The size of the header with the magic number. */
	public static final byte HEADER_SIZE_WITH_MAGIC =
		112;
		
	/** Unused A. */
	public static final byte OFFSET_OF_USHORT_UNUSEDA =
		4;
	
	/** The index of the method which is __start. */
	public static final byte OFFSET_OF_UBYTE_STARTMETHODINDEX =
		6;
	
	/** The data type of the class. */
	public static final byte OFFSET_OF_UBYTE_DATATYPE =
		7;
	
	/** Not used. */
	public static final byte OFFSET_OF_USHORT_UNUSEDB =
		8;
	
	/** Class flags. */
	public static final byte OFFSET_OF_INT_CLASSFLAGS =
		10;
	
	/** Name of class. */
	public static final byte OFFSET_OF_USHORT_CLASSNAME =
		14;
	
	/** Super class name. */
	public static final byte OFFSET_OF_USHORT_CLASSSUPER =
		16;
	
	/** Interfaces in class. */
	public static final byte OFFSET_OF_USHORT_CLASSINTS =
		18;
	
	/** Class type. */
	public static final byte OFFSET_OF_UBYTE_CLASSTYPE =
		20;
	
	/** Class version. */
	public static final byte OFFSET_OF_UBYTE_CLASSVERS =
		21;
	
	/** Class source filename. */
	public static final byte OFFSET_OF_USHORT_CLASSSFN =
		22;
	
	/** Static field count. */
	public static final byte OFFSET_OF_USHORT_SFCOUNT =
		24;
	
	/** Static field bytes. */
	public static final byte OFFSET_OF_USHORT_SFBYTES =
		26;
	
	/** Static field objects. */
	public static final byte OFFSET_OF_USHORT_SFOBJS =
		28;
	
	/** Instance field count. */
	public static final byte OFFSET_OF_USHORT_IFCOUNT =
		30;
	
	/** Instance field bytes. */
	public static final byte OFFSET_OF_USHORT_IFBYTES =
		32;
	
	/** Instance field objects. */
	public static final byte OFFSET_OF_USHORT_IFOBJS =
		34;
	
	/** Static method count. */
	public static final byte OFFSET_OF_USHORT_SMCOUNT =
		36;
	
	/** Instance method count. */
	public static final byte OFFSET_OF_USHORT_IMCOUNT =
		38;
	
	/** Not used. */
	public static final byte OFFSET_OF_INT_UNUSEDC =
		40;
	
	/** Not used. */
	public static final byte OFFSET_OF_INT_UNUSEDD =
		44;
	
	/** Static field data offset. */
	public static final byte OFFSET_OF_INT_SFOFF =
		48;
	
	/** Static field data size. */
	public static final byte OFFSET_OF_INT_SFSIZE =
		52;
	
	/** Interface field data offset. */
	public static final byte OFFSET_OF_INT_IFOFF =
		56;
	
	/** Interface field data size. */
	public static final byte OFFSET_OF_INT_IFSIZE =
		60;
	
	/** Static method data offset. */
	public static final byte OFFSET_OF_INT_SMOFF =
		64;
	
	/** Static method data size. */
	public static final byte OFFSET_OF_INT_SMSIZE =
		68;
	
	/** Instance method data offset. */
	public static final byte OFFSET_OF_INT_IMOFF =
		72;
	
	/** Instance method data size. */
	public static final byte OFFSET_OF_INT_IMSIZE =
		76;
	
	/** High bits for UUID. */
	public static final byte OFFSET_OF_INT_UUIDHI =
		80;
	
	/** Low bits for UUID. */
	public static final byte OFFSET_OF_INT_UUIDLO =
		84;
	
	/** File size. */
	public static final byte OFFSET_OF_INT_FILESIZE =
		88;
	
	/** Not used. */
	public static final byte OFFSET_OF_INT_UNUSEDE =
		92;
	
	/** Static constant pool offset. */
	public static final byte OFFSET_OF_INT_STATICPOOLOFF =
		96;
	
	/** Static constant pool size. */
	public static final byte OFFSET_OF_INT_STATICPOOLSIZE =
		100;
	
	/** Runtime constant pool offset. */
	public static final byte OFFSET_OF_INT_RUNTIMEPOOLOFF =
		104;
	
	/** Runtime constant pool size. */
	public static final byte OFFSET_OF_INT_RUNTIMEPOOLSIZE =
		108;
}

Changes to runt/libs/tool-classfile/dev/shadowtail/classfile/mini/MinimizedClassHeader.java.

267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
			/* NOT USED */ dis.readUnsignedShort(),
			
			// Class header
			/* classflags */ dis.readInt(),
			/* classname */ dis.readUnsignedShort(),
			/* classsuper */ dis.readUnsignedShort(),
			/* classints */ dis.readUnsignedShort(),
			/* classtype */ dis.readByte(),
			/* classvers */ dis.readByte(),
			/* classsfn */ dis.readUnsignedShort(),
	
			// Static and instance fields
			/* sfcount */ dis.readUnsignedShort(),
			/* sfbytes */ dis.readUnsignedShort(),
			/* sfobjs */ dis.readUnsignedShort(),
			/* ifcount */ dis.readUnsignedShort(),







|
|







267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
			/* NOT USED */ dis.readUnsignedShort(),
			
			// Class header
			/* classflags */ dis.readInt(),
			/* classname */ dis.readUnsignedShort(),
			/* classsuper */ dis.readUnsignedShort(),
			/* classints */ dis.readUnsignedShort(),
			/* classtype */ dis.readUnsignedByte(),
			/* classvers */ dis.readUnsignedByte(),
			/* classsfn */ dis.readUnsignedShort(),
	
			// Static and instance fields
			/* sfcount */ dis.readUnsignedShort(),
			/* sfbytes */ dis.readUnsignedShort(),
			/* sfobjs */ dis.readUnsignedShort(),
			/* ifcount */ dis.readUnsignedShort(),