Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/GetObjectAddressNode.java @ 5506:56860d3f9f39
More refactorings and renamings in preparation of ci/ri split.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 07 Jun 2012 18:12:01 +0200 |
parents | 452f91ebdb54 |
children | dc71b06d09f8 |
rev | line source |
---|---|
5400
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
1 /* |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
4 * |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
8 * |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
14 * |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
18 * |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
21 * questions. |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
22 */ |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.snippets; |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
24 |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
25 import com.oracle.graal.nodes.*; |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
26 import com.oracle.graal.nodes.spi.*; |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
27 import com.oracle.graal.nodes.type.*; |
5504
452f91ebdb54
Moved RiKind to cri.ri package.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5503
diff
changeset
|
28 import com.oracle.max.cri.ri.*; |
5400
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
29 |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
30 /** |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
31 * Intrinsification for getting the address of an object. |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
32 * The code path(s) between a call to {@link #get(Object)} and all uses |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
33 * of the returned value must be atomic. The only exception to this is |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
34 * if the usage is not an attempt to dereference the value. |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
35 */ |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
36 class GetObjectAddressNode extends FixedWithNextNode implements LIRLowerable { |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
37 @Input private ValueNode object; |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
38 |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
39 public GetObjectAddressNode(ValueNode obj) { |
5503
438ab53efdd0
Renaming CiKind => RiKind.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5400
diff
changeset
|
40 super(StampFactory.forKind(RiKind.Long)); |
5400
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
41 this.object = obj; |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
42 } |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
43 |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
44 @SuppressWarnings("unused") |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
45 @NodeIntrinsic |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
46 public static long get(Object array) { |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
47 throw new UnsupportedOperationException(); |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
48 } |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
49 |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
50 @Override |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
51 public void generate(LIRGeneratorTool gen) { |
5506
56860d3f9f39
More refactorings and renamings in preparation of ci/ri split.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5504
diff
changeset
|
52 RiValue obj = gen.newVariable(gen.target().wordKind); |
5400
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
53 gen.emitMove(gen.operand(object), obj); |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
54 gen.setResult(this, obj); |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
55 } |
028c9ce0fc0f
added support for -G:+CheckcastCounters in checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
diff
changeset
|
56 } |