{
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;