Mercurial > hg > truffle
annotate graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ArraySubstitutions.java @ 21925:64475dbf6aec
Move instantiation checks from methods substitutions to the lowering of DynamicNewInstanceNode and DynamicNewArrayNode, so that Unsafe.allocateInstance and Array.newInstance can be intrinsified to a single node.
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Wed, 10 Jun 2015 17:23:19 -0700 |
parents | 2c6802ac343c |
children |
rev | line source |
---|---|
10027 | 1 /* |
13971 | 2 * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. |
10027 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package com.oracle.graal.replacements; | |
24 | |
25 import com.oracle.graal.nodes.*; | |
26 import com.oracle.graal.nodes.java.*; | |
21556
48c1ebd24120
renamed com.oracle.graal.api[meta|code] modules to com.oracle.jvmci.[meta|code] (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents:
21017
diff
changeset
|
27 import com.oracle.jvmci.meta.*; |
10027 | 28 |
21017
66d45b977e44
Add missing //JaCoCo Exclude directives.
Roland Schatz <roland.schatz@oracle.com>
parents:
20851
diff
changeset
|
29 // JaCoCo Exclude |
66d45b977e44
Add missing //JaCoCo Exclude directives.
Roland Schatz <roland.schatz@oracle.com>
parents:
20851
diff
changeset
|
30 |
10027 | 31 /** |
32 * Substitutions for {@link java.lang.reflect.Array} methods. | |
33 */ | |
34 public class ArraySubstitutions { | |
35 | |
13971 | 36 public static int getLength(Object array) { |
37 if (!array.getClass().isArray()) { | |
19791
14e703edb2ab
use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents:
16382
diff
changeset
|
38 DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint); |
13971 | 39 } |
40 return ArrayLengthNode.arrayLength(array); | |
41 } | |
42 | |
10027 | 43 } |