Package org.adoptopenjdk.jitwatch.model.bytecode

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


        List<BytecodeInstruction> instructions = memberBytecode.getInstructions();

        if (instructions != null && instructions.size() > 0)
        {
          BytecodeInstruction lastInstruction = instructions.get(instructions.size() - 1);

          // final instruction is a return for 1 byte
          int bcSize = 1 + lastInstruction.getOffset();

          if (bcSize >= maxMethodBytes && !memberName.equals(S_BYTECODE_STATIC_INITIALISER_SIGNATURE))
          {
            writer.print(C_DOUBLE_QUOTE);
            writer.print(className);
View Full Code Here


public class TestJournalUtil
{
  @Test
  public void testSanityCheckInlineFail()
  {
    BytecodeInstruction instrAaload = new BytecodeInstruction();
    instrAaload.setOpcode(Opcode.AALOAD);
   
    assertFalse(JournalUtil.sanityCheckInline(instrAaload));
  }
View Full Code Here

  }
 
  @Test
  public void testSanityCheckInlinePass()
  {
    BytecodeInstruction instrInvokeSpecial = new BytecodeInstruction();
    instrInvokeSpecial.setOpcode(Opcode.INVOKESPECIAL);
   
    assertTrue(JournalUtil.sanityCheckInline(instrInvokeSpecial));
  }
View Full Code Here

  }
 
  @Test
  public void testSanityCheckBranchFail()
  {
    BytecodeInstruction instrAaload = new BytecodeInstruction();
    instrAaload.setOpcode(Opcode.AALOAD);
   
    assertFalse(JournalUtil.sanityCheckBranch(instrAaload));
  }
View Full Code Here

  }
 
  @Test
  public void testSanityCheckBranchPass()
  {
    BytecodeInstruction instrIfcmpne = new BytecodeInstruction();
    instrIfcmpne.setOpcode(Opcode.IF_ICMPNE);
   
    assertTrue(JournalUtil.sanityCheckBranch(instrIfcmpne));
  }
View Full Code Here

      BytecodeLabel bcLabel = (BytecodeLabel) viewerBytecode.getLabelAtIndex(index);

      if (bcLabel != null)
      {
        BytecodeInstruction instruction = bcLabel.getInstruction();

        int bytecodeOffset = instruction.getOffset();

        int sourceHighlight = -1;
        int assemblyHighlight = viewerAssembly.getIndexForBytecodeOffset(metaClass.getFullyQualifiedName(), bytecodeOffset);

        if (classBytecode != null)
View Full Code Here

    return result;
  }

  private static BytecodeInstruction getInstructionAtIndex(List<BytecodeInstruction> instructions, int index)
  {
    BytecodeInstruction found = null;

    for (BytecodeInstruction instruction : instructions)
    {
      if (instruction.getOffset() == index)
      {
View Full Code Here

    {
      isC2 = true;
    }

    boolean inMethod = true;
    BytecodeInstruction currentInstruction = null;

    for (Tag child : children)
    {
      String name = child.getName();
      Map<String, String> tagAttrs = child.getAttrs();

      switch (name)
      {
      case TAG_BC:
      {
        String bciAttr = tagAttrs.get(ATTR_BCI);
        String codeAttr = tagAttrs.get(ATTR_CODE);

        currentBytecode = Integer.parseInt(bciAttr);
        int code = Integer.parseInt(codeAttr);
        callAttrs.clear();

        // we found a LogCompilation bc tag
        // e.g. "<bc code='182' bci='2'/>"
        // Now check in the current class bytecode
        // that the instruction at offset bci
        // has the same opcode as attribute code
        // if not then this is probably a TieredCompilation
        // context change. (TieredCompilation does not use
        // nested parse tags so have to use this heuristic
        // to check if we are still in the same method.

        if (DEBUG_LOGGING_BYTECODE)
        {
          logger.debug("BC Tag {} {}", currentBytecode, code);
        }

        currentInstruction = getInstructionAtIndex(instructions, currentBytecode);

        if (DEBUG_LOGGING_BYTECODE)
        {
          logger.debug("Instruction at {} is {}", currentBytecode, currentInstruction);
        }

        inMethod = false;

        if (currentInstruction != null)
        {
          int opcodeValue = currentInstruction.getOpcode().getValue();

          if (opcodeValue == code)
          {
            inMethod = true;
          }
        }
      }
        break;
      case TAG_CALL:
      {
        callAttrs.clear();
        callAttrs.putAll(tagAttrs);
      }
        break;
      case TAG_METHOD:
      {
        methodAttrs.clear();
        methodAttrs.putAll(tagAttrs);

        String nameAttr = methodAttrs.get(ATTR_NAME);

        inMethod = false;

        if (nameAttr != null && currentInstruction != null && currentInstruction.hasComment())
        {
          String comment = currentInstruction.getComment();

          inMethod = comment.contains(nameAttr);
        }
      }
        break;
View Full Code Here

TOP

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

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.