use of org.graalvm.compiler.nodes.graphbuilderconf.NodePlugin in project graal by oracle.
the class BytecodeParser method genNewObjectArray.
private void genNewObjectArray(int cpi) {
JavaType type = lookupType(cpi, ANEWARRAY);
if (!(type instanceof ResolvedJavaType)) {
ValueNode length = frameState.pop(JavaKind.Int);
handleUnresolvedNewObjectArray(type, length);
return;
}
ResolvedJavaType resolvedType = (ResolvedJavaType) type;
ClassInitializationPlugin classInitializationPlugin = this.graphBuilderConfig.getPlugins().getClassInitializationPlugin();
if (classInitializationPlugin != null && classInitializationPlugin.shouldApply(this, resolvedType.getArrayClass())) {
FrameState stateBefore = frameState.create(bci(), getNonIntrinsicAncestor(), false, null, null);
classInitializationPlugin.apply(this, resolvedType.getArrayClass(), stateBefore);
}
ValueNode length = frameState.pop(JavaKind.Int);
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleNewArray(this, resolvedType, length)) {
return;
}
}
frameState.push(JavaKind.Object, append(createNewArray(resolvedType, length, true)));
}
use of org.graalvm.compiler.nodes.graphbuilderconf.NodePlugin in project graal by oracle.
the class BytecodeParser method genPutField.
private void genPutField(JavaField field, ValueNode value) {
ValueNode receiver = emitExplicitExceptions(frameState.pop(JavaKind.Object));
if (field instanceof ResolvedJavaField) {
ResolvedJavaField resolvedField = (ResolvedJavaField) field;
if (!parsingIntrinsic() && GeneratePIC.getValue(getOptions())) {
graph.recordField(resolvedField);
}
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleStoreField(this, receiver, resolvedField, value)) {
return;
}
}
if (resolvedField.isFinal() && method.isConstructor()) {
finalBarrierRequired = true;
}
genStoreField(receiver, resolvedField, value);
} else {
handleUnresolvedStoreField(field, value, receiver);
}
}
use of org.graalvm.compiler.nodes.graphbuilderconf.NodePlugin in project graal by oracle.
the class BytecodeParser method genInstanceOf.
private void genInstanceOf() {
int cpi = getStream().readCPI();
JavaType type = lookupType(cpi, INSTANCEOF);
ValueNode object = frameState.pop(JavaKind.Object);
if (!(type instanceof ResolvedJavaType)) {
handleUnresolvedInstanceOf(type, object);
return;
}
TypeReference resolvedType = TypeReference.createTrusted(graph.getAssumptions(), (ResolvedJavaType) type);
JavaTypeProfile profile = getProfileForTypeCheck(resolvedType);
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleInstanceOf(this, object, resolvedType.getType(), profile)) {
return;
}
}
LogicNode instanceOfNode = null;
if (profile != null) {
if (profile.getNullSeen().isFalse()) {
object = nullCheckedValue(object);
ResolvedJavaType singleType = profile.asSingleType();
if (singleType != null) {
LogicNode typeCheck = append(createInstanceOf(TypeReference.createExactTrusted(singleType), object, profile));
if (!typeCheck.isTautology()) {
append(new FixedGuardNode(typeCheck, DeoptimizationReason.TypeCheckedInliningViolated, DeoptimizationAction.InvalidateReprofile));
}
instanceOfNode = LogicConstantNode.forBoolean(resolvedType.getType().isAssignableFrom(singleType));
}
}
}
if (instanceOfNode == null) {
instanceOfNode = createInstanceOf(resolvedType, object, null);
}
LogicNode logicNode = genUnique(instanceOfNode);
int next = getStream().nextBCI();
int value = getStream().readUByte(next);
if (next <= currentBlock.endBci && (value == Bytecodes.IFEQ || value == Bytecodes.IFNE)) {
getStream().next();
BciBlock firstSucc = currentBlock.getSuccessor(0);
BciBlock secondSucc = currentBlock.getSuccessor(1);
if (firstSucc != secondSucc) {
boolean negate = value != Bytecodes.IFNE;
if (negate) {
BciBlock tmp = firstSucc;
firstSucc = secondSucc;
secondSucc = tmp;
}
genIf(instanceOfNode, firstSucc, secondSucc, getProfileProbability(negate));
} else {
appendGoto(firstSucc);
}
} else {
// Most frequent for value is IRETURN, followed by ISTORE.
frameState.push(JavaKind.Int, append(genConditional(logicNode)));
}
}
use of org.graalvm.compiler.nodes.graphbuilderconf.NodePlugin in project graal by oracle.
the class BytecodeParser method genLoadIndexed.
private void genLoadIndexed(JavaKind kind) {
ValueNode index = frameState.pop(JavaKind.Int);
ValueNode array = emitExplicitExceptions(frameState.pop(JavaKind.Object), index);
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleLoadIndexed(this, array, index, kind)) {
return;
}
}
frameState.push(kind, append(genLoadIndexed(array, index, kind)));
}
use of org.graalvm.compiler.nodes.graphbuilderconf.NodePlugin in project graal by oracle.
the class BytecodeParser method genGetStatic.
private void genGetStatic(JavaField field) {
ResolvedJavaField resolvedField = resolveStaticFieldAccess(field, null);
if (resolvedField == null) {
return;
}
if (!parsingIntrinsic() && GeneratePIC.getValue(getOptions())) {
graph.recordField(resolvedField);
}
/*
* Javac does not allow use of "$assertionsDisabled" for a field name but Eclipse does, in
* which case a suffix is added to the generated field.
*/
if ((parsingIntrinsic() || graphBuilderConfig.omitAssertions()) && resolvedField.isSynthetic() && resolvedField.getName().startsWith("$assertionsDisabled")) {
frameState.push(field.getJavaKind(), ConstantNode.forBoolean(true, graph));
return;
}
ClassInitializationPlugin classInitializationPlugin = this.graphBuilderConfig.getPlugins().getClassInitializationPlugin();
if (classInitializationPlugin != null && classInitializationPlugin.shouldApply(this, resolvedField.getDeclaringClass())) {
FrameState stateBefore = frameState.create(bci(), getNonIntrinsicAncestor(), false, null, null);
classInitializationPlugin.apply(this, resolvedField.getDeclaringClass(), stateBefore);
}
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleLoadStaticField(this, resolvedField)) {
return;
}
}
frameState.push(field.getJavaKind(), append(genLoadField(null, resolvedField)));
}
Aggregations