56 public void register(InvocationPlugin plugin, Type declaringClass, String name, Type... argumentTypes) {
57 if (!config.usePopCountInstruction) {
58 if (name.equals("bitCount")) {
59 assert declaringClass.equals(Integer.class) || declaringClass.equals(Long.class);
60 return;
61 }
62 }
63 super.register(plugin, declaringClass, name, argumentTypes);
64 }
65
66 @Override
67 public void checkNewNodes(GraphBuilderContext b, InvocationPlugin plugin, NodeIterable<Node> newNodes) {
68 for (Node node : newNodes) {
69 if (node instanceof MacroNode) {
70 // MacroNode based plugins can only be used for inlining since they
71 // require a valid bci should they need to replace themselves with
72 // an InvokeNode during lowering.
73 assert plugin.inlineOnly() : String.format("plugin that creates a %s (%s) must return true for inlineOnly(): %s", MacroNode.class.getSimpleName(), node, plugin);
74 }
75 }
76 if (GraalOptions.ImmutableCode.getValue()) {
77 for (Node node : newNodes) {
78 if (node.hasUsages() && node instanceof ConstantNode) {
79 ConstantNode c = (ConstantNode) node;
80 if (c.getStackKind() == JavaKind.Object && AheadOfTimeVerificationPhase.isIllegalObjectConstant(c)) {
81 if (isClass(c)) {
82 // This will be handled later by LoadJavaMirrorWithKlassPhase
83 } else {
84 // Tolerate uses in unused FrameStates
85 if (node.usages().filter((n) -> !(n instanceof FrameState) || n.hasUsages()).isNotEmpty()) {
86 throw new AssertionError("illegal constant node in AOT: " + node);
87 }
88 }
89 }
90 }
91 }
92 }
93 super.checkNewNodes(b, plugin, newNodes);
94 }
95
96 private static boolean isClass(ConstantNode node) {
|
56 public void register(InvocationPlugin plugin, Type declaringClass, String name, Type... argumentTypes) {
57 if (!config.usePopCountInstruction) {
58 if (name.equals("bitCount")) {
59 assert declaringClass.equals(Integer.class) || declaringClass.equals(Long.class);
60 return;
61 }
62 }
63 super.register(plugin, declaringClass, name, argumentTypes);
64 }
65
66 @Override
67 public void checkNewNodes(GraphBuilderContext b, InvocationPlugin plugin, NodeIterable<Node> newNodes) {
68 for (Node node : newNodes) {
69 if (node instanceof MacroNode) {
70 // MacroNode based plugins can only be used for inlining since they
71 // require a valid bci should they need to replace themselves with
72 // an InvokeNode during lowering.
73 assert plugin.inlineOnly() : String.format("plugin that creates a %s (%s) must return true for inlineOnly(): %s", MacroNode.class.getSimpleName(), node, plugin);
74 }
75 }
76 if (GraalOptions.ImmutableCode.getValue(b.getOptions())) {
77 for (Node node : newNodes) {
78 if (node.hasUsages() && node instanceof ConstantNode) {
79 ConstantNode c = (ConstantNode) node;
80 if (c.getStackKind() == JavaKind.Object && AheadOfTimeVerificationPhase.isIllegalObjectConstant(c)) {
81 if (isClass(c)) {
82 // This will be handled later by LoadJavaMirrorWithKlassPhase
83 } else {
84 // Tolerate uses in unused FrameStates
85 if (node.usages().filter((n) -> !(n instanceof FrameState) || n.hasUsages()).isNotEmpty()) {
86 throw new AssertionError("illegal constant node in AOT: " + node);
87 }
88 }
89 }
90 }
91 }
92 }
93 super.checkNewNodes(b, plugin, newNodes);
94 }
95
96 private static boolean isClass(ConstantNode node) {
|