Package org.adoptopenjdk.jitwatch.model.bytecode

Examples of org.adoptopenjdk.jitwatch.model.bytecode.LineTable


public class TestLineTable
  @Test
  public void testCompositeLineTable()
  {
    LineTable table1 = new LineTable();
    LineTable table2 = new LineTable();
   
    LineTableEntry entry1 = new LineTableEntry(MemberSignatureParts.fromParts("TestClass", "foo", void.class.getName(), new String[0]), 0, 0);
    LineTableEntry entry2 = new LineTableEntry(MemberSignatureParts.fromParts("TestClass", "foo", void.class.getName(), new String[0]), 5, 5);
    LineTableEntry entry3 = new LineTableEntry(MemberSignatureParts.fromParts("TestClass", "bar", void.class.getName(), new String[0]), 10, 10);
    LineTableEntry entry4 = new LineTableEntry(MemberSignatureParts.fromParts("TestClass", "bar", void.class.getName(), new String[0]), 15, 15);
   
    table1.add(entry1);
    table1.add(entry2);

    table2.add(entry3);
    table2.add(entry4);

    LineTable composite = new LineTable();
    composite.add(table2);
    composite.add(table1);
    composite.sort();
   
    assertEquals(0, composite.findSourceLineForBytecodeOffset(0));
    assertEquals(0, composite.findSourceLineForBytecodeOffset(1));
    assertEquals(5, composite.findSourceLineForBytecodeOffset(5));
    assertEquals(5, composite.findSourceLineForBytecodeOffset(6));
    assertEquals(10, composite.findSourceLineForBytecodeOffset(10));
    assertEquals(10, composite.findSourceLineForBytecodeOffset(11));
    assertEquals(15, composite.findSourceLineForBytecodeOffset(15));
    assertEquals(15, composite.findSourceLineForBytecodeOffset(16));
   
    assertEquals("foo", composite.getEntryForSourceLine(0).getMemberSignatureParts().getMemberName());
    assertEquals("foo", composite.getEntryForSourceLine(5).getMemberSignatureParts().getMemberName());
    assertEquals("bar", composite.getEntryForSourceLine(10).getMemberSignatureParts().getMemberName());
    assertEquals("bar", composite.getEntryForSourceLine(15).getMemberSignatureParts().getMemberName());
  }
View Full Code Here


        {
          MemberBytecode memberBytecode = classBytecode.getMemberBytecode(currentMember);

          if (memberBytecode != null)
          {
            LineTable lineTable = memberBytecode.getLineTable();

            sourceHighlight = lineTable.findSourceLineForBytecodeOffset(bytecodeOffset);
          }
          else
          {
            logger.warn("No MemberBytecode found for {}", currentMember);
          }
View Full Code Here

TOP

Related Classes of org.adoptopenjdk.jitwatch.model.bytecode.LineTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.