Check-in [340a286a61]

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

Overview
Comment:Internally represent parts as shorts in the pool entries.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 340a286a61861fb8e9ee236ac7ffa6022d1cb749
User & Date: stephanie.gawroriski 2019-09-11 14:15:55
Context
2019-09-11
14:17
Decode method descriptors. check-in: 0f5627ea25 user: stephanie.gawroriski tags: trunk
14:15
Internally represent parts as shorts in the pool entries. check-in: 340a286a61 user: stephanie.gawroriski tags: trunk
14:10
Make int/float consist of parts, it is simpler to handler and matches long/double. check-in: a6b7e6ef96 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.

320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
...
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
...
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
				// state. (The pool type; The value type; Is the run-time
				// pool being processed?)}
				if (isruntime != et.isRuntime())
					throw new IllegalStateException("JC4d " +
						et + " " + ev + " " + isruntime);
				
				// Determine if the parts need to be wide
				int[] ep = e.parts();
				int epn = ep.length;
				boolean iswide = false;
				for (int j = 0; j < epn; j++)
				{
					int v = ep[j];
					if (v < 0 || v > 127)
						iswide = true;
................................................................................
	 * @param __v The value.
	 * @return The encoded value data.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/07/20
	 */
	public static final byte[] encodeValue(MinimizedPoolEntryType __t,
		int[] __p, boolean __wide, Object __v)
		throws IOException, NullPointerException
	{
		if (__t == null || __p == null || __v == null)
			throw new NullPointerException("NARG");
		
		// Output for this data
		TableSectionOutputStream output = new TableSectionOutputStream();
................................................................................
			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.writeUnsignedShortChecked(__p[i]);
				else
					for (int i = 0, n = __p.length; i < n; i++)
						dos.writeByte(__p[i]);
				break;
			
			default:
				throw new todo.OOPS(__t.name());
		}
		
		return output.toByteArray();
	}
}








|







 







|







 







|













320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
...
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
...
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
				// state. (The pool type; The value type; Is the run-time
				// pool being processed?)}
				if (isruntime != et.isRuntime())
					throw new IllegalStateException("JC4d " +
						et + " " + ev + " " + isruntime);
				
				// Determine if the parts need to be wide
				short[] ep = e.parts();
				int epn = ep.length;
				boolean iswide = false;
				for (int j = 0; j < epn; j++)
				{
					int v = ep[j];
					if (v < 0 || v > 127)
						iswide = true;
................................................................................
	 * @param __v The value.
	 * @return The encoded value data.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/07/20
	 */
	public static final byte[] encodeValue(MinimizedPoolEntryType __t,
		short[] __p, boolean __wide, Object __v)
		throws IOException, NullPointerException
	{
		if (__t == null || __p == null || __v == null)
			throw new NullPointerException("NARG");
		
		// Output for this data
		TableSectionOutputStream output = new TableSectionOutputStream();
................................................................................
			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]);
				break;
			
			default:
				throw new todo.OOPS(__t.name());
		}
		
		return output.toByteArray();
	}
}

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

36
37
38
39
40
41
42














43
44
45
46
	 */
	public BasicPool(Iterable<BasicPoolEntry> __it)
		throws NullPointerException
	{
		if (__it == null)
			throw new NullPointerException("NARG");
		














		throw new todo.TODO();
	}
}








>
>
>
>
>
>
>
>
>
>
>
>
>
>




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
	 */
	public BasicPool(Iterable<BasicPoolEntry> __it)
		throws NullPointerException
	{
		if (__it == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
	
	/**
	 * Gets the pool entry by index.
	 *
	 * @param __i The index to get.
	 * @return The index of the given entry.
	 * @throws IndexOutOfBoundsException If the entry is not within bounds.
	 * @since 2019/09/11
	 */
	public final BasicPoolEntry byIndex(int __i)
		throws IndexOutOfBoundsException
	{
		throw new todo.TODO();
	}
}

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

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
..
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
	/** The index of this entry. */
	public final int index;
	
	/** The value. */
	public final Object value;
	
	/** The parts. */
	private final int[] _parts;















	
	/**
	 * Initializes a new entry.
	 *
	 * @param __dx The entry index.
	 * @param __v The value.
	 * @param __parts The parts.
	 * @since 2019/07/15
	 */
	public BasicPoolEntry(int __dx, Object __v, int... __parts)
	{
		this.index = __dx;
		this.value = __v;


		this._parts = (__parts == null ? new int[0] : __parts.clone());




	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/08/25
	 */
	@Override
................................................................................
	
	/**
	 * Returns the parts used.
	 *
	 * @return The used parts.
	 * @since 2019/07/15
	 */
	public final int[] parts()
	{
		return this._parts.clone();
	}
	
	/**
	 * Returns the value of this entry.
	 *







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>













>
>
|
>
>
>
>







 







|







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
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
	/** The index of this entry. */
	public final int index;
	
	/** The value. */
	public final Object value;
	
	/** The parts. */
	private final short[] _parts;
	
	/**
	 * Initializes a new entry.
	 *
	 * @param __dx The entry index.
	 * @param __v The value.
	 * @param __parts The parts.
	 * @since 2019/09/11
	 */
	public BasicPoolEntry(int __dx, Object __v, short... __parts)
	{
		this.index = __dx;
		this.value = __v;
		this._parts = (__parts == null ? new short[0] : __parts.clone());
	}
	
	/**
	 * Initializes a new entry.
	 *
	 * @param __dx The entry index.
	 * @param __v The value.
	 * @param __parts The parts.
	 * @since 2019/07/15
	 */
	public BasicPoolEntry(int __dx, Object __v, int... __parts)
	{
		this.index = __dx;
		this.value = __v;
		
		// Reduce parts to shorts
		int n = (__parts == null ? 0 : __parts.length);
		short[] parts = new short[n];
		for (int i = 0; i < n; i++)
			parts[i] = (short)__parts[i];
		this._parts = parts;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/08/25
	 */
	@Override
................................................................................
	
	/**
	 * Returns the parts used.
	 *
	 * @return The used parts.
	 * @since 2019/07/15
	 */
	public final short[] parts()
	{
		return this._parts.clone();
	}
	
	/**
	 * Returns the value of this entry.
	 *