Mercurial > hg > truffle
comparison graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ArraySubstitutions.java @ 10652:aca7481e71d1
Create new intrinsic for GuardingPiNode for null check guarding. Fix ArraySubstitutions.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Mon, 08 Jul 2013 16:27:46 +0200 |
parents | 554f67e4ff3f |
children | 3e5b9a4d5986 |
comparison
equal
deleted
inserted
replaced
10651:192a3b3c7292 | 10652:aca7481e71d1 |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 */ | 22 */ |
23 package com.oracle.graal.replacements; | 23 package com.oracle.graal.replacements; |
24 | 24 |
25 import com.oracle.graal.api.code.*; | |
26 import com.oracle.graal.api.meta.*; | |
27 import com.oracle.graal.api.replacements.*; | 25 import com.oracle.graal.api.replacements.*; |
28 import com.oracle.graal.nodes.*; | 26 import com.oracle.graal.nodes.*; |
29 import com.oracle.graal.nodes.java.*; | 27 import com.oracle.graal.nodes.java.*; |
30 | 28 |
31 /** | 29 /** |
34 @ClassSubstitution(java.lang.reflect.Array.class) | 32 @ClassSubstitution(java.lang.reflect.Array.class) |
35 public class ArraySubstitutions { | 33 public class ArraySubstitutions { |
36 | 34 |
37 @MethodSubstitution | 35 @MethodSubstitution |
38 public static Object newInstance(Class<?> componentType, int length) throws NegativeArraySizeException { | 36 public static Object newInstance(Class<?> componentType, int length) throws NegativeArraySizeException { |
39 if (componentType == null) { | 37 return DynamicNewArrayNode.newArray(GuardingPiNode.guardingNonNull(componentType), length); |
40 DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.NullCheckException); | |
41 } | |
42 return DynamicNewArrayNode.newArray(componentType, length); | |
43 } | 38 } |
44 } | 39 } |