Mercurial > hg > graal-jvmci-8
annotate graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMethod.java @ 13254:42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
author | twisti |
---|---|
date | Thu, 05 Dec 2013 18:13:04 -0800 |
parents | d9c14b1828fc |
children | b16fb0b7479b |
rev | line source |
---|---|
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
5548
8872bc0eebdf
Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5541
diff
changeset
|
23 package com.oracle.graal.hotspot.meta; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
10000
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
25 import static com.oracle.graal.api.meta.MetaUtil.*; |
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
26 |
5507
dc71b06d09f8
Moving classes from cri.ri to api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5321
diff
changeset
|
27 import com.oracle.graal.api.meta.*; |
5060
4ed4295ce15f
Update import statements.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5059
diff
changeset
|
28 import com.oracle.graal.hotspot.*; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 |
5541
b4c406861c33
More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5530
diff
changeset
|
30 public abstract class HotSpotMethod extends CompilerObject implements JavaMethod { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 |
4142
bc8527f3071c
Adjust code base to new level of warnings.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3733
diff
changeset
|
32 private static final long serialVersionUID = 7167491397941960839L; |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
10000
diff
changeset
|
33 protected final String name; |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 |
10000
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
35 /** |
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
36 * Controls whether {@link #toString()} includes the qualified or simple name of the class in |
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
37 * which the method is declared. |
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
38 */ |
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
39 public static final boolean FULLY_QUALIFIED_METHOD_NAME = false; |
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
40 |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
10000
diff
changeset
|
41 protected HotSpotMethod(String name) { |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
10000
diff
changeset
|
42 this.name = name; |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
10000
diff
changeset
|
43 } |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
10000
diff
changeset
|
44 |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 @Override |
6539
2463eb24b644
Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents:
5548
diff
changeset
|
46 public final String getName() { |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 return name; |
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 } |
10000
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
49 |
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
50 @Override |
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
51 public final String toString() { |
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
52 char h = FULLY_QUALIFIED_METHOD_NAME ? 'H' : 'h'; |
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
53 String suffix = this instanceof ResolvedJavaMethod ? "" : ", unresolved"; |
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
54 String fmt = String.format("HotSpotMethod<%%%c.%%n(%%p)%s>", h, suffix); |
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
55 return format(fmt, this); |
d9c14b1828fc
unified toString() for HotSpot implementations of JavaMethod
Doug Simon <doug.simon@oracle.com>
parents:
6539
diff
changeset
|
56 } |
3733
e233f5660da4
Added Java files from Maxine project.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
57 } |