Mercurial > hg > truffle
comparison graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/ArrayLengthNode.java @ 11682:976ebd1973d1
The runtime might not always be able to report an array length
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Tue, 17 Sep 2013 10:31:22 -0700 |
parents | ae619d70bf4b |
children | 43bc62c78f77 |
comparison
equal
deleted
inserted
replaced
11681:39f98ffd187f | 11682:976ebd1973d1 |
---|---|
53 } | 53 } |
54 MetaAccessProvider runtime = tool.runtime(); | 54 MetaAccessProvider runtime = tool.runtime(); |
55 if (runtime != null && array().isConstant() && !array().isNullConstant()) { | 55 if (runtime != null && array().isConstant() && !array().isNullConstant()) { |
56 Constant constantValue = array().asConstant(); | 56 Constant constantValue = array().asConstant(); |
57 if (constantValue != null && constantValue.isNonNull()) { | 57 if (constantValue != null && constantValue.isNonNull()) { |
58 return ConstantNode.forInt(runtime.lookupArrayLength(constantValue), graph()); | 58 Integer constantLength = runtime.lookupArrayLength(constantValue); |
59 if (constantLength != null) { | |
60 return ConstantNode.forInt(constantLength, graph()); | |
61 } | |
59 } | 62 } |
60 } | 63 } |
61 return this; | 64 return this; |
62 } | 65 } |
63 | 66 |