Check-in [503fab114a]

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

Overview
Comment:Add a NotedString which is used for the debug entry, it represents a string to be used without needing to make a string object for it.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:503fab114a298d91daa98b049bf9155b5ab5f4b8
User & Date: stephanie.gawroriski 2019-09-11 15:00:58
Context
2019-09-11
15:02
Decode of class pool reference. check-in: a42203c959 user: stephanie.gawroriski tags: trunk
15:00
Add a NotedString which is used for the debug entry, it represents a string to be used without needing to make a string object for it. check-in: 503fab114a user: stephanie.gawroriski tags: trunk
14:55
Handling of class info pointer and invoked methods. check-in: 2c510e56f3 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

13
14
15
16
17
18
19

20
21
22
23
24
25
26
...
171
172
173
174
175
176
177

178
179
180
181
182
183
184
...
257
258
259
260
261
262
263







264
265
266
267
268
269
270
...
536
537
538
539
540
541
542

543
544
545
546
547
548
549
import dev.shadowtail.classfile.pool.BasicPoolBuilder;
import dev.shadowtail.classfile.pool.BasicPoolEntry;
import dev.shadowtail.classfile.pool.ClassInfoPointer;
import dev.shadowtail.classfile.pool.DualClassRuntimePool;
import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;
import dev.shadowtail.classfile.pool.InvokeType;
import dev.shadowtail.classfile.pool.InvokedMethod;

import dev.shadowtail.classfile.pool.UsedString;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
................................................................................
					case INTEGER:
					case FLOAT:
					case LONG:
					case DOUBLE:
					case INVOKED_METHOD:
					case METHOD_DESCRIPTOR:
					case METHOD_INDEX:

					case USED_STRING:
						// Read parts
						if (iswide)
							for (int p = 0; p < numparts; p++)
								parts[p] = xd.readUnsignedShort();
						else
							for (int p = 0; p < numparts; p++)
................................................................................
									classpool.<ClassName>byIndex(
										ClassName.class, parts[1]),
									classpool.<String>byIndex(String.class,
										parts[2]),
									classpool.<MethodDescriptor>byIndex(
										MethodDescriptor.class, parts[3]));
								break;







								
								// Used string
							case USED_STRING:
								value = new UsedString(
									classpool.byIndex(parts[0]).
									<String>value(String.class));
								break;
................................................................................
			case INTEGER:
			case FLOAT:
			case DOUBLE:
			case LONG:
			case INVOKED_METHOD:
			case METHOD_DESCRIPTOR:
			case METHOD_INDEX:

			case USED_STRING:
				if (__wide)
					for (int i = 0, n = __p.length; i < n; i++)
						dos.writeShortChecked(__p[i]);
				else
					for (int i = 0, n = __p.length; i < n; i++)
						dos.writeByte(__p[i]);







>







 







>







 







>
>
>
>
>
>
>







 







>







13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
...
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
...
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
...
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
import dev.shadowtail.classfile.pool.BasicPoolBuilder;
import dev.shadowtail.classfile.pool.BasicPoolEntry;
import dev.shadowtail.classfile.pool.ClassInfoPointer;
import dev.shadowtail.classfile.pool.DualClassRuntimePool;
import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;
import dev.shadowtail.classfile.pool.InvokeType;
import dev.shadowtail.classfile.pool.InvokedMethod;
import dev.shadowtail.classfile.pool.NotedString;
import dev.shadowtail.classfile.pool.UsedString;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
................................................................................
					case INTEGER:
					case FLOAT:
					case LONG:
					case DOUBLE:
					case INVOKED_METHOD:
					case METHOD_DESCRIPTOR:
					case METHOD_INDEX:
					case NOTED_STRING:
					case USED_STRING:
						// Read parts
						if (iswide)
							for (int p = 0; p < numparts; p++)
								parts[p] = xd.readUnsignedShort();
						else
							for (int p = 0; p < numparts; p++)
................................................................................
									classpool.<ClassName>byIndex(
										ClassName.class, parts[1]),
									classpool.<String>byIndex(String.class,
										parts[2]),
									classpool.<MethodDescriptor>byIndex(
										MethodDescriptor.class, parts[3]));
								break;
								
								// Noted string
							case NOTED_STRING:
								value = new NotedString(
									classpool.byIndex(parts[0]).
									<String>value(String.class));
								break;
								
								// Used string
							case USED_STRING:
								value = new UsedString(
									classpool.byIndex(parts[0]).
									<String>value(String.class));
								break;
................................................................................
			case INTEGER:
			case FLOAT:
			case DOUBLE:
			case LONG:
			case INVOKED_METHOD:
			case METHOD_DESCRIPTOR:
			case METHOD_INDEX:
			case NOTED_STRING:
			case USED_STRING:
				if (__wide)
					for (int i = 0, n = __p.length; i < n; i++)
						dos.writeShortChecked(__p[i]);
				else
					for (int i = 0, n = __p.length; i < n; i++)
						dos.writeByte(__p[i]);

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

57
58
59
60
61
62
63



64
65
66
67
68
69
70
..
77
78
79
80
81
82
83

84
85
86
87
88
89
90
...
136
137
138
139
140
141
142

143
144
145
146
147
148
149
...
190
191
192
193
194
195
196


197
198
199
200
201
202
203
204
	
	/** The index of a method. */
	METHOD_INDEX,
	
	/** Class information. */
	CLASS_INFO_POINTER,
	



	/** End. */
	;
	
	/**
	 * Can this be in the runtime pool?
	 *
	 * @return If this can be in the runtime pool.
................................................................................
			case NULL:
			case CLASS_INFO_POINTER:
			case CLASS_POOL:
			case ACCESSED_FIELD:
			case INVOKED_METHOD:
			case USED_STRING:
			case METHOD_INDEX:

				return true;
		}
		
		return false;
	}
	
	/**
................................................................................
			case 8:		return INTEGER;
			case 9:		return FLOAT;
			case 10:	return LONG;
			case 11:	return DOUBLE;
			case 12:	return USED_STRING;
			case 13:	return METHOD_INDEX;
			case 14:	return CLASS_INFO_POINTER;

		}
		
		// {@squirreljme.error JC0e Unknown pool type. (The type)}
		throw new IllegalArgumentException("JC0e " + __i);
	}
	
	/**
................................................................................
				return METHOD_DESCRIPTOR;
			case "dev.shadowtail.classfile.pool.UsedString":
				return USED_STRING;
			case "dev.shadowtail.classfile.pool.MethodIndex":
				return METHOD_INDEX;
			case "dev.shadowtail.classfile.pool.ClassInfoPointer":
				return CLASS_INFO_POINTER;


		}
		
		// {@squirreljme.error JC0f Class does not map to a pool entry
		// type. (The class)}
		throw new IllegalArgumentException("JC0f " + __cl);
	}
}








>
>
>







 







>







 







>







 







>
>








57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
..
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
...
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
...
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
	
	/** The index of a method. */
	METHOD_INDEX,
	
	/** Class information. */
	CLASS_INFO_POINTER,
	
	/** A string which has been noted for debug purposes. */
	NOTED_STRING,
	
	/** End. */
	;
	
	/**
	 * Can this be in the runtime pool?
	 *
	 * @return If this can be in the runtime pool.
................................................................................
			case NULL:
			case CLASS_INFO_POINTER:
			case CLASS_POOL:
			case ACCESSED_FIELD:
			case INVOKED_METHOD:
			case USED_STRING:
			case METHOD_INDEX:
			case NOTED_STRING:
				return true;
		}
		
		return false;
	}
	
	/**
................................................................................
			case 8:		return INTEGER;
			case 9:		return FLOAT;
			case 10:	return LONG;
			case 11:	return DOUBLE;
			case 12:	return USED_STRING;
			case 13:	return METHOD_INDEX;
			case 14:	return CLASS_INFO_POINTER;
			case 15:	return NOTED_STRING;
		}
		
		// {@squirreljme.error JC0e Unknown pool type. (The type)}
		throw new IllegalArgumentException("JC0e " + __i);
	}
	
	/**
................................................................................
				return METHOD_DESCRIPTOR;
			case "dev.shadowtail.classfile.pool.UsedString":
				return USED_STRING;
			case "dev.shadowtail.classfile.pool.MethodIndex":
				return METHOD_INDEX;
			case "dev.shadowtail.classfile.pool.ClassInfoPointer":
				return CLASS_INFO_POINTER;
			case "dev.shadowtail.classfile.pool.NotedString":
				return NOTED_STRING;
		}
		
		// {@squirreljme.error JC0f Class does not map to a pool entry
		// type. (The class)}
		throw new IllegalArgumentException("JC0f " + __cl);
	}
}

Changes to runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/NearNativeByteCodeHandler.java.

15
16
17
18
19
20
21

22
23
24
25
26
27
28
....
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
import dev.shadowtail.classfile.pool.ClassInfoPointer;
import dev.shadowtail.classfile.pool.ClassPool;
import dev.shadowtail.classfile.pool.FieldAccessTime;
import dev.shadowtail.classfile.pool.FieldAccessType;
import dev.shadowtail.classfile.pool.InvokedMethod;
import dev.shadowtail.classfile.pool.InvokeType;
import dev.shadowtail.classfile.pool.MethodIndex;

import dev.shadowtail.classfile.pool.UsedString;
import dev.shadowtail.classfile.xlate.ByteCodeHandler;
import dev.shadowtail.classfile.xlate.ByteCodeState;
import dev.shadowtail.classfile.xlate.CompareType;
import dev.shadowtail.classfile.xlate.DataType;
import dev.shadowtail.classfile.xlate.ExceptionClassEnqueueAndTable;
import dev.shadowtail.classfile.xlate.ExceptionHandlerRanges;
................................................................................
		this.volatiles.clear();
		
		// Entry point debugging
		if (addr == 0)
		{
			// Debug entry point
			codebuilder.add(NativeInstructionType.DEBUG_ENTRY,
				new UsedString(state.classname.toString()),
				new UsedString(state.methodname.toString()),
				new UsedString(state.methodtype.toString()));
			
			// Setup monitor entry
			if (this.issynchronized)
			{
				// Copy instance to monitor target
				if (this.isinstance)
					codebuilder.addCopy(state.stack.getLocal(0).register,







>







 







|
|
|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
....
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
import dev.shadowtail.classfile.pool.ClassInfoPointer;
import dev.shadowtail.classfile.pool.ClassPool;
import dev.shadowtail.classfile.pool.FieldAccessTime;
import dev.shadowtail.classfile.pool.FieldAccessType;
import dev.shadowtail.classfile.pool.InvokedMethod;
import dev.shadowtail.classfile.pool.InvokeType;
import dev.shadowtail.classfile.pool.MethodIndex;
import dev.shadowtail.classfile.pool.NotedString;
import dev.shadowtail.classfile.pool.UsedString;
import dev.shadowtail.classfile.xlate.ByteCodeHandler;
import dev.shadowtail.classfile.xlate.ByteCodeState;
import dev.shadowtail.classfile.xlate.CompareType;
import dev.shadowtail.classfile.xlate.DataType;
import dev.shadowtail.classfile.xlate.ExceptionClassEnqueueAndTable;
import dev.shadowtail.classfile.xlate.ExceptionHandlerRanges;
................................................................................
		this.volatiles.clear();
		
		// Entry point debugging
		if (addr == 0)
		{
			// Debug entry point
			codebuilder.add(NativeInstructionType.DEBUG_ENTRY,
				new NotedString(state.classname.toString()),
				new NotedString(state.methodname.toString()),
				new NotedString(state.methodtype.toString()));
			
			// Setup monitor entry
			if (this.issynchronized)
			{
				// Copy instance to monitor target
				if (this.isinstance)
					codebuilder.addCopy(state.stack.getLocal(0).register,

Changes to runt/libs/tool-classfile/dev/shadowtail/classfile/pool/DualClassRuntimePoolBuilder.java.

118
119
120
121
122
123
124





125
126
127
128
129
130
131
			case METHOD_INDEX:
				MethodIndex v = (MethodIndex)__v;
				return runpool.add(__v,
					0x7FFF,
					this.addStatic(v.inclass).index,
					this.addStatic(v.name.toString()).index,
					this.addStatic(v.type).index);





				
				// A string that is used
			case USED_STRING:
				return runpool.add(__v,
					this.addStatic(__v.toString()).index);
			
				// Unknown







>
>
>
>
>







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
			case METHOD_INDEX:
				MethodIndex v = (MethodIndex)__v;
				return runpool.add(__v,
					0x7FFF,
					this.addStatic(v.inclass).index,
					this.addStatic(v.name.toString()).index,
					this.addStatic(v.type).index);
				
				// A string that is noted for its value (debugging)
			case NOTED_STRING:
				return runpool.add(__v,
					this.addStatic(__v.toString()).index);
				
				// A string that is used
			case USED_STRING:
				return runpool.add(__v,
					this.addStatic(__v.toString()).index);
			
				// Unknown

Added runt/libs/tool-classfile/dev/shadowtail/classfile/pool/NotedString.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
// -*- 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 dev.shadowtail.classfile.pool;

/**
 * Noted string is similar to used string however it means it is just used
 * by its pointer data and not an actual string object which is initialized
 * for it. The noted string is generally used for debug purposes.
 *
 * @since 2019/09/11
 */
public final class NotedString
{
	/** The noted string. */
	public final String string;
	
	/**
	 * Initializes the noted string.
	 *
	 * @param __s The string to use.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/09/11
	 */
	public NotedString(String __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		this.string = __s;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/09/11
	 */
	@Override
	public final boolean equals(Object __o)
	{
		if (this == __o)
			return true;
		
		if (!(__o instanceof NotedString))
			return false;
		
		if (this.hashCode() != __o.hashCode())
			return false;
		
		return this.string.equals(((NotedString)__o).string);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/09/11
	 */
	@Override
	public final int hashCode()
	{
		return this.string.hashCode();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/09/11
	 */
	@Override
	public final String toString()
	{
		return this.string;
	}
}