Mercurial > hg > graal-compiler
annotate src/share/vm/graal/graalVmIds.hpp @ 7106:4983da9d3fc7
Merge
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Thu, 29 Nov 2012 17:43:48 -0800 |
parents | 120820e30baa |
children | 5aa05e6f9dee |
rev | line source |
---|---|
2516
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
1 /* |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
4 * |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
7 * published by the Free Software Foundation. |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
8 * |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
13 * accompanied this code). |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
14 * |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
18 * |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
a384fac3fd34
Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2502
diff
changeset
|
21 * questions. |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
22 */ |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
23 |
5747
120820e30baa
added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents:
4484
diff
changeset
|
24 #ifndef SHARE_VM_GRAAL_GRAAL_VM_IDS_HPP |
120820e30baa
added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents:
4484
diff
changeset
|
25 #define SHARE_VM_GRAAL_GRAAL_VM_IDS_HPP |
120820e30baa
added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents:
4484
diff
changeset
|
26 |
2663
d7c0775d7e72
added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents:
2516
diff
changeset
|
27 #include "memory/allocation.hpp" |
d7c0775d7e72
added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents:
2516
diff
changeset
|
28 #include "utilities/growableArray.hpp" |
d7c0775d7e72
added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents:
2516
diff
changeset
|
29 #include "oops/oop.hpp" |
d7c0775d7e72
added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents:
2516
diff
changeset
|
30 #include "runtime/handles.hpp" |
d7c0775d7e72
added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents:
2516
diff
changeset
|
31 #include "runtime/thread.hpp" |
d7c0775d7e72
added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents:
2516
diff
changeset
|
32 #include "classfile/javaClasses.hpp" |
d7c0775d7e72
added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents:
2516
diff
changeset
|
33 #include "runtime/jniHandles.hpp" |
2182
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
34 |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
35 class VmIds : public AllStatic { |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
36 |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
37 public: |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
38 // Adds a stub address, and returns the corresponding vmId (which is of type STUB) |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
39 static jlong addStub(address stub); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
40 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
41 // Returns the stub address with the given vmId |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
42 static address getStub(jlong id); |
3632
136ea96eb7f8
Remove the need for VmId (last usage was the constant pool).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3011
diff
changeset
|
43 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
44 // Returns the stub address with the given vmId taken from a java.lang.Long |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
45 static address getStub(oop id); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
46 |
2182
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
47 // Helper function to convert a symbol to a java.lang.String object |
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
48 template <typename T> static T toString(Symbol* symbol, TRAPS); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
49 |
2182
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
50 // Helper function to convert a java.lang.String object to a symbol (this will return NULL if the symbol doesn't exist in the system) |
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
51 static Symbol* toSymbol(jstring string); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
52 |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
53 // Helper function to get the contents of a java.lang.Long |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
54 static jlong getBoxedLong(oop obj); |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
55 }; |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
56 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
57 inline address VmIds::getStub(oop obj) { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
58 return getStub(getBoxedLong(obj)); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
59 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
60 |
2182
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
61 template <> inline Handle VmIds::toString<Handle>(Symbol* symbol, TRAPS) { |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
62 return java_lang_String::create_from_symbol(symbol, THREAD); |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
63 } |
3632
136ea96eb7f8
Remove the need for VmId (last usage was the constant pool).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3011
diff
changeset
|
64 |
2182
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
65 template <> inline oop VmIds::toString<oop>(Symbol* symbol, TRAPS) { |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
66 return toString<Handle>(symbol, THREAD)(); |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
67 } |
3632
136ea96eb7f8
Remove the need for VmId (last usage was the constant pool).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3011
diff
changeset
|
68 |
2182
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
69 template <> inline jstring VmIds::toString<jstring>(Symbol* symbol, TRAPS) { |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
70 return (jstring)JNIHandles::make_local(toString<oop>(symbol, THREAD)); |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
71 } |
3632
136ea96eb7f8
Remove the need for VmId (last usage was the constant pool).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3011
diff
changeset
|
72 |
2182
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
73 template <> inline jobject VmIds::toString<jobject>(Symbol* symbol, TRAPS) { |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
74 return JNIHandles::make_local(toString<oop>(symbol, THREAD)); |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
75 } |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
76 |
2182
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1434
diff
changeset
|
77 inline Symbol* VmIds::toSymbol(jstring string) { |
4484
14a00ee82980
Implement eager type resolving.
Andreas Woess <andreas.woess@jku.at>
parents:
3703
diff
changeset
|
78 return java_lang_String::as_symbol(JNIHandles::resolve(string), Thread::current()); |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
79 } |
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff
changeset
|
80 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
81 inline jlong VmIds::getBoxedLong(oop obj) { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
82 assert(obj->is_oop(true), "cannot unbox null or non-oop"); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
83 return obj->long_field(java_lang_boxing_object::value_offset_in_bytes(T_LONG)); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
84 } |
3703
50a1d38cd7ac
Add newlines at the end of files, otherwise my version of gcc complains
Christian Wimmer <christian.wimmer@oracle.com>
parents:
3634
diff
changeset
|
85 |
5747
120820e30baa
added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents:
4484
diff
changeset
|
86 #endif // SHARE_VM_GRAAL_GRAAL_VM_IDS_HPP |