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 Side-by-Side Diffs Ignore Whitespace Patch

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

    28     28   import java.util.HashMap;
    29     29   import java.util.HashSet;
    30     30   import java.util.List;
    31     31   import java.util.Map;
    32     32   import java.util.Set;
    33     33   import net.multiphasicapps.classfile.ByteCode;
    34     34   import net.multiphasicapps.classfile.ClassFile;
           35  +import net.multiphasicapps.classfile.InstructionMnemonics;
    35     36   import net.multiphasicapps.classfile.Method;
    36     37   import net.multiphasicapps.javac.CompilerPathSet;
    37     38   import net.multiphasicapps.javac.NoSuchInputException;
    38     39   
    39     40   /**
    40     41    * Main entry point and dumber for the class code side by side
    41     42    *
................................................................................
    94     95   			NativeInstruction ni = nc.get(nidx);
    95     96   			int niop = ni.operation();
    96     97   			
    97     98   			// Update location information?
    98     99   			if (niop == NativeInstructionType.DEBUG_POINT)
    99    100   			{
   100    101   				nijln = ni.intArgument(0);
   101         -				nijop = (ni.intArgument(1) & 0xFF);
          102  +				nijop = ni.intArgument(1);
   102    103   				nijpc = ni.intArgument(2);
   103    104   			}
   104    105   			
   105    106   			// Change of source line?
   106    107   			if (nijln != lljln)
   107    108   			{
   108    109   				// Get population of this line
................................................................................
   126    127   			}
   127    128   			
   128    129   			// Change of Java instruction? Get its string form
   129    130   			String jis = "";
   130    131   			boolean chjpc;
   131    132   			if ((chjpc = (nijpc != lljpc)))
   132    133   			{
          134  +				// Which string to put here?
          135  +				Object jstr = (bc.isValidAddress(nijpc) ?
          136  +					bc.getByAddress(nijpc) :
          137  +					InstructionMnemonics.toString(nijop));
          138  +				
   133    139   				// Get form
   134         -				jis = String.format("J@%3d: %s",
   135         -					nijpc, bc.getByAddress(nijpc));
          140  +				jis = String.format("J@%3d: %s", nijpc, jstr);
   136    141   				
   137    142   				// Set new last address
   138    143   				lljpc = nijpc;
   139    144   			}
   140    145   			
   141    146   			// Get native instruction form
   142    147   			String nis = String.format("N@%3d: %s",

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

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