Check-in [ff5b828528]

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

Overview
Comment:Base encode of layered pool data.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ff5b82852848e2320aa518dd926bdf34ac532615
User & Date: stephanie.gawroriski 2019-08-25 15:53:08
Context
2019-08-25
16:00
Base outer class switch to the new pool stuff. check-in: d565bb959b user: stephanie.gawroriski tags: trunk
15:53
Base encode of layered pool data. check-in: ff5b828528 user: stephanie.gawroriski tags: trunk
13:08
Add base for writing layered pools and such. check-in: 5ffc4f93f0 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/libs/io/net/multiphasicapps/io/TableSectionOutputStream.java.

33
34
35
36
37
38
39







40
41
42
43
44
45
46
...
129
130
131
132
133
134
135
136
137
138
139
140



141
142
143
















































144
145
146
147
148
149
150
...
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209

210
211
212
213
214
215
216
...
283
284
285
286
287
288
289












































290
291
292
293
294
295
296
...
310
311
312
313
314
315
316



317
318
319
320
321
322
323
...
329
330
331
332
333
334
335

336

337
338
339
340
341



342
343
344
345
346
347
348
349



350
351
352
353
354
355
356
...
410
411
412
413
414
415
416



417
418
419
420
421
422
423
...
459
460
461
462
463
464
465



466
467
468
469
470
471
472
...
864
865
866
867
868
869
870
871


872









	public static final int VARIABLE_SIZE =
		Integer.MIN_VALUE;
	
	/** The sections which are available in the output. */
	private final List<Section> _sections =
		new LinkedList<>();
	







	/**
	 * Adds a section which is of a variable size.
	 *
	 * @return The resulting section.
	 * @since 2019/08/11
	 */
	public final TableSectionOutputStream.Section addSection()
................................................................................
			throw new IllegalArgumentException("BD3h " + __size);
		
		// It does not make sense to align under a byte
		if (__align < 1)
			__align = 1;
		
		// Create section
		Section rv = new Section(__size, __align);
		
		// Add to our section list
		this._sections.add(rv);
		



		// And return this section
		return rv;
	}
















































	
	/**
	 * Returns a byte array representing the table file.
	 *
	 * @return The resulting byte array.
	 * @since 2019/08/11
	 */
................................................................................
	 */
	public final void writeTo(OutputStream __os)
		throws IOException, NullPointerException
	{
		if (__os == null)
			throw new NullPointerException("NARG");
		
		// Our current file size
		int filesize = 0;
		
		// We must go through all of the sections, perform their required
		// alignment while additionally calculating their addresses within
		// the file for section references.
		List<Section> sections = this._sections;
		for (int i = 0, n = sections.size(); i < n; i++)
		{
			Section section = sections.get(i);
			
			// Perform alignment of this section
			filesize += (section.alignment - 1) -
				(filesize % section.alignment);
			
			// Section is addressed here
			section._writeaddress = filesize;
			
			// Move the current file size up by the section's size
			int writesize = (section.isvariable ?
				section._size : section.fixedsize);
			filesize += writesize;
			section._writesize = writesize;
		}
		
		// Write each individual section to the output stream
		int writeptr = 0;

		for (int i = 0, n = sections.size(); i < n; i++)
		{
			Section section = sections.get(i);
			
			// Get properties of the section
			byte[] data = section._data;
			int cursize = section._size,
................................................................................
			while (writeptr < writeendaddress)
			{
				__os.write(0);
				writeptr++;
			}
		}
	}












































	
	/**
	 * This represents a single section within the output.
	 *
	 * @since 2019/08/11
	 */
	public static final class Section
................................................................................
		/** Is this a variable size section? */
		protected final boolean isvariable;
		
		/** Data rewrites which are possible. */
		private final List<__Rewrite__> _rewrites =
			new LinkedList<>();
		



		/** The byte buffer data. */
		private byte[] _data;
		
		/** The current size of the section. */
		private int _size;
		
		/** The write address of this section. */
................................................................................
			-1;
		
		/**
		 * Initializes the written section.
		 *
		 * @param __size The size to use.
		 * @param __align The alignment to use.

		 * @throws IllegalArgumentException If the size is zero or negative.

		 * @since 2019/08/11
		 */
		private Section(int __size, int __align)
			throws IllegalArgumentException
		{



			// {@squirreljme.error BD3l Zero or negative size. (The size)}
			if (__size != VARIABLE_SIZE && __size <= 0)
				throw new IllegalArgumentException("BD3l " + __size);
			
			// Set
			this.fixedsize = __size;
			this.alignment = (__align >= 1 ? __align : 1);
			this.isvariable = (__size == VARIABLE_SIZE);



			
			// If this is a fixed size section, we never have to expand it
			// so we can allocate all the needed data!
			if (__size != VARIABLE_SIZE)
				this._data = new byte[__size];
			else
				this._data = new byte[_BUFFER_SIZE];
................................................................................
			}
			
			// Write into the data
			data[size] = (byte)__b;
			
			// Size up
			this._size = size + 1;



		}
		
		/**
		 * {@inheritDoc}
		 * @since 2019/08/11
		 */
		@Override
................................................................................
			
			// Write into the data
			for (int i = 0; i < __l; i++)
				data[size++] = __b[__o++];
			
			// Size up
			this._size = size;



		}
		
		/**
		 * Writes padding which aligns to a given amount from within the
		 * data stream as itself.
		 *
		 * @param __n The number of bytes to align to.
................................................................................
		@Override
		public final void writeUTF(String __v)
			throws IOException
		{
			throw new todo.TODO();
		}
	}
}



















>
>
>
>
>
>
>







 







|




>
>
>



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







 







|
|

|
|
|
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<

<
>







 







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







 







>
>
>







 







>

>


|
|

>
>
>








>
>
>







 







>
>
>







 







>
>
>







 







|
>
>
|
>
>
>
>
>
>
>
>
>
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
...
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
...
234
235
236
237
238
239
240
241
242
243
244
245
246


247
















248

249
250
251
252
253
254
255
256
...
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
...
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
...
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
...
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
...
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
...
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
	public static final int VARIABLE_SIZE =
		Integer.MIN_VALUE;
	
	/** The sections which are available in the output. */
	private final List<Section> _sections =
		new LinkedList<>();
	
	/** Are the section informations dirty? */
	private final __Dirty__ _dirty =
		new __Dirty__();
	
	/** The current file size. */
	private int _filesize;
	
	/**
	 * Adds a section which is of a variable size.
	 *
	 * @return The resulting section.
	 * @since 2019/08/11
	 */
	public final TableSectionOutputStream.Section addSection()
................................................................................
			throw new IllegalArgumentException("BD3h " + __size);
		
		// It does not make sense to align under a byte
		if (__align < 1)
			__align = 1;
		
		// Create section
		Section rv = new Section(__size, __align, this._dirty);
		
		// Add to our section list
		this._sections.add(rv);
		
		// Becomes dirty because new section was added
		this._dirty._dirty = true;
		
		// And return this section
		return rv;
	}
	
	/**
	 * Returns the current size of the file.
	 *
	 * @return The file size.
	 * @since 2019/08/25
	 */
	public final int fileSize()
	{
		this.__undirty();
		return this._filesize;
	}
	
	/**
	 * Returns the address of the given section.
	 *
	 * @param __s The section.
	 * @return The address of the section.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/08/25
	 */
	public final int sectionAddress(Section __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		this.__undirty();
		return __s._writeaddress;
	}
	
	/**
	 * Returns the size of the given section.
	 *
	 * @param __s The section.
	 * @return The size of the section.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/08/25
	 */
	public final int sectionSize(Section __s)
		throws NullPointerException
	{
		if (__s == null)
			throw new NullPointerException("NARG");
		
		this.__undirty();
		return __s._writesize;
	}
	
	/**
	 * Returns a byte array representing the table file.
	 *
	 * @return The resulting byte array.
	 * @since 2019/08/11
	 */
................................................................................
	 */
	public final void writeTo(OutputStream __os)
		throws IOException, NullPointerException
	{
		if (__os == null)
			throw new NullPointerException("NARG");
		
		// The current write pointer
		int writeptr = 0;
		
		// Undirty and get the file size
		this.__undirty();
		int filesize = this._filesize;


		
















		// Write each individual section to the output stream

		List<Section> sections = this._sections;
		for (int i = 0, n = sections.size(); i < n; i++)
		{
			Section section = sections.get(i);
			
			// Get properties of the section
			byte[] data = section._data;
			int cursize = section._size,
................................................................................
			while (writeptr < writeendaddress)
			{
				__os.write(0);
				writeptr++;
			}
		}
	}
	
	/**
	 * Undirties and calculations all the section layout and information.
	 *
	 * @since 2019/08/25
	 */
	private final void __undirty()
	{
		// There is no need to calculate if this is not dirty at all
		__Dirty__ dirty = this._dirty;
		if (!dirty._dirty)
			return;
		
		// Our current file size
		int filesize = 0;
		
		// We must go through all of the sections, perform their required
		// alignment while additionally calculating their addresses within
		// the file for section references.
		List<Section> sections = this._sections;
		for (int i = 0, n = sections.size(); i < n; i++)
		{
			Section section = sections.get(i);
			
			// Perform alignment of this section
			filesize += (section.alignment - 1) -
				(filesize % section.alignment);
			
			// Section is addressed here
			section._writeaddress = filesize;
			
			// Move the current file size up by the section's size
			int writesize = (section.isvariable ?
				section._size : section.fixedsize);
			filesize += writesize;
			section._writesize = writesize;
		}
		
		// Store file size
		this._filesize = filesize;
		
		// Clear dirty flag
		dirty._dirty = false;
	}
	
	/**
	 * This represents a single section within the output.
	 *
	 * @since 2019/08/11
	 */
	public static final class Section
................................................................................
		/** Is this a variable size section? */
		protected final boolean isvariable;
		
		/** Data rewrites which are possible. */
		private final List<__Rewrite__> _rewrites =
			new LinkedList<>();
		
		/** The tracker for the dirtiness. */
		private final __Dirty__ _dirty;
		
		/** The byte buffer data. */
		private byte[] _data;
		
		/** The current size of the section. */
		private int _size;
		
		/** The write address of this section. */
................................................................................
			-1;
		
		/**
		 * Initializes the written section.
		 *
		 * @param __size The size to use.
		 * @param __align The alignment to use.
		 * @param __d The dirty flag.
		 * @throws IllegalArgumentException If the size is zero or negative.
		 * @throws NullPointerException On null arguments.
		 * @since 2019/08/11
		 */
		private Section(int __size, int __align, __Dirty__ __d)
			throws IllegalArgumentException, NullPointerException
		{
			if (__d == null)
				throw new NullPointerException("NARG");
			
			// {@squirreljme.error BD3l Zero or negative size. (The size)}
			if (__size != VARIABLE_SIZE && __size <= 0)
				throw new IllegalArgumentException("BD3l " + __size);
			
			// Set
			this.fixedsize = __size;
			this.alignment = (__align >= 1 ? __align : 1);
			this.isvariable = (__size == VARIABLE_SIZE);
			
			// Dirty flag storage
			this._dirty = __d;
			
			// If this is a fixed size section, we never have to expand it
			// so we can allocate all the needed data!
			if (__size != VARIABLE_SIZE)
				this._data = new byte[__size];
			else
				this._data = new byte[_BUFFER_SIZE];
................................................................................
			}
			
			// Write into the data
			data[size] = (byte)__b;
			
			// Size up
			this._size = size + 1;
			
			// Becomes dirty
			this._dirty._dirty = true;
		}
		
		/**
		 * {@inheritDoc}
		 * @since 2019/08/11
		 */
		@Override
................................................................................
			
			// Write into the data
			for (int i = 0; i < __l; i++)
				data[size++] = __b[__o++];
			
			// Size up
			this._size = size;
			
			// Becomes dirty
			this._dirty._dirty = true;
		}
		
		/**
		 * Writes padding which aligns to a given amount from within the
		 * data stream as itself.
		 *
		 * @param __n The number of bytes to align to.
................................................................................
		@Override
		public final void writeUTF(String __v)
			throws IOException
		{
			throw new todo.TODO();
		}
	}
	
	/**
	 * Are the addresses and sizes considered dirty?
	 *
	 * @since 2019/08/25
	 */
	static final class __Dirty__
	{
		/** Flag used to store the dirty state. */
		volatile boolean _dirty;
	}
}

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

12
13
14
15
16
17
18

19
20
21
22
23
24
25
...
162
163
164
165
166
167
168























































169
170
171
172
173
174
175
import dev.shadowtail.classfile.pool.BasicPoolBuilder;
import dev.shadowtail.classfile.pool.BasicPoolEntry;
import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;


/**
 * This contains the encoder for dual pools.
 *
 * @since 2019/07/17
 */
public final class DualPoolEncoder
................................................................................
				break;
		}
		
		// Return the location of the data
		return new DualPoolEncodeResult(staticpooloff, staticpoolsize,
			runtimepooloff, runtimepoolsize);
	}























































	
	/**
	 * Encodes the pool value.
	 *
	 * @param __t The type to encode.
	 * @param __p The parts.
	 * @param __wide Are the parts wide?







>







 







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







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
...
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
import dev.shadowtail.classfile.pool.BasicPoolBuilder;
import dev.shadowtail.classfile.pool.BasicPoolEntry;
import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import net.multiphasicapps.io.TableSectionOutputStream;

/**
 * This contains the encoder for dual pools.
 *
 * @since 2019/07/17
 */
public final class DualPoolEncoder
................................................................................
				break;
		}
		
		// Return the location of the data
		return new DualPoolEncodeResult(staticpooloff, staticpoolsize,
			runtimepooloff, runtimepoolsize);
	}
	
	/**
	 * Encodes a layered pool from one class to another.
	 *
	 * @param __src The source pool.
	 * @param __onto The pool to layer on top of.
	 * @param __out The stream to write to.
	 * @return The result of the encoded pool data.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/08/25
	 */
	public static final DualPoolEncodeResult encodeLayered(
		DualClassRuntimePoolBuilder __src, DualClassRuntimePoolBuilder __onto,
		OutputStream __out)
		throws IOException, NullPointerException
	{
		if (__src == null || __onto == null || __out == null)
			throw new NullPointerException("NARG");
		
		// The resulting table
		TableSectionOutputStream table = new TableSectionOutputStream();
		
		// Process static entries
		TableSectionOutputStream.Section sl = table.addSection(
			TableSectionOutputStream.VARIABLE_SIZE, 4);
		for (BasicPoolEntry e : __src.classPool())
		{
			Object v = e.value;
			if (v == null)
				sl.writeInt(__src.classPool().size());
			else
				sl.writeInt(__onto.add(false, v).index);
		}
		
		// Process runtime entries
		TableSectionOutputStream.Section rl = table.addSection(
			TableSectionOutputStream.VARIABLE_SIZE, 4);
		for (BasicPoolEntry e : __src.runtimePool())
		{
			Object v = e.value;
			if (v == null)
				sl.writeInt(__src.runtimePool().size());
			else
				sl.writeInt(__onto.add(true, v).index);
		}
		
		// Write the encoded pool
		table.writeTo(__out);
		
		// Return the positions of everything
		return new DualPoolEncodeResult(
			table.sectionAddress(sl), table.sectionSize(sl),
			table.sectionAddress(rl), table.sectionSize(rl));
	}
	
	/**
	 * Encodes the pool value.
	 *
	 * @param __t The type to encode.
	 * @param __p The parts.
	 * @param __wide Are the parts wide?

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

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
...
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298


299

300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
import dev.shadowtail.classfile.nncc.ArgumentFormat;
import dev.shadowtail.classfile.nncc.NativeCode;
import dev.shadowtail.classfile.nncc.NativeInstruction;
import dev.shadowtail.classfile.nncc.NativeInstructionType;
import dev.shadowtail.classfile.nncc.RegisterList;
import dev.shadowtail.classfile.pool.ClassPool;
import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;
import dev.shadowtail.classfile.pool.PoolLayerResult;
import dev.shadowtail.classfile.xlate.CompareType;
import dev.shadowtail.classfile.xlate.DataType;
import dev.shadowtail.classfile.xlate.MathType;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
................................................................................
		// a file we have and we can just read that many bytes for all the
		// data areas or similar if needed
		header.writeFileSizeInt();
		
		// Not used anymore
		header.writeInt(0);
		
		// We are backing ourselves off the JAR pool
		DualClassRuntimePoolBuilder jarpool = this.jarpool;
		if (jarpool != null)
		{
			// Layer the local pool onto the global pool so we can get all
			// of the references used
			PoolLayerResult layer = PoolLayerResult.layerPool(localpool,
				jarpool);
			
			// Build static pool data
			TableSectionOutputStream.Section asp = output.addSection();
			layer.writeLayer(false, asp);
			
			// Static pool offset and size
			header.writeSectionAddressInt(asp);
			header.writeSectionSizeInt(asp);
			
			// Build runtime pool data
			TableSectionOutputStream.Section arp = output.addSection();
			layer.writeLayer(true, arp);
			
			// Runtime pool offset and size
			header.writeSectionAddressInt(arp);
			header.writeSectionSizeInt(arp);
		}
		
		// This class is using its own independent pool
		else
		{
			// Where our pools are going
			TableSectionOutputStream.Section lpd = output.addSection();
			
			// Encode the local pool


			DualPoolEncodeResult der = DualPoolEncoder.encode(localpool, lpd);

			
			// Static pool
			header.writeSectionAddressInt(lpd, der.staticpooloff);
			header.writeInt(der.staticpoolsize);
			
			// Run-time pool
			header.writeSectionAddressInt(lpd, der.runtimepooloff);
			header.writeInt(der.runtimepoolsize);
		}
		
		// Write end magic number, which is at the end of the file
		TableSectionOutputStream.Section eofmagic = output.addSection(4);
		eofmagic.writeInt(MinimizedClassHeader.END_MAGIC_NUMBER);
		
		// Write resulting file
		output.writeTo(__os);







<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
|
|
|
>
>
|
>
|
|
|
|
|
|
|
|
<







13
14
15
16
17
18
19

20
21
22
23
24
25
26
...
258
259
260
261
262
263
264





























265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280

281
282
283
284
285
286
287
import dev.shadowtail.classfile.nncc.ArgumentFormat;
import dev.shadowtail.classfile.nncc.NativeCode;
import dev.shadowtail.classfile.nncc.NativeInstruction;
import dev.shadowtail.classfile.nncc.NativeInstructionType;
import dev.shadowtail.classfile.nncc.RegisterList;
import dev.shadowtail.classfile.pool.ClassPool;
import dev.shadowtail.classfile.pool.DualClassRuntimePoolBuilder;

import dev.shadowtail.classfile.xlate.CompareType;
import dev.shadowtail.classfile.xlate.DataType;
import dev.shadowtail.classfile.xlate.MathType;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.InputStream;
................................................................................
		// a file we have and we can just read that many bytes for all the
		// data areas or similar if needed
		header.writeFileSizeInt();
		
		// Not used anymore
		header.writeInt(0);
		





























		// Where our pools are going
		TableSectionOutputStream.Section lpd = output.addSection();
		
		// Encode the local pool or the local pool on top of the JAR pool
		DualClassRuntimePoolBuilder jarpool = this.jarpool;
		DualPoolEncodeResult der = (jarpool == null ?
			DualPoolEncoder.encode(localpool, lpd) :
			DualPoolEncoder.encodeLayered(localpool, jarpool, lpd));
		
		// Static pool
		header.writeSectionAddressInt(lpd, der.staticpooloff);
		header.writeInt(der.staticpoolsize);
		
		// Run-time pool
		header.writeSectionAddressInt(lpd, der.runtimepooloff);
		header.writeInt(der.runtimepoolsize);

		
		// Write end magic number, which is at the end of the file
		TableSectionOutputStream.Section eofmagic = output.addSection(4);
		eofmagic.writeInt(MinimizedClassHeader.END_MAGIC_NUMBER);
		
		// Write resulting file
		output.writeTo(__os);

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

67
68
69
70
71
72
73


















74
75
76
77
78
79
80
			// Create, store, and use the new entry
			BasicPoolEntry rv;
			entries.put(__v, (rv = new BasicPoolEntry(
				entries.size(), __v, __parts)));
			return rv;
		}
	}


















	
	/**
	 * Adds an internal entry or returns the pre-existing value if it is
	 * already in the pool.
	 *
	 * @param __v The value.
	 * @param __parts The parts to use.







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







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
			// Create, store, and use the new entry
			BasicPoolEntry rv;
			entries.put(__v, (rv = new BasicPoolEntry(
				entries.size(), __v, __parts)));
			return rv;
		}
	}
	
	/**
	 * Adds an already existing basic entry to this pool.
	 *
	 * @param __e The entry to add.
	 * @return The resulting basic entry which may be {@code __e} or another
	 * entry.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/08/25
	 */
	public final BasicPoolEntry addEntry(BasicPoolEntry __e)
		throws NullPointerException
	{
		if (__e == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
	
	/**
	 * Adds an internal entry or returns the pre-existing value if it is
	 * already in the pool.
	 *
	 * @param __v The value.
	 * @param __parts The parts to use.

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

35
36
37
38
39
40
41




















42
43
44
45
46
47
48
49
50
51
52
53
54
	 */
	public BasicPoolEntry(int __dx, Object __v, int... __parts)
	{
		this.index = __dx;
		this.value = __v;
		this._parts = (__parts == null ? new int[0] : __parts.clone());
	}




















	
	/**
	 * Returns the parts used.
	 *
	 * @return The used parts.
	 * @since 2019/07/15
	 */
	public final int[] parts()
	{
		return this._parts.clone();
	}
}








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













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
	 */
	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
	public final boolean equals(Object __o)
	{
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/08/25
	 */
	@Override
	public final int hashCode()
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the parts used.
	 *
	 * @return The used parts.
	 * @since 2019/07/15
	 */
	public final int[] parts()
	{
		return this._parts.clone();
	}
}

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

19
20
21
22
23
24
25















26
27
28
29
30
31
32
	/** The class pool. */
	protected final BasicPoolBuilder classpool =
		new BasicPoolBuilder();
	
	/** The run-time pool. */
	protected final BasicPoolBuilder runpool =
		new BasicPoolBuilder();















	
	/**
	 * Returns the static class pool.
	 *
	 * @return The pool.
	 * @since 2019/07/17
	 */







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







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
	/** The class pool. */
	protected final BasicPoolBuilder classpool =
		new BasicPoolBuilder();
	
	/** The run-time pool. */
	protected final BasicPoolBuilder runpool =
		new BasicPoolBuilder();
	
	/**
	 * Adds the specified pool entry.
	 *
	 * @param __rt Place into the run-time pool?
	 * @param __v The value to store.
	 * @return The resulting pool entry.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/08/25
	 */
	public final BasicPoolEntry add(boolean __rt, Object __v)
		throws NullPointerException
	{
		throw new todo.TODO();
	}
	
	/**
	 * Returns the static class pool.
	 *
	 * @return The pool.
	 * @since 2019/07/17
	 */

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

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 * This is the result of a constant pool layering on top of another.
 *
 * @since 2019/08/24
 */
public final class PoolLayerResult
{
	/**
	 * Writes one of the specified layers to the given stream.
	 *
	 * @param __runtime Is the run-time layer to be exported?
	 * @param __os The stream to write to.
	 * @throws IOException On write errors.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/08/25
	 */
	public final void writeLayer(boolean __runtime, OutputStream __os)
		throws IOException, NullPointerException
	{
		if (__os == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
	
	/**
	 * Layers the given pool onto the other.
	 *
	 * @param __pool The source pool.
	 * @param __onto The pool to layer on top of.
	 * @return The layered pool.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/08/24
	 */
	public static final PoolLayerResult layerPool(
		DualClassRuntimePoolBuilder __pool, DualClassRuntimePoolBuilder __onto)
		throws NullPointerException
	{
		if (__pool == null || __onto == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<