Check-in [844222f1c4]

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

Overview
Comment:Correct CHECKCAST where it would place un-cached entries on the stack when they should be cached.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 844222f1c4f7510167b5a0c3c36aef634afdb458
User & Date: stephanie.gawroriski 2019-06-12 21:54:43
Context
2019-06-12
22:16
Implement jvmCanArrayStore(). check-in: cef945116b user: stephanie.gawroriski tags: trunk
21:54
Correct CHECKCAST where it would place un-cached entries on the stack when they should be cached. check-in: 844222f1c4 user: stephanie.gawroriski tags: trunk
21:19
Minor adjustment to ASTORE. check-in: 0e65fd55b2 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/ByteCodeProcessor.java.

644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
	 */
	private final void __doCheckCast(ClassName __cn)
		throws NullPointerException
	{
		// An exception may be thrown
		this._canexception = true;
		
		// Peek of the state to determine if this class item was counted
		// counted or not so that it is retained
		ByteCodeState state = this.state;
		JavaStackResult flunked = state.stack.doStack(1);
		
		// [object] -> [object]
		JavaStackResult result = state.stack.doStack(1,
			flunked.in(0).nocounting, new JavaType(__cn));
		this.__update(result);
		
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Do check cast







<
<
<
<
<

|
|







644
645
646
647
648
649
650





651
652
653
654
655
656
657
658
659
660
	 */
	private final void __doCheckCast(ClassName __cn)
		throws NullPointerException
	{
		// An exception may be thrown
		this._canexception = true;
		





		// [object] -> [object]
		JavaStackResult result = this.state.stack.doCheckCast(
			new JavaType(__cn));
		this.__update(result);
		
		// Stop pre-processing here
		if (!this._dohandling)
			return;
		
		// Do check cast

Changes to runt/libs/tool-classfile/dev/shadowtail/classfile/xlate/JavaStackState.java.

260
261
262
263
264
265
266













































267
268
269
270
271
272
273
	 * @since 2019/04/11
	 */
	public final JavaStackResult doCacheFlush()
	{
		// This is just a transition to the non-cached state
		return this.doTransition(this.nonCached());
	}













































	
	/**
	 * Destroys all local variables and stack variables returning the process
	 * that is needed to clear out the entire state.
	 *
	 * Any references that need to be cleared when the code completes will be
	 * placed in the enqueue list.







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







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
316
317
318
	 * @since 2019/04/11
	 */
	public final JavaStackResult doCacheFlush()
	{
		// This is just a transition to the non-cached state
		return this.doTransition(this.nonCached());
	}
	
	/**
	 * This handles logic used by check cast.
	 *
	 * @param __t The type to cast to.
	 * @return The result of the cast.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/06/12
	 */
	public final JavaStackResult doCheckCast(JavaType __t)
		throws NullPointerException
	{
		if (__t == null)
			throw new NullPointerException("NARG");
			
		// This is nearly the same
		Info[] newstack = this._stack.clone();
		int stacktop = this.stacktop;
		
		// Get item on the 
		Info topitem = newstack[stacktop - 1];
		
		// Same as the top item, but with a new type instead
		newstack[stacktop - 1] = new Info(
			topitem.register,
			__t,
			topitem.value,
			topitem.readonly,
			topitem.nocounting);
		
		// If the top-most item is counting, then enqueue it in the event
		// exceptions happen
		JavaStackEnqueueList enq;
		if (topitem.nocounting)
			enq = new JavaStackEnqueueList(0);
		else
			enq = new JavaStackEnqueueList(0, topitem.register);
		
		// Create the result
		return new JavaStackResult(this,
			new JavaStackState(this._locals, newstack, stacktop),
			enq,
			new StateOperations(),
			JavaStackResult.makeInput(topitem));
	}
	
	/**
	 * Destroys all local variables and stack variables returning the process
	 * that is needed to clear out the entire state.
	 *
	 * Any references that need to be cleared when the code completes will be
	 * placed in the enqueue list.