use of org.graalvm.compiler.nodes.graphbuilderconf.ClassInitializationPlugin in project graal by oracle.
the class BytecodeParser method genNewMultiArray.
private void genNewMultiArray(int cpi) {
JavaType type = lookupType(cpi, MULTIANEWARRAY);
int rank = getStream().readUByte(bci() + 3);
ValueNode[] dims = new ValueNode[rank];
if (!(type instanceof ResolvedJavaType)) {
for (int i = rank - 1; i >= 0; i--) {
dims[i] = frameState.pop(JavaKind.Int);
}
handleUnresolvedNewMultiArray(type, dims);
return;
}
ResolvedJavaType resolvedType = (ResolvedJavaType) type;
ClassInitializationPlugin classInitializationPlugin = this.graphBuilderConfig.getPlugins().getClassInitializationPlugin();
if (classInitializationPlugin != null && classInitializationPlugin.shouldApply(this, resolvedType)) {
FrameState stateBefore = frameState.create(bci(), getNonIntrinsicAncestor(), false, null, null);
classInitializationPlugin.apply(this, resolvedType, stateBefore);
}
for (int i = rank - 1; i >= 0; i--) {
dims[i] = frameState.pop(JavaKind.Int);
}
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleNewMultiArray(this, resolvedType, dims)) {
return;
}
}
frameState.push(JavaKind.Object, append(createNewMultiArray(resolvedType, dims)));
}
use of org.graalvm.compiler.nodes.graphbuilderconf.ClassInitializationPlugin in project graal by oracle.
the class BytecodeParser method genNewInstance.
void genNewInstance(JavaType type) {
if (!(type instanceof ResolvedJavaType)) {
handleUnresolvedNewInstance(type);
return;
}
ResolvedJavaType resolvedType = (ResolvedJavaType) type;
ClassInitializationPlugin classInitializationPlugin = graphBuilderConfig.getPlugins().getClassInitializationPlugin();
if (!resolvedType.isInitialized() && classInitializationPlugin == null) {
handleUnresolvedNewInstance(type);
return;
}
ResolvedJavaType[] skippedExceptionTypes = this.graphBuilderConfig.getSkippedExceptionTypes();
if (skippedExceptionTypes != null) {
for (ResolvedJavaType exceptionType : skippedExceptionTypes) {
if (exceptionType.isAssignableFrom(resolvedType)) {
append(new DeoptimizeNode(DeoptimizationAction.InvalidateRecompile, RuntimeConstraint));
return;
}
}
}
if (classInitializationPlugin != null && classInitializationPlugin.shouldApply(this, resolvedType)) {
FrameState stateBefore = frameState.create(bci(), getNonIntrinsicAncestor(), false, null, null);
classInitializationPlugin.apply(this, resolvedType, stateBefore);
}
for (NodePlugin plugin : graphBuilderConfig.getPlugins().getNodePlugins()) {
if (plugin.handleNewInstance(this, resolvedType)) {
return;
}
}
frameState.push(JavaKind.Object, append(createNewInstance(resolvedType, true)));
}
use of org.graalvm.compiler.nodes.graphbuilderconf.ClassInitializationPlugin 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.ClassInitializationPlugin 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)));
}
use of org.graalvm.compiler.nodes.graphbuilderconf.ClassInitializationPlugin in project graal by oracle.
the class BytecodeParser method genInvokeStatic.
void genInvokeStatic(JavaMethod target) {
if (callTargetIsResolved(target)) {
ResolvedJavaMethod resolvedTarget = (ResolvedJavaMethod) target;
ResolvedJavaType holder = resolvedTarget.getDeclaringClass();
if (!holder.isInitialized() && ResolveClassBeforeStaticInvoke.getValue(options)) {
handleUnresolvedInvoke(target, InvokeKind.Static);
} else {
ValueNode classInit = null;
ClassInitializationPlugin classInitializationPlugin = graphBuilderConfig.getPlugins().getClassInitializationPlugin();
if (classInitializationPlugin != null && classInitializationPlugin.shouldApply(this, resolvedTarget.getDeclaringClass())) {
FrameState stateBefore = frameState.create(bci(), getNonIntrinsicAncestor(), false, null, null);
classInit = classInitializationPlugin.apply(this, resolvedTarget.getDeclaringClass(), stateBefore);
}
ValueNode[] args = frameState.popArguments(resolvedTarget.getSignature().getParameterCount(false));
Invoke invoke = appendInvoke(InvokeKind.Static, resolvedTarget, args);
if (invoke != null) {
invoke.setClassInit(classInit);
}
}
} else {
handleUnresolvedInvoke(target, InvokeKind.Static);
}
}
Aggregations