Check-in [c6dca51a8d]

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

Overview
Comment:Correct dual pool encoding and the wrong section offsets being used for normal entry writes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:c6dca51a8db22bf17b0f17cd5bbdba4ce97200c5
User & Date: stephanie.gawroriski 2019-09-11 14:36:56
Context
2019-09-11
14:55
Handling of class info pointer and invoked methods. check-in: 2c510e56f3 user: stephanie.gawroriski tags: trunk
14:36
Correct dual pool encoding and the wrong section offsets being used for normal entry writes. check-in: c6dca51a8d user: stephanie.gawroriski tags: trunk
14:30
Initialize pool values. check-in: 609678434f 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.

78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
...
299
300
301
302
303
304
305
306



307
308
309

310
311
312
313
314
315
316
...
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
		for (boolean isruntime = false;; isruntime = true)
		{
			// The base offset and length used, used to read entry data
			int baseoff = (isruntime ? __ro : __co);
			
			// Which stream to read main entries from?
			DataInputStream dis = new DataInputStream(
				(isruntime ? new ByteArrayInputStream(__b, __ro, __rl) :
				new ByteArrayInputStream(__b, __co, __cl)));
			
			// Read the entry count (first null entry), ignore padding
			dis.readByte();
			dis.readByte();
			dis.readShort();
			int poolsize = dis.readInt();
			
................................................................................
		TableSectionOutputStream.Section clssection = output.addSection(
			TableSectionOutputStream.VARIABLE_SIZE, 4);
		TableSectionOutputStream.Section runsection = output.addSection(
			TableSectionOutputStream.VARIABLE_SIZE, 4);
		
		// Write both of the pools
		for (boolean isruntime = false;; isruntime = true)
		{			



			// Section containing the table of contents
			TableSectionOutputStream.Section toc =
				(isruntime ? runsection : clssection);

			
			// Are we encoding the static or run-time pool?
			BasicPoolBuilder pool = (isruntime ? __dp.runtimePool() :
				__dp.classPool());
			
			// The size of the pool, used for the first entry
			int poolsize = pool.size();
................................................................................
				for (int j = 0; j < epn; j++)
				{
					int v = ep[j];
					if (v < 0 || v > 127)
						iswide = true;
				}
				
				// Encode the data into a section somewhere

				TableSectionOutputStream.Section data = output.addSection(
					TableSectionOutputStream.VARIABLE_SIZE, 4);
				data.write(DualPoolEncoder.encodeValue(et, ep, iswide, ev));
				
				// Write pool table entry
				toc.writeByte(et.ordinal());
				toc.writeByte((iswide ? -epn : epn));
				toc.writeSectionSizeShort(data);
				toc.writeSectionAddressInt(data);
			}
			



			// Stop processing after the run-time is done
			if (isruntime)
				break;
		}
		
		// Write to the target stream
		output.writeTo(__out);







|
|







 







|
>
>
>

|
<
>







 







|
>
|










>
>
>







78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
...
299
300
301
302
303
304
305
306
307
308
309
310
311

312
313
314
315
316
317
318
319
...
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
381
382
383
384
		for (boolean isruntime = false;; isruntime = true)
		{
			// The base offset and length used, used to read entry data
			int baseoff = (isruntime ? __ro : __co);
			
			// Which stream to read main entries from?
			DataInputStream dis = new DataInputStream(
				new ByteArrayInputStream(__b, baseoff,
					(isruntime ? __rl : __cl)));
			
			// Read the entry count (first null entry), ignore padding
			dis.readByte();
			dis.readByte();
			dis.readShort();
			int poolsize = dis.readInt();
			
................................................................................
		TableSectionOutputStream.Section clssection = output.addSection(
			TableSectionOutputStream.VARIABLE_SIZE, 4);
		TableSectionOutputStream.Section runsection = output.addSection(
			TableSectionOutputStream.VARIABLE_SIZE, 4);
		
		// Write both of the pools
		for (boolean isruntime = false;; isruntime = true)
		{
			// Sub output which writes to the section
			TableSectionOutputStream sub = new TableSectionOutputStream();
			
			// Section containing the table of contents
			TableSectionOutputStream.Section toc = sub.addSection(

				TableSectionOutputStream.VARIABLE_SIZE, 4);
			
			// Are we encoding the static or run-time pool?
			BasicPoolBuilder pool = (isruntime ? __dp.runtimePool() :
				__dp.classPool());
			
			// The size of the pool, used for the first entry
			int poolsize = pool.size();
................................................................................
				for (int j = 0; j < epn; j++)
				{
					int v = ep[j];
					if (v < 0 || v > 127)
						iswide = true;
				}
				
				// Encode the data into a section somewhere in this
				// sub-section
				TableSectionOutputStream.Section data = sub.addSection(
					TableSectionOutputStream.VARIABLE_SIZE, 4);
				data.write(DualPoolEncoder.encodeValue(et, ep, iswide, ev));
				
				// Write pool table entry
				toc.writeByte(et.ordinal());
				toc.writeByte((iswide ? -epn : epn));
				toc.writeSectionSizeShort(data);
				toc.writeSectionAddressInt(data);
			}
			
			// Write entire sub-section data to the target
			sub.writeTo((isruntime ? runsection : clssection));
			
			// Stop processing after the run-time is done
			if (isruntime)
				break;
		}
		
		// Write to the target stream
		output.writeTo(__out);