Check-in [84d7bf5ed1]

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

Overview
Comment:Add static and runtime constant pools to the class.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 84d7bf5ed1c2d5f4bfc7dd1e5ec726a681ae1400
User & Date: stephanie.gawroriski 2019-07-15 11:31:34
Context
2019-07-15
11:39
Add static and runtime constant pool to the JAR. check-in: c28f03261a user: stephanie.gawroriski tags: trunk
11:31
Add static and runtime constant pools to the class. check-in: 84d7bf5ed1 user: stephanie.gawroriski tags: trunk
11:14
Implement HashMap.put(). check-in: c84097a743 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
...
134
135
136
137
138
139
140












141
142
143
144
145
146
147
...
200
201
202
203
204
205
206






207
208
209
210
211
212
213
...
282
283
284
285
286
287
288
289






290
291
292
	
	/** 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 int HEADER_SIZE_WITHOUT_MAGIC =
		92;
	
	/** The size of the header with the magic number. */
	public static final int HEADER_SIZE_WITH_MAGIC =
		HEADER_SIZE_WITHOUT_MAGIC + 4;
	
	/** Unused A. */
	public final int unuseda;
................................................................................
	
	/** File size. */
	public final int filesize;
	
	/** Size of all the non-header data. */
	public final int datasize;
	












	/**
	 * Initializes the class header.
	 *
	 * @param __vx The raw values.
	 * @since 2019/04/16
	 */
	public MinimizedClassHeader(int... __vx)
................................................................................
		// UUID
		this.uuidhi = __vx[at++];
		this.uuidlo = __vx[at++];
			
		// File size
		this.filesize = __vx[at++];
		this.datasize = __vx[at++];






	}
	
	/**
	 * Decodes the minimized class header.
	 *
	 * @param __is The bytes to decode from.
	 * @return The resulting minimized class header.
................................................................................
			
			// UUID
			/* uuidhi */ dis.readInt(),
			/* uuidlo */ dis.readInt(),
			
			// File size
			/* filesize */ dis.readInt(),
			/* datasize */ dis.readInt());






	}	
}








|







 







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







 







>
>
>
>
>
>







 







|
>
>
>
>
>
>



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
...
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
...
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
...
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
	
	/** 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 int HEADER_SIZE_WITHOUT_MAGIC =
		108;
	
	/** The size of the header with the magic number. */
	public static final int HEADER_SIZE_WITH_MAGIC =
		HEADER_SIZE_WITHOUT_MAGIC + 4;
	
	/** Unused A. */
	public final int unuseda;
................................................................................
	
	/** File size. */
	public final int filesize;
	
	/** Size of all the non-header data. */
	public final int datasize;
	
	/** Static constant pool offset. */
	public final int staticpooloff;
	
	/** Static constant pool size. */
	public final int staticpoolsize;
	
	/** Runtime constant pool offset. */
	public final int runtimepooloff;
	
	/** Runtime constant pool size. */
	public final int runtimepoolsize;
	
	/**
	 * Initializes the class header.
	 *
	 * @param __vx The raw values.
	 * @since 2019/04/16
	 */
	public MinimizedClassHeader(int... __vx)
................................................................................
		// UUID
		this.uuidhi = __vx[at++];
		this.uuidlo = __vx[at++];
			
		// File size
		this.filesize = __vx[at++];
		this.datasize = __vx[at++];
		
		// Static and run-time constant pool
		this.staticpooloff = __vx[at++];
		this.staticpoolsize = __vx[at++];
		this.runtimepooloff = __vx[at++];
		this.runtimepoolsize = __vx[at++];
	}
	
	/**
	 * Decodes the minimized class header.
	 *
	 * @param __is The bytes to decode from.
	 * @return The resulting minimized class header.
................................................................................
			
			// UUID
			/* uuidhi */ dis.readInt(),
			/* uuidlo */ dis.readInt(),
			
			// File size
			/* filesize */ dis.readInt(),
			/* datasize */ dis.readInt(),
			
			// Static and runtime pool
			/* staticpooloff */ dis.readInt(),
			/* staticpoolsize */ dis.readInt(),
			/* runtimepooloff */ dis.readInt(),
			/* runtimepoolsize */ dis.readInt());
	}	
}

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

262
263
264
265
266
267
268








269
270
271
272
273
274
275
		__dos.writeInt((int)uuid);
		
		// Write absolute file size! This saves time in calculating how big
		// a file we have and we can just read that many bytes for all the
		// data areas or similar if needed
		__dos.writeInt(reloff + 4);
		__dos.writeInt((reloff - baserel) + 4);








		
		// Constant pool is rounded
		Minimizer.__dosRound(__dos);
		
		// Write constant pool
		__dos.write(pooldata);
		Minimizer.__dosRound(__dos);







>
>
>
>
>
>
>
>







262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
		__dos.writeInt((int)uuid);
		
		// Write absolute file size! This saves time in calculating how big
		// a file we have and we can just read that many bytes for all the
		// data areas or similar if needed
		__dos.writeInt(reloff + 4);
		__dos.writeInt((reloff - baserel) + 4);
		
		// Static pool offset and size
		__dos.writeInt(0);
		__dos.writeInt(0);
		
		// Runtime pool offset and size
		__dos.writeInt(0);
		__dos.writeInt(0);
		
		// Constant pool is rounded
		Minimizer.__dosRound(__dos);
		
		// Write constant pool
		__dos.write(pooldata);
		Minimizer.__dosRound(__dos);