use of jdk.vm.ci.meta.JavaKind in project graal by oracle.
the class StandardGraphBuilderPlugins method registerJMHBlackholePlugins.
private static void registerJMHBlackholePlugins(InvocationPlugins plugins, BytecodeProvider bytecodeProvider) {
InvocationPlugin blackholePlugin = new InvocationPlugin() {
@Override
public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver blackhole, ValueNode value) {
blackhole.get();
b.add(new BlackholeNode(value));
return true;
}
};
String[] names = { "org.openjdk.jmh.infra.Blackhole", "org.openjdk.jmh.logic.BlackHole" };
for (String name : names) {
Registration r = new Registration(plugins, name, bytecodeProvider);
for (JavaKind kind : JavaKind.values()) {
if ((kind.isPrimitive() && kind != JavaKind.Void) || kind == JavaKind.Object) {
Class<?> javaClass = kind == JavaKind.Object ? Object.class : kind.toJavaClass();
r.registerOptional2("consume", Receiver.class, javaClass, blackholePlugin);
}
}
r.registerOptional2("consume", Receiver.class, Object[].class, blackholePlugin);
}
}
use of jdk.vm.ci.meta.JavaKind in project graal by oracle.
the class StandardGraphBuilderPlugins method registerBoxingPlugins.
protected static void registerBoxingPlugins(InvocationPlugins plugins) {
for (JavaKind kind : JavaKind.values()) {
if (kind.isPrimitive() && kind != JavaKind.Void) {
new BoxPlugin(kind).register(plugins);
new UnboxPlugin(kind).register(plugins);
}
}
}
use of jdk.vm.ci.meta.JavaKind in project graal by oracle.
the class DefaultJavaLoweringProvider method lowerLoadIndexedNode.
protected void lowerLoadIndexedNode(LoadIndexedNode loadIndexed, LoweringTool tool) {
StructuredGraph graph = loadIndexed.graph();
ValueNode array = loadIndexed.array();
array = createNullCheckedValue(array, loadIndexed, tool);
JavaKind elementKind = loadIndexed.elementKind();
Stamp loadStamp = loadStamp(loadIndexed.stamp(NodeView.DEFAULT), elementKind);
GuardingNode boundsCheck = getBoundsCheck(loadIndexed, array, tool);
AddressNode address = createArrayIndexAddress(graph, array, elementKind, loadIndexed.index(), boundsCheck);
ReadNode memoryRead = graph.add(new ReadNode(address, NamedLocationIdentity.getArrayLocation(elementKind), loadStamp, BarrierType.NONE));
memoryRead.setGuard(boundsCheck);
ValueNode readValue = implicitLoadConvert(graph, elementKind, memoryRead);
loadIndexed.replaceAtUsages(readValue);
graph.replaceFixed(loadIndexed, memoryRead);
}
use of jdk.vm.ci.meta.JavaKind in project graal by oracle.
the class DefaultJavaLoweringProvider method createUnsafeRead.
protected ReadNode createUnsafeRead(StructuredGraph graph, RawLoadNode load, GuardingNode guard) {
boolean compressible = load.accessKind() == JavaKind.Object;
JavaKind readKind = load.accessKind();
Stamp loadStamp = loadStamp(load.stamp(NodeView.DEFAULT), readKind, compressible);
AddressNode address = createUnsafeAddress(graph, load.object(), load.offset());
ReadNode memoryRead = graph.add(new ReadNode(address, load.getLocationIdentity(), loadStamp, BarrierType.NONE));
if (guard == null) {
// An unsafe read must not float otherwise it may float above
// a test guaranteeing the read is safe.
memoryRead.setForceFixed(true);
} else {
memoryRead.setGuard(guard);
}
ValueNode readValue = performBooleanCoercionIfNecessary(implicitLoadConvert(graph, readKind, memoryRead, compressible), readKind);
load.replaceAtUsages(readValue);
return memoryRead;
}
use of jdk.vm.ci.meta.JavaKind in project graal by oracle.
the class DefaultJavaLoweringProvider method lowerUnsafeStoreNode.
protected void lowerUnsafeStoreNode(RawStoreNode store) {
StructuredGraph graph = store.graph();
boolean compressible = store.value().getStackKind() == JavaKind.Object;
JavaKind valueKind = store.accessKind();
ValueNode value = implicitStoreConvert(graph, valueKind, store.value(), compressible);
AddressNode address = createUnsafeAddress(graph, store.object(), store.offset());
WriteNode write = graph.add(new WriteNode(address, store.getLocationIdentity(), value, unsafeStoreBarrierType(store)));
write.setStateAfter(store.stateAfter());
graph.replaceFixedWithFixed(store, write);
}
Aggregations