[feat] Modify target OCL.Architecture for FixedArrays into Private
@@ -141,7 +141,7 @@ public class TornadoOpenCLIntrinsicsReplacements extends BasePhase<TornadoHighTi
FixedArrayNode fixedArrayNode;
final ConstantNode newLengthNode = ConstantNode.forInt(size, graph);
ResolvedJavaType elementType = metaAccess.lookupJavaType(elementKind.toJavaClass());
- fixedArrayNode = graph.addWithoutUnique(new FixedArrayNode(OCLArchitecture.globalSpace, elementType, newLengthNode));
+ fixedArrayNode = graph.addWithoutUnique(new FixedArrayNode(OCLArchitecture.privateSpace, elementType, newLengthNode));
newArray.replaceAtUsages(fixedArrayNode);
}
@@ -154,9 +154,11 @@ public class TornadoOpenCLIntrinsicsReplacements extends BasePhase<TornadoHighTi
if (lengthNode.getValue() instanceof PrimitiveConstant) {
final int length = ((PrimitiveConstant) lengthNode.getValue()).asInt();
JavaKind elementKind = getJavaKindFromConstantNode((ConstantNode) callTarget.arguments().get(0));
- final int offset = metaAccess.getArrayBaseOffset(elementKind);;
+ final int offset = metaAccess.getArrayBaseOffset(elementKind);
+ ;
final int size = offset + (elementKind.getByteCount() * length);
- // This phase should come after OCL lowering, therefore OCLLoweringProvider::gpuSnippet should be set
+ // This phase should come after OCL lowering, therefore
+ // OCLLoweringProvider::gpuSnippet should be set
if (OCLLoweringProvider.isGpuSnippet()) {
lowerLocalInvokeNodeNewArray(graph, length, elementKind, newArray);
} else {
@@ -174,11 +176,16 @@ public class TornadoOpenCLIntrinsicsReplacements extends BasePhase<TornadoHighTi
private JavaKind getJavaKindFromConstantNode(ConstantNode signatureNode) {
switch (signatureNode.getValue().toValueString()) {
- case "Class:int": return JavaKind.Int;
- case "Class:long": return JavaKind.Long;
- case "Class:float": return JavaKind.Float;
- case "Class:double": return JavaKind.Double;
- default: unimplemented("Other types not supported yet: " + signatureNode.getValue().toValueString());
+ case "Class:int":
+ return JavaKind.Int;
+ case "Class:long":
+ return JavaKind.Long;
+ case "Class:float":
+ return JavaKind.Float;
+ case "Class:double":
+ return JavaKind.Double;
+ default:
+ unimplemented("Other types not supported yet: " + signatureNode.getValue().toValueString());
}
return null;
}
