Check-in [3ce5be8da6]

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

Overview
Comment:Add debug points for at-end generated handlers; If the JPC is invalid do not throw an exception in SXS.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3ce5be8da61bddf87ce042d0aacfb6d444222172
User & Date: stephanie.gawroriski 2019-06-16 19:44:46
Context
2019-06-16
19:46
Use different digits for the debug point when exceptions are used. check-in: 25958e732f user: stephanie.gawroriski tags: trunk
19:44
Add debug points for at-end generated handlers; If the JPC is invalid do not throw an exception in SXS. check-in: 3ce5be8da6 user: stephanie.gawroriski tags: trunk
19:15
Add unaligned memory access when decoding operations (since those are the only ones technically able to be unaligned). check-in: 3d58c78266 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to bldt/mids/sxs/dev/shadowtail/sxs/Main.java.

28
29
30
31
32
33
34

35
36
37
38
39
40
41
..
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
...
126
127
128
129
130
131
132





133
134
135
136
137
138
139
140
141
142
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.classfile.ClassFile;

import net.multiphasicapps.classfile.Method;
import net.multiphasicapps.javac.CompilerPathSet;
import net.multiphasicapps.javac.NoSuchInputException;

/**
 * Main entry point and dumber for the class code side by side
 *
................................................................................
			NativeInstruction ni = nc.get(nidx);
			int niop = ni.operation();
			
			// Update location information?
			if (niop == NativeInstructionType.DEBUG_POINT)
			{
				nijln = ni.intArgument(0);
				nijop = (ni.intArgument(1) & 0xFF);
				nijpc = ni.intArgument(2);
			}
			
			// Change of source line?
			if (nijln != lljln)
			{
				// Get population of this line
................................................................................
			}
			
			// Change of Java instruction? Get its string form
			String jis = "";
			boolean chjpc;
			if ((chjpc = (nijpc != lljpc)))
			{





				// Get form
				jis = String.format("J@%3d: %s",
					nijpc, bc.getByAddress(nijpc));
				
				// Set new last address
				lljpc = nijpc;
			}
			
			// Get native instruction form
			String nis = String.format("N@%3d: %s",







>







 







|







 







>
>
>
>
>

|
<







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
..
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
...
127
128
129
130
131
132
133
134
135
136
137
138
139
140

141
142
143
144
145
146
147
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.multiphasicapps.classfile.ByteCode;
import net.multiphasicapps.classfile.ClassFile;
import net.multiphasicapps.classfile.InstructionMnemonics;
import net.multiphasicapps.classfile.Method;
import net.multiphasicapps.javac.CompilerPathSet;
import net.multiphasicapps.javac.NoSuchInputException;

/**
 * Main entry point and dumber for the class code side by side
 *
................................................................................
			NativeInstruction ni = nc.get(nidx);
			int niop = ni.operation();
			
			// Update location information?
			if (niop == NativeInstructionType.DEBUG_POINT)
			{
				nijln = ni.intArgument(0);
				nijop = ni.intArgument(1);
				nijpc = ni.intArgument(2);
			}
			
			// Change of source line?
			if (nijln != lljln)
			{
				// Get population of this line
................................................................................
			}
			
			// Change of Java instruction? Get its string form
			String jis = "";
			boolean chjpc;
			if ((chjpc = (nijpc != lljpc)))
			{
				// Which string to put here?
				Object jstr = (bc.isValidAddress(nijpc) ?
					bc.getByAddress(nijpc) :
					InstructionMnemonics.toString(nijop));
				
				// Get form
				jis = String.format("J@%3d: %s", nijpc, jstr);

				
				// Set new last address
				lljpc = nijpc;
			}
			
			// Get native instruction form
			String nis = String.format("N@%3d: %s",

Changes to runt/libs/tool-classfile/dev/shadowtail/classfile/nncc/NearNativeByteCodeHandler.java.

1478
1479
1480
1481
1482
1483
1484

1485
1486
1487
1488
1489
1490
1491
....
1496
1497
1498
1499
1500
1501
1502

1503
1504
1505
1506
1507
1508
1509
....
1520
1521
1522
1523
1524
1525
1526

1527
1528
1529
1530
1531
1532
1533
....
1585
1586
1587
1588
1589
1590
1591

1592
1593
1594
1595
1596
1597
1598
....
3008
3009
3010
3011
3012
3013
3014
3015


3016

















		Map<EnqueueAndLabel, __EData__> refcljumps = this._refcljumps;
		for (Map.Entry<EnqueueAndLabel, __EData__> e : refcljumps.entrySet())
		{
			EnqueueAndLabel eql = e.getKey();
			
			// Set label target for this one
			codebuilder.label(this.__useEDataAndGetLabel(e.getValue()));

			
			// Clear references
			JavaStackEnqueueList enq = eql.enqueue;
			for (int i = 0, n = enq.size(); i < n; i++)
				this.__refUncount(enq.get(i));
			
			// Then go to the target
................................................................................
		Map<ClassAndLabel, __EData__> metable = this._metable;
		for (Map.Entry<ClassAndLabel, __EData__> e : metable.entrySet())
		{
			ClassAndLabel csl = e.getKey();
			
			// Set label target for this one
			codebuilder.label(this.__useEDataAndGetLabel(e.getValue()));

			
			// Allocate class object
			this.__invokeNew(csl.classname, NativeCode.EXCEPTION_REGISTER);
			
			// Initialize the exception
			this.__invokeInstance(InvokeType.SPECIAL, csl.classname, "<init>",
				"()V", new RegisterList(NativeCode.EXCEPTION_REGISTER));
................................................................................
			ExceptionHandlerTransition ehtran = e.getKey();
			StateOperations sops = ehtran.handled;
			JavaStackEnqueueList enq = ehtran.nothandled;
			ExceptionHandlerTable ehtable = ehtran.table;
			
			// Label used for the jump target
			NativeCodeLabel lab = this.__useEDataAndGetLabel(e.getValue());

			
			// If the table is empty, just return
			if (ehtable.isEmpty())
			{
				// If we never saw a cleanup for this return yet we can
				// generate one here to be used for later points
				int rdx = returns.indexOf(enq);
................................................................................
		{
			StateOperationsAndTarget sot = e.getKey();
			StateOperations ops = sot.operations;
			InstructionJumpTarget target = sot.target;
			
			// Set label target for this one
			codebuilder.label(this.__useEDataAndGetLabel(e.getValue()));

			
			// Generate operations
			this.doStateOperations(ops);
			
			// Then just jump to the Java target
			codebuilder.addGoto(new NativeCodeLabel("java", target.target()));
		}
................................................................................
		ByteCodeState state = this.state;
		state.addr = __ed.addr;
		state.line = __ed.line;
		
		// And return the label
		return __ed.label;
	}
}



























>







 







>







 







>







 







>







 







|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
....
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
....
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
....
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
....
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
		Map<EnqueueAndLabel, __EData__> refcljumps = this._refcljumps;
		for (Map.Entry<EnqueueAndLabel, __EData__> e : refcljumps.entrySet())
		{
			EnqueueAndLabel eql = e.getKey();
			
			// Set label target for this one
			codebuilder.label(this.__useEDataAndGetLabel(e.getValue()));
			this.__useEDataDebugPoint(e.getValue());
			
			// Clear references
			JavaStackEnqueueList enq = eql.enqueue;
			for (int i = 0, n = enq.size(); i < n; i++)
				this.__refUncount(enq.get(i));
			
			// Then go to the target
................................................................................
		Map<ClassAndLabel, __EData__> metable = this._metable;
		for (Map.Entry<ClassAndLabel, __EData__> e : metable.entrySet())
		{
			ClassAndLabel csl = e.getKey();
			
			// Set label target for this one
			codebuilder.label(this.__useEDataAndGetLabel(e.getValue()));
			this.__useEDataDebugPoint(e.getValue());
			
			// Allocate class object
			this.__invokeNew(csl.classname, NativeCode.EXCEPTION_REGISTER);
			
			// Initialize the exception
			this.__invokeInstance(InvokeType.SPECIAL, csl.classname, "<init>",
				"()V", new RegisterList(NativeCode.EXCEPTION_REGISTER));
................................................................................
			ExceptionHandlerTransition ehtran = e.getKey();
			StateOperations sops = ehtran.handled;
			JavaStackEnqueueList enq = ehtran.nothandled;
			ExceptionHandlerTable ehtable = ehtran.table;
			
			// Label used for the jump target
			NativeCodeLabel lab = this.__useEDataAndGetLabel(e.getValue());
			this.__useEDataDebugPoint(e.getValue());
			
			// If the table is empty, just return
			if (ehtable.isEmpty())
			{
				// If we never saw a cleanup for this return yet we can
				// generate one here to be used for later points
				int rdx = returns.indexOf(enq);
................................................................................
		{
			StateOperationsAndTarget sot = e.getKey();
			StateOperations ops = sot.operations;
			InstructionJumpTarget target = sot.target;
			
			// Set label target for this one
			codebuilder.label(this.__useEDataAndGetLabel(e.getValue()));
			this.__useEDataDebugPoint(e.getValue());
			
			// Generate operations
			this.doStateOperations(ops);
			
			// Then just jump to the Java target
			codebuilder.addGoto(new NativeCodeLabel("java", target.target()));
		}
................................................................................
		ByteCodeState state = this.state;
		state.addr = __ed.addr;
		state.line = __ed.line;
		
		// And return the label
		return __ed.label;
	}
	
	/**
	 * Sets debug point information for edata.
	 *
	 * @param __ed The EData used.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/06/16
	 */
	private final void __useEDataDebugPoint(__EData__ __ed)
		throws NullPointerException
	{
		if (__ed == null)
			throw new NullPointerException("NARG");
		
		// Add debug point (operation becomes debug point 1)
		codebuilder.add(NativeInstructionType.DEBUG_POINT,
			__ed.line & 0x7FFF, 0xFE,
			__ed.jpc & 0x7FFF);
	}
}