in core/src/main/java/org/adoptopenjdk/jitwatch/intrinsic/IntrinsicFinder.java [100:183]
public void visitTag(Tag parseTag, IParseDictionary parseDictionary) throws LogParseException
{
String currentMethod = null;
String holder = null;
List<Tag> allChildren = parseTag.getChildren();
for (Tag child : allChildren)
{
String tagName = child.getName();
Map<String, String> attrs = child.getAttributes();
switch (tagName)
{
case TAG_METHOD:
{
currentMethod = attrs.get(ATTR_NAME);
holder = attrs.get(ATTR_HOLDER);
break;
}
// changes member context
case TAG_CALL:
{
String methodID = attrs.get(ATTR_METHOD);
Tag methodTag = parseDictionary.getMethod(methodID);
Map<String, String> methodTagAttributes = methodTag.getAttributes();
currentMethod = methodTagAttributes.get(ATTR_NAME);
holder = methodTagAttributes.get(ATTR_HOLDER);
break;
}
case TAG_INTRINSIC:
{
if (holder != null && currentMethod != null)
{
Tag klassTag = parseDictionary.getKlass(holder);
String intrinsic = child.getAttributes().get(ATTR_ID);
if (klassTag != null)
{
String fqName = klassTag.getAttributes().get(ATTR_NAME).replace(C_SLASH, C_DOT) + C_DOT + currentMethod;
result.put(fqName, intrinsic);
}
}
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;
}
}
}