in core/src/main/java/org/adoptopenjdk/jitwatch/hotthrow/HotThrowFinder.java [107:241]
public void visitTag(Tag parseTag, IParseDictionary parseDictionary) throws LogParseException
{
String currentMethod = null;
String holder = null;
String currentBCI = null;
Map<String, String> attrs = parseTag.getAttributes();
String methodID = attrs.get(ATTR_METHOD);
Tag methodTag = parseDictionary.getMethod(methodID);
if (methodTag == null)
{
return;
}
Map<String, String> methodTagAttributes = methodTag.getAttributes();
currentMethod = methodTagAttributes.get(ATTR_NAME);
holder = methodTagAttributes.get(ATTR_HOLDER);
List<Tag> allChildren = parseTag.getChildren();
for (Tag child : allChildren)
{
String tagName = child.getName();
attrs = child.getAttributes();
switch (tagName)
{
case TAG_METHOD:
{
currentMethod = attrs.get(ATTR_NAME);
holder = attrs.get(ATTR_HOLDER);
break;
}
case TAG_BC:
{
currentBCI = attrs.get(ATTR_BCI);
break;
}
// changes member context
case TAG_CALL:
{
methodID = attrs.get(ATTR_METHOD);
methodTag = parseDictionary.getMethod(methodID);
methodTagAttributes = methodTag.getAttributes();
currentMethod = methodTagAttributes.get(ATTR_NAME);
holder = methodTagAttributes.get(ATTR_HOLDER);
break;
}
case TAG_HOT_THROW:
{
if (holder != null && currentMethod != null)
{
Tag klassTag = parseDictionary.getKlass(holder);
String preallocated = child.getAttributes().get(ATTR_PREALLOCATED);
if (currentBCI != null && klassTag != null)
{
IMetaMember member = ParseUtil.lookupMember(methodID, parseDictionary, model);
if (member != null)
{
MemberBytecode memberBytecode = member.getMemberBytecode();
if (memberBytecode == null)
{
member.getMetaClass().getClassBytecode(model, new ArrayList<String>());
memberBytecode = member.getMemberBytecode();
}
if (memberBytecode != null)
{
ExceptionTable exceptionTable = memberBytecode.getExceptionTable();
if (exceptionTable != null)
{
int bciValue = Integer.valueOf(currentBCI);
ExceptionTableEntry entry = exceptionTable.getEntryForBCI(bciValue);
if (entry != null)
{
HotThrowResult throwResult = new HotThrowResult(member, bciValue, entry.getType(), "1".equals(preallocated));
result.add(throwResult);
}
}
}
}
}
}
holder = null;
currentMethod = null;
break;
}
case TAG_PHASE:
{
String phaseName = attrs.get(ATTR_NAME);
if (S_PARSE_HIR.equals(phaseName))
{
visitTag(child, parseDictionary);
}
else
{
logger.warn("Don't know how to handle phase {}", phaseName);
}
break;
}
case TAG_PARSE: // nested parse from inlining
{
visitTag(child, parseDictionary);
break;
}
default:
handleOther(child);
break;
}
}
}