Mercurial > hg > truffle
annotate src/share/vm/graal/graalCompilerToVM.cpp @ 6363:a73fcf1639fc
HotSpotVMConfig object is now allocated in Java
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 12 Sep 2012 12:45:46 +0200 |
parents | 908e40db1d94 |
children | cc402f4396f4 |
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. |
1410
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1406
diff
changeset
|
22 */ |
b30a2cd5e3a2
Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1406
diff
changeset
|
23 |
2045
9c96c873c42b
Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1942
diff
changeset
|
24 #include "precompiled.hpp" |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
25 #include "runtime/fieldDescriptor.hpp" |
3559
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
26 #include "c1/c1_Runtime1.hpp" |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
27 #include "ci/ciMethodData.hpp" |
3619
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3587
diff
changeset
|
28 #include "compiler/compileBroker.hpp" |
4222
8e2985cdaaa5
Renaming of VMExits and VMEntries part 3.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4220
diff
changeset
|
29 #include "graal/graalCompilerToVM.hpp" |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
30 #include "graal/graalCompiler.hpp" |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
31 #include "graal/graalEnv.hpp" |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
32 #include "graal/graalJavaAccess.hpp" |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
33 #include "graal/graalCodeInstaller.hpp" |
4222
8e2985cdaaa5
Renaming of VMExits and VMEntries part 3.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4220
diff
changeset
|
34 #include "graal/graalVMToCompiler.hpp" |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
35 #include "graal/graalVmIds.hpp" |
2663
d7c0775d7e72
added includes to build without precompiled headers
Christian.Wimmer@Oracle.com
parents:
2659
diff
changeset
|
36 #include "memory/oopFactory.hpp" |
3559
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
37 #include "oops/generateOopMap.hpp" |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
38 |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
39 methodOop getMethodFromHotSpotMethod(jobject hotspot_method) { |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
40 return getMethodFromHotSpotMethod(JNIHandles::resolve(hotspot_method)); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
41 } |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
42 |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
43 methodOop getMethodFromHotSpotMethod(oop hotspot_method) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
44 return (methodOop)HotSpotResolvedJavaMethod::javaMirror(hotspot_method); |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
45 } |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
46 |
4446 | 47 methodDataOop getMethodDataFromHotSpotMethodData(jobject hotspot_method_data) { |
48 return (methodDataOop)HotSpotMethodData::hotspotMirror(JNIHandles::resolve(hotspot_method_data)); | |
49 } | |
50 | |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
51 // public byte[] JavaMethod_code(HotSpotResolvedMethod method); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
52 JNIEXPORT jbyteArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1code(JNIEnv *env, jobject, jobject hotspot_method) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
53 TRACE_graal_3("CompilerToVM::JavaMethod_code"); |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
54 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
55 |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
56 // copy all bytecodes |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
57 int code_size = method->code_size(); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
58 jbyteArray result = env->NewByteArray(code_size); |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
59 env->SetByteArrayRegion(result, 0, code_size, (const jbyte *) method->code_base()); |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
60 |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
61 // iterate over all bytecodes and replace non-Java bytecodes |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
62 if (RewriteBytecodes || RewriteFrequentPairs) { |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
63 BytecodeStream s(method); |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
64 while(!s.is_last_bytecode()) { |
5154
ae72dd38eeb1
bugfix, parallel GC seems stable
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5150
diff
changeset
|
65 s.next(); |
ae72dd38eeb1
bugfix, parallel GC seems stable
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5150
diff
changeset
|
66 Bytecodes::Code code = s.raw_code(); |
ae72dd38eeb1
bugfix, parallel GC seems stable
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5150
diff
changeset
|
67 if (!Bytecodes::is_java_code(code)) { |
ae72dd38eeb1
bugfix, parallel GC seems stable
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5150
diff
changeset
|
68 jbyte original_code = Bytecodes::java_code(code); |
ae72dd38eeb1
bugfix, parallel GC seems stable
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5150
diff
changeset
|
69 env->SetByteArrayRegion(result, s.bci(), 1, &original_code); |
ae72dd38eeb1
bugfix, parallel GC seems stable
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5150
diff
changeset
|
70 } |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
71 } |
5154
ae72dd38eeb1
bugfix, parallel GC seems stable
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5150
diff
changeset
|
72 } |
5150
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
73 |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
74 // replace all breakpoints |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
75 if (method->number_of_breakpoints() > 0) { |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
76 BreakpointInfo* bp = instanceKlass::cast(method->method_holder())->breakpoints(); |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
77 for (; bp != NULL; bp = bp->next()) { |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
78 if (bp->match(method())) { |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
79 jbyte code = bp->orig_bytecode(); |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
80 env->SetByteArrayRegion(result, bp->bci(), 1, &code); |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
81 } |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
82 } |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
83 } |
fdd9dd4508fa
some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5130
diff
changeset
|
84 |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
85 return result; |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
86 } |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
87 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
88 // public String JavaMethod_signature(HotSpotResolvedMethod method); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
89 JNIEXPORT jstring JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1signature(JNIEnv *env, jobject, jobject hotspot_method) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
90 TRACE_graal_3("CompilerToVM::JavaMethod_signature"); |
1422
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
91 VM_ENTRY_MARK |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
92 methodOop method = getMethodFromHotSpotMethod(hotspot_method); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
93 assert(method != NULL && method->signature() != NULL, "signature required"); |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1427
diff
changeset
|
94 return VmIds::toString<jstring>(method->signature(), THREAD); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
95 } |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
96 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
97 // public ExceptionHandler[] JavaMethod_exceptionHandlers(long vmId); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
98 JNIEXPORT jobjectArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1exceptionHandlers(JNIEnv *, jobject, jobject hotspot_method) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
99 TRACE_graal_3("CompilerToVM::JavaMethod_exceptionHandlers"); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
100 VM_ENTRY_MARK |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
101 ResourceMark rm; |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
102 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
6275
957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents:
5839
diff
changeset
|
103 int handler_count = method->exception_table_length(); |
957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents:
5839
diff
changeset
|
104 ExceptionTableElement* handlers = handler_count == 0 ? NULL : method->exception_table_start(); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
105 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
106 instanceKlass::cast(ExceptionHandler::klass())->initialize(CHECK_NULL); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
107 objArrayHandle array = oopFactory::new_objArray(SystemDictionary::ExceptionHandler_klass(), handler_count, CHECK_NULL); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
108 |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
109 for (int i = 0; i < handler_count; i++) { |
6275
957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents:
5839
diff
changeset
|
110 ExceptionTableElement* handler = handlers + i; |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
111 Handle entry = instanceKlass::cast(ExceptionHandler::klass())->allocate_instance(CHECK_NULL); |
6275
957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents:
5839
diff
changeset
|
112 ExceptionHandler::set_startBCI(entry, handler->start_pc); |
957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents:
5839
diff
changeset
|
113 ExceptionHandler::set_endBCI(entry, handler->end_pc); |
957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents:
5839
diff
changeset
|
114 ExceptionHandler::set_handlerBCI(entry, handler->handler_pc); |
957c266d8bc5
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents:
5839
diff
changeset
|
115 int catch_class_index = handler->catch_type_index; |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
116 ExceptionHandler::set_catchTypeCPI(entry, catch_class_index); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
117 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
118 if (catch_class_index == 0) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
119 ExceptionHandler::set_catchType(entry, NULL); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
120 } else { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
121 constantPoolOop cp = instanceKlass::cast(method->method_holder())->constants(); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
122 KlassHandle loading_klass = method->method_holder(); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
123 Handle catch_class = GraalCompiler::get_JavaType(cp, catch_class_index, loading_klass, CHECK_NULL); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
124 if (catch_class->klass() == HotSpotResolvedJavaType::klass() && java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(catch_class)) == SystemDictionary::Throwable_klass()) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
125 ExceptionHandler::set_catchType(entry, NULL); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
126 ExceptionHandler::set_catchTypeCPI(entry, 0); |
3699
67e92894d065
Set catch all to true if the caught class is java.lang.Throwable.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3688
diff
changeset
|
127 } else { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
128 ExceptionHandler::set_catchType(entry, catch_class()); |
3699
67e92894d065
Set catch all to true if the caught class is java.lang.Throwable.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3688
diff
changeset
|
129 } |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
130 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
131 array->obj_at_put(i, entry()); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
132 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
133 |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
134 return (jobjectArray) JNIHandles::make_local(array()); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
135 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
136 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
137 // public boolean JavaMethod_hasBalancedMonitors(long vmId); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
138 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1hasBalancedMonitors(JNIEnv *, jobject, jobject hotspot_method) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
139 TRACE_graal_3("CompilerToVM::JavaMethod_hasBalancedMonitors"); |
3559
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
140 |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
141 VM_ENTRY_MARK; |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
142 |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
143 // Analyze the method to see if monitors are used properly. |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
144 methodHandle method(THREAD, getMethodFromHotSpotMethod(hotspot_method)); |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
145 assert(method->has_monitor_bytecodes(), "should have checked this"); |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
146 |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
147 // Check to see if a previous compilation computed the monitor-matching analysis. |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
148 if (method->guaranteed_monitor_matching()) { |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
149 return true; |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
150 } |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
151 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
152 { |
3559
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
153 EXCEPTION_MARK; |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
154 ResourceMark rm(THREAD); |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
155 GeneratePairingInfo gpi(method); |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
156 gpi.compute_map(CATCH); |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
157 if (!gpi.monitor_safe()) { |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
158 return false; |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
159 } |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
160 method->set_guaranteed_monitor_matching(); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
161 } |
3559
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
162 return true; |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
163 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
164 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
165 // public JavaMethod getJavaMethod(java.lang.reflect.Method reflectionMethod); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
166 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getJavaMethod(JNIEnv *, jobject, jobject reflection_method_handle) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
167 TRACE_graal_3("CompilerToVM::getJavaMethod"); |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3552
diff
changeset
|
168 VM_ENTRY_MARK; |
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3552
diff
changeset
|
169 oop reflection_method = JNIHandles::resolve(reflection_method_handle); |
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3552
diff
changeset
|
170 oop reflection_holder = java_lang_reflect_Method::clazz(reflection_method); |
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3552
diff
changeset
|
171 int slot = java_lang_reflect_Method::slot(reflection_method); |
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3552
diff
changeset
|
172 klassOop holder = java_lang_Class::as_klassOop(reflection_holder); |
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3552
diff
changeset
|
173 methodOop method = instanceKlass::cast(holder)->method_with_idnum(slot); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
174 Handle ret = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK_NULL); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
175 return JNIHandles::make_local(THREAD, ret()); |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3552
diff
changeset
|
176 } |
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3552
diff
changeset
|
177 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
178 // public boolean JavaMethod_uniqueConcreteMethod(long vmId); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
179 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1uniqueConcreteMethod(JNIEnv *, jobject, jobject hotspot_method) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
180 TRACE_graal_3("CompilerToVM::JavaMethod_uniqueConcreteMethod"); |
3559
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
181 |
2050
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
182 VM_ENTRY_MARK; |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
183 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
184 KlassHandle holder = method->method_holder(); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
185 if (holder->is_interface()) { |
2050
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
186 // Cannot trust interfaces. Because of: |
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
187 // interface I { void foo(); } |
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
188 // class A { public void foo() {} } |
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
189 // class B extends A implements I { } |
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
190 // class C extends B { public void foo() { } } |
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
191 // class D extends B { } |
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
192 // Would lead to identify C.foo() as the unique concrete method for I.foo() without seeing A.foo(). |
5476
13327e512621
fix : GCC 4.7 considers conversion of false to a jobject an error
Gilles Duboscq <duboscq@ssw.jku.at>
parents:
5466
diff
changeset
|
193 return NULL; |
2049
7e09ea4a8f36
Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2048
diff
changeset
|
194 } |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
195 methodHandle unique_concrete; |
2050
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
196 { |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
197 ResourceMark rm; |
2050
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
198 MutexLocker locker(Compile_lock); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
199 unique_concrete = Dependencies::find_unique_concrete_method(holder(), method()); |
2050
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
200 } |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
201 if (unique_concrete.is_null()) { |
2049
7e09ea4a8f36
Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2048
diff
changeset
|
202 return NULL; |
3559
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
203 } else { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
204 Handle method_resolved = GraalCompiler::createHotSpotResolvedJavaMethod(unique_concrete, CHECK_NULL); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
205 return JNIHandles::make_local(THREAD, method_resolved()); |
2049
7e09ea4a8f36
Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2048
diff
changeset
|
206 } |
7e09ea4a8f36
Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2048
diff
changeset
|
207 } |
7e09ea4a8f36
Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2048
diff
changeset
|
208 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
209 // public native int JavaMethod_invocationCount(long vmId); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
210 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1invocationCount(JNIEnv *, jobject, jobject hotspot_method) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
211 TRACE_graal_3("CompilerToVM::JavaMethod_invocationCount"); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
212 return getMethodFromHotSpotMethod(hotspot_method)->invocation_count(); |
2926
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2901
diff
changeset
|
213 } |
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2901
diff
changeset
|
214 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
215 // public native HotSpotMethodData JavaMethod_methodData(HotSpotResolvedJavaMethod method); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
216 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1methodData(JNIEnv *, jobject, jobject hotspot_method) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
217 TRACE_graal_3("CompilerToVM::JavaMethod_methodData"); |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
218 VM_ENTRY_MARK; |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
219 |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
220 methodDataHandle method_data = getMethodFromHotSpotMethod(hotspot_method)->method_data(); |
4443
6fb167f79df6
fixed methodDataOop access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4442
diff
changeset
|
221 if(method_data.is_null()) { |
6fb167f79df6
fixed methodDataOop access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4442
diff
changeset
|
222 return NULL; |
6fb167f79df6
fixed methodDataOop access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4442
diff
changeset
|
223 } else { |
4475
f400f9554f09
fixed windows build, filtered methodDataOop for reflection
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4461
diff
changeset
|
224 Handle graalMethodData = GraalCompiler::createHotSpotMethodData(method_data, CHECK_NULL); |
4443
6fb167f79df6
fixed methodDataOop access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4442
diff
changeset
|
225 return JNIHandles::make_local(THREAD, graalMethodData()); |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
226 } |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
227 } |
3487
b9ed7199f6fb
special handling for VirtualObject(Field) in IdentifyBlocksPhase (don't schedule out of loops), better toString for HotSpotMethod/Field
Lukas Stadler <lukas.stadler@jku.at>
parents:
3465
diff
changeset
|
228 |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
229 // ------------------------------------------------------------------ |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
230 // Adjust a CounterData count to be commensurate with |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
231 // interpreter_invocation_count. If the MDO exists for |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
232 // only 25% of the time the method exists, then the |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
233 // counts in the MDO should be scaled by 4X, so that |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
234 // they can be usefully and stably compared against the |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
235 // invocation counts in methods. |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
236 int scale_count(methodDataOop method_data, int count) { |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
237 if (count > 0) { |
3566
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
238 int counter_life; |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
239 int method_life = method_data->method()->interpreter_invocation_count(); |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
240 int current_mileage = methodDataOopDesc::mileage_of(method_data->method()); |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
241 int creation_mileage = method_data->creation_mileage(); |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
242 counter_life = current_mileage - creation_mileage; |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
243 |
3566
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
244 // counter_life due to backedge_counter could be > method_life |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
245 if (counter_life > method_life) |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
246 counter_life = method_life; |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
247 if (0 < counter_life && counter_life <= method_life) { |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
248 count = (int)((double)count * method_life / counter_life + 0.5); |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
249 count = (count > 0) ? count : 1; |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
250 } |
3487
b9ed7199f6fb
special handling for VirtualObject(Field) in IdentifyBlocksPhase (don't schedule out of loops), better toString for HotSpotMethod/Field
Lukas Stadler <lukas.stadler@jku.at>
parents:
3465
diff
changeset
|
251 } |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
252 return count; |
3055
fecdb0a65fb2
runtime profiles exceptions at the call site
Lukas Stadler <lukas.stadler@jku.at>
parents:
3020
diff
changeset
|
253 } |
fecdb0a65fb2
runtime profiles exceptions at the call site
Lukas Stadler <lukas.stadler@jku.at>
parents:
3020
diff
changeset
|
254 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
255 // public native boolean JavaMethod_hasCompiledCode(HotSpotResolvedJavaMethod method); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
256 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1hasCompiledCode(JNIEnv *, jobject, jobject hotspot_method) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
257 TRACE_graal_3("CompilerToVM::JavaMethod_hasCompiledCode"); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
258 return getMethodFromHotSpotMethod(hotspot_method)->has_compiled_code(); |
3465
8cd198d7cbc1
When a method that has been compiled before is considered for inlining, use its compiled (native) code size for size checks. This avoids inlining compiled methods that already contain many other inlined methods, reducing generated code size and usually execution time as well. Also, add GraalMetrics bookkeeping for inlining.
Peter Hofer <peter.hofer@jku.at>
parents:
3211
diff
changeset
|
259 } |
8cd198d7cbc1
When a method that has been compiled before is considered for inlining, use its compiled (native) code size for size checks. This avoids inlining compiled methods that already contain many other inlined methods, reducing generated code size and usually execution time as well. Also, add GraalMetrics bookkeeping for inlining.
Peter Hofer <peter.hofer@jku.at>
parents:
3211
diff
changeset
|
260 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
261 // public native int JavaMethod_getCompiledCodeSize(HotSpotResolvedJavaMethod method); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
262 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1getCompiledCodeSize(JNIEnv *env, jobject, jobject hotspot_method) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
263 TRACE_graal_3("CompilerToVM::JavaMethod_getCompiledCodeSize"); |
4528
e6e14d25e608
added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4475
diff
changeset
|
264 nmethod* code = getMethodFromHotSpotMethod(hotspot_method)->code(); |
e6e14d25e608
added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4475
diff
changeset
|
265 return code == NULL ? 0 : code->insts_size(); |
e6e14d25e608
added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4475
diff
changeset
|
266 } |
e6e14d25e608
added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4475
diff
changeset
|
267 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
268 // public JavaType Signature_lookupType(String returnType, HotSpotResolvedJavaType accessingClass); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
269 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_Signature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass, jboolean eagerResolve) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
270 TRACE_graal_3("CompilerToVM::Signature_lookupType"); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
271 VM_ENTRY_MARK; |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
272 ResourceMark rm; |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
273 |
2182
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2061
diff
changeset
|
274 Symbol* nameSymbol = VmIds::toSymbol(jname); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
275 Handle name = JNIHandles::resolve(jname); |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
276 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
277 oop result; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
278 if (nameSymbol == vmSymbols::int_signature()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
279 result = VMToCompiler::createPrimitiveJavaType((int) T_INT, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
280 } else if (nameSymbol == vmSymbols::long_signature()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
281 result = VMToCompiler::createPrimitiveJavaType((int) T_LONG, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
282 } else if (nameSymbol == vmSymbols::bool_signature()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
283 result = VMToCompiler::createPrimitiveJavaType((int) T_BOOLEAN, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
284 } else if (nameSymbol == vmSymbols::char_signature()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
285 result = VMToCompiler::createPrimitiveJavaType((int) T_CHAR, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
286 } else if (nameSymbol == vmSymbols::short_signature()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
287 result = VMToCompiler::createPrimitiveJavaType((int) T_SHORT, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
288 } else if (nameSymbol == vmSymbols::byte_signature()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
289 result = VMToCompiler::createPrimitiveJavaType((int) T_BYTE, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
290 } else if (nameSymbol == vmSymbols::double_signature()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
291 result = VMToCompiler::createPrimitiveJavaType((int) T_DOUBLE, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
292 } else if (nameSymbol == vmSymbols::float_signature()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
293 result = VMToCompiler::createPrimitiveJavaType((int) T_FLOAT, THREAD); |
6325
2691e320d37c
Handle void type when resolving a signature type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
6277
diff
changeset
|
294 } else if (nameSymbol == vmSymbols::void_signature()) { |
2691e320d37c
Handle void type when resolving a signature type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
6277
diff
changeset
|
295 result = VMToCompiler::createPrimitiveJavaType((int) T_VOID, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
296 } else { |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
297 klassOop resolved_type = NULL; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
298 // if the name isn't in the symbol table then the class isn't loaded anyway... |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
299 if (nameSymbol != NULL) { |
1942
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1941
diff
changeset
|
300 Handle classloader; |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1941
diff
changeset
|
301 Handle protectionDomain; |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1941
diff
changeset
|
302 if (JNIHandles::resolve(accessingClass) != NULL) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
303 classloader = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(accessingClass))->klass_part()->class_loader(); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
304 protectionDomain = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(accessingClass))->klass_part()->protection_domain(); |
1942
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1941
diff
changeset
|
305 } |
4484
14a00ee82980
Implement eager type resolving.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
306 if (eagerResolve) { |
14a00ee82980
Implement eager type resolving.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
307 resolved_type = SystemDictionary::resolve_or_null(nameSymbol, classloader, protectionDomain, THREAD); |
14a00ee82980
Implement eager type resolving.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
308 } else { |
4533
818757f088d3
Fixed signature lookup (unresolved arguments remained unresolved all the time).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4484
diff
changeset
|
309 if (FieldType::is_obj(nameSymbol)) { |
818757f088d3
Fixed signature lookup (unresolved arguments remained unresolved all the time).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4484
diff
changeset
|
310 ResourceMark rm(THREAD); |
818757f088d3
Fixed signature lookup (unresolved arguments remained unresolved all the time).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4484
diff
changeset
|
311 // Ignore wrapping L and ;. |
818757f088d3
Fixed signature lookup (unresolved arguments remained unresolved all the time).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4484
diff
changeset
|
312 TempNewSymbol tmp_name = SymbolTable::new_symbol(nameSymbol->as_C_string() + 1, |
818757f088d3
Fixed signature lookup (unresolved arguments remained unresolved all the time).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4484
diff
changeset
|
313 nameSymbol->utf8_length() - 2, CHECK_NULL); |
818757f088d3
Fixed signature lookup (unresolved arguments remained unresolved all the time).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4484
diff
changeset
|
314 resolved_type = SystemDictionary::find_instance_or_array_klass(tmp_name, classloader, protectionDomain, THREAD); |
818757f088d3
Fixed signature lookup (unresolved arguments remained unresolved all the time).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4484
diff
changeset
|
315 } else { |
818757f088d3
Fixed signature lookup (unresolved arguments remained unresolved all the time).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4484
diff
changeset
|
316 resolved_type = SystemDictionary::find_instance_or_array_klass(nameSymbol, classloader, protectionDomain, THREAD); |
818757f088d3
Fixed signature lookup (unresolved arguments remained unresolved all the time).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4484
diff
changeset
|
317 } |
4484
14a00ee82980
Implement eager type resolving.
Andreas Woess <andreas.woess@jku.at>
parents:
4475
diff
changeset
|
318 } |
1481
fe69dec9a1ed
Added support for CompileTheWorld.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1479
diff
changeset
|
319 if (HAS_PENDING_EXCEPTION) { |
fe69dec9a1ed
Added support for CompileTheWorld.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1479
diff
changeset
|
320 CLEAR_PENDING_EXCEPTION; |
fe69dec9a1ed
Added support for CompileTheWorld.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1479
diff
changeset
|
321 resolved_type = NULL; |
fe69dec9a1ed
Added support for CompileTheWorld.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1479
diff
changeset
|
322 } |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
323 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
324 if (resolved_type != NULL) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
325 Handle type = GraalCompiler::createHotSpotResolvedJavaType(resolved_type, name, CHECK_NULL); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
326 result = type(); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
327 } else { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
328 Handle type = VMToCompiler::createJavaType(name, THREAD); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
329 result = type(); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
330 } |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
331 } |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
332 |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
333 return JNIHandles::make_local(THREAD, result); |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
334 } |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
335 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
336 // public Object ConstantPool_lookupConstant(HotSpotResolvedJavaType type, int cpi); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
337 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupConstant(JNIEnv *env, jobject, jobject type, jint index) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
338 TRACE_graal_3("CompilerToVM::ConstantPool_lookupConstant"); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
339 VM_ENTRY_MARK; |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
340 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
341 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
342 |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
343 oop result = NULL; |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
344 constantTag tag = cp->tag_at(index); |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
345 if (tag.is_int()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
346 result = VMToCompiler::createConstant(Kind::Int(), cp->int_at(index), CHECK_0); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
347 } else if (tag.is_long()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
348 result = VMToCompiler::createConstant(Kind::Long(), cp->long_at(index), CHECK_0); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
349 } else if (tag.is_float()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
350 result = VMToCompiler::createConstantFloat(cp->float_at(index), CHECK_0); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
351 } else if (tag.is_double()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
352 result = VMToCompiler::createConstantDouble(cp->double_at(index), CHECK_0); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
353 } else if (tag.is_string() || tag.is_unresolved_string()) { |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
354 oop string = NULL; |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
355 if (cp->is_pseudo_string_at(index)) { |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
356 string = cp->pseudo_string_at(index); |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
357 } else { |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
358 string = cp->string_at(index, THREAD); |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
359 if (HAS_PENDING_EXCEPTION) { |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
360 CLEAR_PENDING_EXCEPTION; |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
361 // TODO: Gracefully exit compilation. |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
362 fatal("out of memory during compilation!"); |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
363 return NULL; |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
364 } |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
365 } |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
366 result = VMToCompiler::createConstantObject(string, CHECK_0); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
367 } else if (tag.is_klass() || tag.is_unresolved_klass()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
368 Handle type = GraalCompiler::get_JavaType(cp, index, cp->pool_holder(), CHECK_NULL); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
369 result = type(); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
370 } else if (tag.is_object()) { |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
371 oop obj = cp->object_at(index); |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
372 assert(obj->is_instance(), "must be an instance"); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
373 result = VMToCompiler::createConstantObject(obj, CHECK_NULL); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
374 } else { |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
375 ShouldNotReachHere(); |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
376 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
377 |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
378 return JNIHandles::make_local(THREAD, result); |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
379 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
380 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
381 // public JavaMethod ConstantPool_lookupMethod(long vmId, int cpi, byte byteCode); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
382 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupMethod(JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
383 TRACE_graal_3("CompilerToVM::ConstantPool_lookupMethod"); |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
384 VM_ENTRY_MARK; |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
385 index = GraalCompiler::to_cp_index_u2(index); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
386 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3669
diff
changeset
|
387 instanceKlassHandle pool_holder(cp->pool_holder()); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
388 |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
389 Bytecodes::Code bc = (Bytecodes::Code) (((int) byteCode) & 0xFF); |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3669
diff
changeset
|
390 methodHandle method = GraalEnv::get_method_by_index(cp, index, bc, pool_holder); |
3648
81ad8ab1f9fe
Remove ci usage on method lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3647
diff
changeset
|
391 if (!method.is_null()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
392 Handle ret = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK_NULL); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
393 return JNIHandles::make_local(THREAD, ret()); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
394 } else { |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
395 // Get the method's name and signature. |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
396 Handle name = VmIds::toString<Handle>(cp->name_ref_at(index), CHECK_NULL); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
397 Handle signature = VmIds::toString<Handle>(cp->signature_ref_at(index), CHECK_NULL); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
398 int holder_index = cp->klass_ref_index_at(index); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
399 Handle type = GraalCompiler::get_JavaType(cp, holder_index, cp->pool_holder(), CHECK_NULL); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
400 return JNIHandles::make_local(THREAD, VMToCompiler::createJavaMethod(name, signature, type, THREAD)); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
401 } |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
402 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
403 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
404 // public JavaType ConstantPool_lookupType(long vmId, int cpi); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
405 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupType(JNIEnv *env, jobject, jobject type, jint index) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
406 TRACE_graal_3("CompilerToVM::ConstantPool_lookupType"); |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
407 VM_ENTRY_MARK; |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
408 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
409 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
410 Handle result = GraalCompiler::get_JavaType(cp, index, cp->pool_holder(), CHECK_NULL); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
411 return JNIHandles::make_local(THREAD, result()); |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
412 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
413 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
414 // public void ConstantPool_loadReferencedType(long vmId, int cpi); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
415 JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1loadReferencedType(JNIEnv *env, jobject, jobject type, jint index, jbyte op) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
416 TRACE_graal_3("CompilerToVM::ConstantPool_loadReferencedType"); |
3577
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
417 VM_ENTRY_MARK; |
3632
136ea96eb7f8
Remove the need for VmId (last usage was the constant pool).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3622
diff
changeset
|
418 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
419 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); |
3577
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
420 int byteCode = (op & 0xFF); |
4316
b4b16e4e043f
Fix eager resolving for class constants
Peter Hofer <peter.hofer@jku.at>
parents:
4297
diff
changeset
|
421 if (byteCode != Bytecodes::_checkcast && byteCode != Bytecodes::_instanceof && byteCode != Bytecodes::_new && byteCode != Bytecodes::_anewarray |
b4b16e4e043f
Fix eager resolving for class constants
Peter Hofer <peter.hofer@jku.at>
parents:
4297
diff
changeset
|
422 && byteCode != Bytecodes::_multianewarray && byteCode != Bytecodes::_ldc && byteCode != Bytecodes::_ldc_w && byteCode != Bytecodes::_ldc2_w) |
b4b16e4e043f
Fix eager resolving for class constants
Peter Hofer <peter.hofer@jku.at>
parents:
4297
diff
changeset
|
423 { |
3577
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
424 index = cp->remap_instruction_operand_from_cache(GraalCompiler::to_cp_index_u2(index)); |
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
425 } |
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
426 constantTag tag = cp->tag_at(index); |
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
427 if (tag.is_field_or_method()) { |
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
428 index = cp->uncached_klass_ref_index_at(index); |
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
429 tag = cp->tag_at(index); |
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
430 } |
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
431 |
4176
a428df0139f3
Initialize resolved as well as unresolved classes in the native implementation of HotSpotConstantPool.loadReferencedType()
Peter Hofer <peter.hofer@jku.at>
parents:
4139
diff
changeset
|
432 if (tag.is_unresolved_klass() || tag.is_klass()) { |
3577
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
433 klassOop klass = cp->klass_at(index, CHECK); |
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
434 if (klass->klass_part()->oop_is_instance()) { |
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
435 instanceKlass::cast(klass)->initialize(CHECK); |
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
436 } |
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
437 } |
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
438 } |
96c40b338c1a
Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3572
diff
changeset
|
439 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
440 // public JavaField ConstantPool_lookupField(long vmId, int cpi); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
441 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupField(JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte byteCode) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
442 TRACE_graal_3("CompilerToVM::ConstantPool_lookupField"); |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
443 VM_ENTRY_MARK; |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
444 ResourceMark rm; |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
445 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
446 index = GraalCompiler::to_cp_index_u2(index); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
447 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(constantPoolHolder)))->constants(); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
448 |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
449 int nt_index = cp->name_and_type_ref_index_at(index); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
450 int sig_index = cp->signature_ref_index_at(nt_index); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
451 Symbol* signature = cp->symbol_at(sig_index); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
452 int name_index = cp->name_ref_index_at(nt_index); |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
453 Symbol* name = cp->symbol_at(name_index); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
454 int holder_index = cp->klass_ref_index_at(index); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
455 Handle holder = GraalCompiler::get_JavaType(cp, holder_index, cp->pool_holder(), CHECK_NULL); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
456 instanceKlassHandle holder_klass; |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
457 |
1452
9b22e3e5df8e
Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1449
diff
changeset
|
458 Bytecodes::Code code = (Bytecodes::Code)(((int) byteCode) & 0xFF); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
459 int offset = -1; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
460 AccessFlags flags; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
461 BasicType basic_type; |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
462 if (holder->klass() == SystemDictionary::HotSpotResolvedJavaType_klass()) { |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
463 FieldAccessInfo result; |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
464 LinkResolver::resolve_field(result, cp, index, |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
465 Bytecodes::java_code(code), |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
466 true, false, Thread::current()); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
467 if (HAS_PENDING_EXCEPTION) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
468 CLEAR_PENDING_EXCEPTION; |
3655
2a0cb564e470
Do not use result when resolve_field throws an exception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
469 } else { |
2a0cb564e470
Do not use result when resolve_field throws an exception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
470 offset = result.field_offset(); |
2a0cb564e470
Do not use result when resolve_field throws an exception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
471 flags = result.access_flags(); |
2a0cb564e470
Do not use result when resolve_field throws an exception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
472 holder_klass = result.klass()->as_klassOop(); |
2a0cb564e470
Do not use result when resolve_field throws an exception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
473 basic_type = result.field_type(); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
474 holder = GraalCompiler::get_JavaType(holder_klass, CHECK_NULL); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
475 } |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
476 } |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
477 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
478 Handle type = GraalCompiler::get_JavaTypeFromSignature(cp, sig_index, cp->pool_holder(), CHECK_NULL); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
479 Handle field_handle = GraalCompiler::get_JavaField(offset, flags.as_int(), name, holder, type, code, THREAD); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
480 |
1465
2c754f3a2722
Inlining of static final field values. Java mirror instead of VmID. Support for PrintMetrics option.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1463
diff
changeset
|
481 return JNIHandles::make_local(THREAD, field_handle()); |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
482 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
483 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
484 // public JavaMethod JavaType_resolveMethodImpl(HotSpotResolvedJavaType klass, String name, String signature); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
485 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_3resolveMethodImpl(JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
486 TRACE_graal_3("CompilerToVM::JavaType_resolveMethodImpl"); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
487 VM_ENTRY_MARK; |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
488 |
1942
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1941
diff
changeset
|
489 assert(JNIHandles::resolve(resolved_type) != NULL, ""); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
490 klassOop klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(resolved_type)); |
2182
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2061
diff
changeset
|
491 Symbol* name_symbol = VmIds::toSymbol(name); |
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2061
diff
changeset
|
492 Symbol* signature_symbol = VmIds::toSymbol(signature); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
493 methodHandle method = klass->klass_part()->lookup_method(name_symbol, signature_symbol); |
1477
30e1f67703da
Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1470
diff
changeset
|
494 if (method == NULL) { |
2901
d577d07cedec
Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2891
diff
changeset
|
495 if (TraceGraal >= 3) { |
1477
30e1f67703da
Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1470
diff
changeset
|
496 ResourceMark rm; |
2492
4e5515d09314
Fixed merge issues.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2293
diff
changeset
|
497 tty->print_cr("Could not resolve method %s %s on klass %s", name_symbol->as_C_string(), signature_symbol->as_C_string(), klass->klass_part()->name()->as_C_string()); |
1477
30e1f67703da
Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1470
diff
changeset
|
498 } |
30e1f67703da
Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1470
diff
changeset
|
499 return NULL; |
30e1f67703da
Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1470
diff
changeset
|
500 } |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
501 Handle ret = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK_NULL); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
502 return JNIHandles::make_local(THREAD, ret()); |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
503 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
504 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
505 // public boolean JavaType_isSubtypeOf(HotSpotResolvedJavaType klass, JavaType other); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
506 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_2isSubtypeOf(JNIEnv *, jobject, jobject klass, jobject jother) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
507 TRACE_graal_3("CompilerToVM::JavaType_isSubtypeOf"); |
4635
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4551
diff
changeset
|
508 VM_ENTRY_MARK; |
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4551
diff
changeset
|
509 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
510 oop other = JNIHandles::resolve(jother); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
511 assert(other->is_a(HotSpotResolvedJavaType::klass()), "resolved hotspot type expected"); |
1942
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1941
diff
changeset
|
512 assert(JNIHandles::resolve(klass) != NULL, ""); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
513 klassOop thisKlass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
514 klassOop otherKlass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(other)); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
515 if (thisKlass->klass_part()->oop_is_instance_slow()) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
516 return instanceKlass::cast(thisKlass)->is_subtype_of(otherKlass); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
517 } else if (thisKlass->klass_part()->oop_is_array()) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
518 return arrayKlass::cast(thisKlass)->is_subtype_of(otherKlass); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
519 } else { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
520 fatal("unexpected class type"); |
2215
999f8086cc4f
More changes to make it compile and work on win64.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2182
diff
changeset
|
521 return false; |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
522 } |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
523 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
524 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
525 // public JavaType JavaType_leastCommonAncestor(HotSpotResolvedJavaType thisType, HotSpotResolvedJavaType otherType); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
526 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_2leastCommonAncestor(JNIEnv *, jobject, jobject this_type, jobject other_type) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
527 TRACE_graal_3("CompilerToVM::JavaType_leastCommonAncestor"); |
4635
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4551
diff
changeset
|
528 VM_ENTRY_MARK; |
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4551
diff
changeset
|
529 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
530 Klass* this_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(this_type))->klass_part(); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
531 Klass* other_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(other_type))->klass_part(); |
4635
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4551
diff
changeset
|
532 Klass* lca = this_klass->LCA(other_klass); |
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4551
diff
changeset
|
533 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
534 return JNIHandles::make_local(GraalCompiler::get_JavaType(lca, THREAD)()); |
4635
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4551
diff
changeset
|
535 } |
f35c183f33ce
fixed checkcast when inlining more than one method
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4551
diff
changeset
|
536 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
537 // public JavaType JavaType_componentType(HotSpotResolvedType klass); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
538 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1componentType(JNIEnv *, jobject, jobject klass) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
539 TRACE_graal_3("CompilerToVM::JavaType_componentType"); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
540 VM_ENTRY_MARK; |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
541 KlassHandle array_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); |
3697
872e949a0827
fix componentType for the primitive array case
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
3688
diff
changeset
|
542 if(array_klass->oop_is_typeArray()) { |
872e949a0827
fix componentType for the primitive array case
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
3688
diff
changeset
|
543 BasicType t = typeArrayKlass::cast(array_klass())->element_type(); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
544 oop primitive_type = VMToCompiler::createPrimitiveJavaType((int) t, CHECK_NULL); |
3697
872e949a0827
fix componentType for the primitive array case
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
3688
diff
changeset
|
545 return JNIHandles::make_local(primitive_type); |
872e949a0827
fix componentType for the primitive array case
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
3688
diff
changeset
|
546 } |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
547 assert(array_klass->oop_is_objArray(), "just checking"); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
548 klassOop element_type = objArrayKlass::cast(array_klass())->element_klass(); |
1942
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1941
diff
changeset
|
549 assert(JNIHandles::resolve(klass) != NULL, ""); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
550 return JNIHandles::make_local(GraalCompiler::get_JavaType(element_type, THREAD)()); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
551 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
552 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
553 // public JavaType JavaType_superType(HotSpotResolvedType klass); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
554 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1superType(JNIEnv *, jobject, jobject klass) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
555 TRACE_graal_3("CompilerToVM::JavaType_superType"); |
2499
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
556 VM_ENTRY_MARK; |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
557 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
558 klassOop k; |
2499
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
559 |
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
560 if (klass_handle->oop_is_array()) { |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
561 k = SystemDictionary::Object_klass(); |
2499
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
562 } else { |
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
563 guarantee(klass_handle->oop_is_instance(), "must be instance klass"); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
564 k = klass_handle->super(); |
2499
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
565 } |
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
566 |
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
567 if (k != NULL) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
568 return JNIHandles::make_local(GraalCompiler::get_JavaType(k, THREAD)()); |
2499
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
569 } else { |
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
570 return NULL; |
2293
e3c42b8de67e
Removed a reference to getRiType(Class c) and some checkstyle fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2289
diff
changeset
|
571 } |
e3c42b8de67e
Removed a reference to getRiType(Class c) and some checkstyle fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2289
diff
changeset
|
572 } |
2048
177398c6147d
Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
573 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
574 // public JavaType JavaType_uniqueConcreteSubtype(HotSpotResolvedType klass); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
575 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
576 TRACE_graal_3("CompilerToVM::JavaType_uniqueConcreteSubtype"); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
577 VM_ENTRY_MARK; |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
578 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
579 Klass *up_cast = klass_handle->up_cast_abstract(); |
6277
dddcdb7ae209
removed klass::is_leaf_class() and replaced it's usage in Graal (the only usage) with an explicit test to ignore interface classes
Doug Simon <doug.simon@oracle.com>
parents:
6275
diff
changeset
|
580 if (!up_cast->is_interface() && up_cast->subklass() == NULL) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
581 return JNIHandles::make_local(GraalCompiler::get_JavaType(up_cast, THREAD)()); |
2048
177398c6147d
Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
582 } |
177398c6147d
Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
583 return NULL; |
177398c6147d
Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
584 } |
177398c6147d
Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
585 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
586 // public bool JavaType_isInitialized(HotSpotResolvedType klass); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
587 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
588 TRACE_graal_3("CompilerToVM::JavaType_isInitialized"); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
589 klassOop klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(hotspot_klass)); |
3618
e82da3a1bbc9
Fix crash in branch prediction if there's no current environment.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3587
diff
changeset
|
590 assert(klass != NULL, "method must not be called for primitive types"); |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
591 return instanceKlass::cast(klass)->is_initialized(); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
592 } |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
593 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
594 // public JavaType JavaType_arrayOf(HotSpotResolvedJavaType klass); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
595 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1arrayOf(JNIEnv *, jobject, jobject klass) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
596 TRACE_graal_3("CompilerToVM::JavaType_arrayOf"); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
597 VM_ENTRY_MARK; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
598 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
599 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); |
3674
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3670
diff
changeset
|
600 KlassHandle arr = klass_handle->array_klass(THREAD); |
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3670
diff
changeset
|
601 Handle name = VmIds::toString<Handle>(arr->name(), CHECK_NULL); |
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3670
diff
changeset
|
602 assert(arr->oop_is_array(), ""); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
603 return JNIHandles::make_local(THREAD, GraalCompiler::createHotSpotResolvedJavaType(arr, name, THREAD)()); |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
604 } |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
605 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
606 // public ResolvedJavaField[] JavaType_fields(HotSpotResolvedJavaType klass); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
607 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1fields(JNIEnv *, jobject, jobject klass) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
608 TRACE_graal_3("CompilerToVM::JavaType_fields"); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
609 VM_ENTRY_MARK; |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
610 ResourceMark rm; |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
611 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
612 instanceKlassHandle k = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
613 class MyFieldClosure : public FieldClosure { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
614 public: |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
615 instanceKlassHandle _holder; |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
616 Handle _resolved_type_holder; |
3638
e53cfcb230a7
Fixed an issue with the runtime queried escape analysis field array.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3637
diff
changeset
|
617 GrowableArray<Handle> _field_array; |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
618 |
3638
e53cfcb230a7
Fixed an issue with the runtime queried escape analysis field array.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3637
diff
changeset
|
619 MyFieldClosure(instanceKlassHandle& holder, Handle resolved_type_holder) : _holder(holder), _resolved_type_holder(resolved_type_holder) { } |
3587
1692a2f9bfc5
Only return declared fields on fields() call.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3586
diff
changeset
|
620 |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
621 virtual void do_field(fieldDescriptor* fd) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
622 if (!Thread::current()->has_pending_exception()) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
623 if (fd->field_holder() == _holder()) { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
624 Handle type = GraalCompiler::get_JavaTypeFromSignature(fd->constants(), fd->signature_index(), fd->field_holder(), Thread::current()); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
625 Handle field = VMToCompiler::createJavaField(_resolved_type_holder, VmIds::toString<Handle>(fd->name(), Thread::current()), type, fd->offset(), fd->access_flags().as_int(), Thread::current()); |
3638
e53cfcb230a7
Fixed an issue with the runtime queried escape analysis field array.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3637
diff
changeset
|
626 _field_array.append(field()); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
627 } |
3587
1692a2f9bfc5
Only return declared fields on fields() call.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3586
diff
changeset
|
628 } |
1692a2f9bfc5
Only return declared fields on fields() call.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3586
diff
changeset
|
629 } |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
630 }; |
3638
e53cfcb230a7
Fixed an issue with the runtime queried escape analysis field array.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3637
diff
changeset
|
631 MyFieldClosure closure(k, JNIHandles::resolve(klass)); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
632 k->do_nonstatic_fields(&closure); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
633 objArrayHandle field_array = oopFactory::new_objArray(SystemDictionary::ResolvedJavaField_klass(), closure._field_array.length(), CHECK_NULL); |
3638
e53cfcb230a7
Fixed an issue with the runtime queried escape analysis field array.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3637
diff
changeset
|
634 for (int i=0; i<closure._field_array.length(); ++i) { |
e53cfcb230a7
Fixed an issue with the runtime queried escape analysis field array.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3637
diff
changeset
|
635 field_array->obj_at_put(i, closure._field_array.at(i)()); |
e53cfcb230a7
Fixed an issue with the runtime queried escape analysis field array.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3637
diff
changeset
|
636 } |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
637 return JNIHandles::make_local(field_array()); |
3090
536528f48708
more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents:
3055
diff
changeset
|
638 } |
536528f48708
more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents:
3055
diff
changeset
|
639 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
640 // public JavaType getPrimitiveArrayType(Kind kind); |
5062
5e9f38419819
Adjust C++ part according to the renaming.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5003
diff
changeset
|
641 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
642 TRACE_graal_3("CompilerToVM::getPrimitiveArrayType"); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
643 VM_ENTRY_MARK; |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
644 BasicType type = GraalCompiler::kindToBasicType(Kind::typeChar(kind)); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
645 assert(type != T_OBJECT, "primitive type expecteds"); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
646 Handle result = GraalCompiler::get_JavaType(Universe::typeArrayKlassObj(type), CHECK_NULL); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
647 return JNIHandles::make_local(THREAD, result()); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
648 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
649 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
650 // public long getMaxCallTargetOffset(RuntimeCall rtcall); |
5062
5e9f38419819
Adjust C++ part according to the renaming.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5003
diff
changeset
|
651 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getMaxCallTargetOffset(JNIEnv *env, jobject, jobject rtcall) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
652 TRACE_graal_3("CompilerToVM::getMaxCallTargetOffset"); |
3563
8780fa370aab
Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents:
3559
diff
changeset
|
653 VM_ENTRY_MARK; |
8780fa370aab
Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents:
3559
diff
changeset
|
654 oop call = JNIHandles::resolve(rtcall); |
3572
076a2c9caf71
Factor out runtime call target address determination to avoid redundancy between CodeInstaller::site_Call() and VMEntries.getMaxCallTargetOffset()
Peter Hofer <peter.hofer@jku.at>
parents:
3571
diff
changeset
|
655 address target_addr = CodeInstaller::runtime_call_target_address(call); |
3563
8780fa370aab
Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents:
3559
diff
changeset
|
656 if (target_addr != 0x0) { |
8780fa370aab
Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents:
3559
diff
changeset
|
657 int64_t off_low = (int64_t)target_addr - ((int64_t)CodeCache::low_bound() + sizeof(int)); |
8780fa370aab
Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents:
3559
diff
changeset
|
658 int64_t off_high = (int64_t)target_addr - ((int64_t)CodeCache::high_bound() + sizeof(int)); |
8780fa370aab
Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents:
3559
diff
changeset
|
659 return MAX2(ABS(off_low), ABS(off_high)); |
8780fa370aab
Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents:
3559
diff
changeset
|
660 } |
8780fa370aab
Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents:
3559
diff
changeset
|
661 return -1; |
8780fa370aab
Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents:
3559
diff
changeset
|
662 } |
8780fa370aab
Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents:
3559
diff
changeset
|
663 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
664 // public JavaType getType(Class<?> javaClass); |
5062
5e9f38419819
Adjust C++ part according to the renaming.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5003
diff
changeset
|
665 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getType(JNIEnv *env, jobject, jobject javaClass) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
666 TRACE_graal_3("CompilerToVM::getType"); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
667 VM_ENTRY_MARK; |
2058
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
668 oop javaClassOop = JNIHandles::resolve(javaClass); |
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
669 if (javaClassOop == NULL) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
670 fatal("argument to CompilerToVM.getType must not be NULL"); |
2215
999f8086cc4f
More changes to make it compile and work on win64.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2182
diff
changeset
|
671 return NULL; |
2058
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
672 } else if (java_lang_Class::is_primitive(javaClassOop)) { |
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
673 BasicType basicType = java_lang_Class::primitive_type(javaClassOop); |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
674 return JNIHandles::make_local(THREAD, VMToCompiler::createPrimitiveJavaType((int) basicType, THREAD)); |
2058
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
675 } else { |
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
676 KlassHandle klass = java_lang_Class::as_klassOop(javaClassOop); |
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
677 Handle name = java_lang_String::create_from_symbol(klass->name(), CHECK_NULL); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
678 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
679 Handle type = GraalCompiler::createHotSpotResolvedJavaType(klass, name, CHECK_NULL); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
680 return JNIHandles::make_local(THREAD, type()); |
2058
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
681 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
682 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
683 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
684 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
685 // helpers used to set fields in the HotSpotVMConfig object |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
686 jfieldID getFieldID(JNIEnv* env, jobject obj, const char* name, const char* sig) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
687 jfieldID id = env->GetFieldID(env->GetObjectClass(obj), name, sig); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
688 if (id == NULL) { |
3552
aa7b62997aa0
better error message of field not found
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3549
diff
changeset
|
689 fatal(err_msg("field not found: %s (%s)", name, sig)); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
690 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
691 return id; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
692 } |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
693 |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
694 void set_boolean(JNIEnv* env, jobject obj, const char* name, bool value) { env->SetBooleanField(obj, getFieldID(env, obj, name, "Z"), value); } |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
695 void set_int(JNIEnv* env, jobject obj, const char* name, int value) { env->SetIntField(obj, getFieldID(env, obj, name, "I"), value); } |
2216
b966d9b66bf9
Fixed a bug that truncated stub ids when compiling with vs.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
2215
diff
changeset
|
696 void set_long(JNIEnv* env, jobject obj, const char* name, jlong value) { env->SetLongField(obj, getFieldID(env, obj, name, "J"), value); } |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
697 void set_object(JNIEnv* env, jobject obj, const char* name, jobject value) { env->SetObjectField(obj, getFieldID(env, obj, name, "Ljava/lang/Object;"), value); } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
698 void set_int_array(JNIEnv* env, jobject obj, const char* name, jarray value) { env->SetObjectField(obj, getFieldID(env, obj, name, "[I"), value); } |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
699 |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
700 jboolean get_boolean(JNIEnv* env, jobject obj, const char* name) { return env->GetBooleanField(obj, getFieldID(env, obj, name, "Z")); } |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
701 jint get_int(JNIEnv* env, jobject obj, const char* name) { return env->GetIntField(obj, getFieldID(env, obj, name, "I")); } |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
702 jlong get_long(JNIEnv* env, jobject obj, const char* name) { return env->GetLongField(obj, getFieldID(env, obj, name, "J")); } |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
703 jobject get_object(JNIEnv* env, jobject obj, const char* name) { return env->GetObjectField(obj, getFieldID(env, obj, name, "Ljava/lang/Object;")); } |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
704 jobject get_object(JNIEnv* env, jobject obj, const char* name, const char* sig) { return env->GetObjectField(obj, getFieldID(env, obj, name, sig)); } |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
705 |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
706 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
707 BasicType basicTypes[] = { T_BOOLEAN, T_BYTE, T_SHORT, T_CHAR, T_INT, T_FLOAT, T_LONG, T_DOUBLE, T_OBJECT }; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
708 int basicTypeCount = sizeof(basicTypes) / sizeof(BasicType); |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
709 |
6363
a73fcf1639fc
HotSpotVMConfig object is now allocated in Java
Doug Simon <doug.simon@oracle.com>
parents:
6346
diff
changeset
|
710 // public void initializeConfiguration(HotSpotVMConfig config); |
a73fcf1639fc
HotSpotVMConfig object is now allocated in Java
Doug Simon <doug.simon@oracle.com>
parents:
6346
diff
changeset
|
711 JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_initializeConfiguration(JNIEnv *env, jobject, jobject config) { |
1419
7bf6a77b9c5a
implement recent safepoint & exceptionobject ci changes, HotSpotVMConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1415
diff
changeset
|
712 #ifdef _WIN64 |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
713 set_boolean(env, config, "windowsOs", true); |
1419
7bf6a77b9c5a
implement recent safepoint & exceptionobject ci changes, HotSpotVMConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1415
diff
changeset
|
714 #else |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
715 set_boolean(env, config, "windowsOs", false); |
1419
7bf6a77b9c5a
implement recent safepoint & exceptionobject ci changes, HotSpotVMConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1415
diff
changeset
|
716 #endif |
5624
7d25723b7699
added oop verification to NewInstanceSnippets when -XX:+VerifyOops is enabled
Doug Simon <doug.simon@oracle.com>
parents:
5618
diff
changeset
|
717 set_boolean(env, config, "verifyOops", VerifyOops); |
1942
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1941
diff
changeset
|
718 set_boolean(env, config, "useFastLocking", UseFastLocking); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
719 set_boolean(env, config, "useFastNewObjectArray", UseFastNewObjectArray); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
720 set_boolean(env, config, "useFastNewTypeArray", UseFastNewTypeArray); |
5602
e79b593e0632
made NewInstanceSnippets respect the UseTLAB HotSpot option
Doug Simon <doug.simon@oracle.com>
parents:
5561
diff
changeset
|
721 set_boolean(env, config, "useTLAB", UseTLAB); |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
722 set_int(env, config, "codeEntryAlignment", CodeEntryAlignment); |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
723 set_int(env, config, "vmPageSize", os::vm_page_size()); |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
724 set_int(env, config, "stackShadowPages", StackShadowPages); |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
725 set_int(env, config, "hubOffset", oopDesc::klass_offset_in_bytes()); |
5760
87e8baf5447c
added snippets for lowering array creation and initialization (in NewObjectSnippets)
Doug Simon <doug.simon@oracle.com>
parents:
5747
diff
changeset
|
726 set_int(env, config, "markOffset", oopDesc::mark_offset_in_bytes()); |
5466
af07e798947d
lifted fast subtype check into checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
5450
diff
changeset
|
727 set_int(env, config, "superCheckOffsetOffset", in_bytes(Klass::super_check_offset_offset())); |
af07e798947d
lifted fast subtype check into checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
5450
diff
changeset
|
728 set_int(env, config, "secondarySuperCacheOffset", in_bytes(Klass::secondary_super_cache_offset())); |
af07e798947d
lifted fast subtype check into checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
5450
diff
changeset
|
729 set_int(env, config, "secondarySupersOffset", in_bytes(Klass::secondary_supers_offset())); |
1422
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
730 set_int(env, config, "arrayLengthOffset", arrayOopDesc::length_offset_in_bytes()); |
4973
5d154704b04c
Merge fix #3.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4971
diff
changeset
|
731 set_int(env, config, "klassStateOffset", in_bytes(instanceKlass::init_state_offset())); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
732 set_int(env, config, "klassStateFullyInitialized", (int)instanceKlass::fully_initialized); |
1425
98fffb304868
tlab-allocated "new instance", invokespecial, support for static fields in COMPILER_CLASSES_DO
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
733 set_int(env, config, "threadTlabTopOffset", in_bytes(JavaThread::tlab_top_offset())); |
98fffb304868
tlab-allocated "new instance", invokespecial, support for static fields in COMPILER_CLASSES_DO
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
734 set_int(env, config, "threadTlabEndOffset", in_bytes(JavaThread::tlab_end_offset())); |
2059
9508a52cbd32
Add deoptimization blob support.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2058
diff
changeset
|
735 set_int(env, config, "threadObjectOffset", in_bytes(JavaThread::threadObj_offset())); |
4973
5d154704b04c
Merge fix #3.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4971
diff
changeset
|
736 set_int(env, config, "instanceHeaderPrototypeOffset", in_bytes(Klass::prototype_header_offset())); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
737 set_int(env, config, "threadExceptionOopOffset", in_bytes(JavaThread::exception_oop_offset())); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
738 set_int(env, config, "threadExceptionPcOffset", in_bytes(JavaThread::exception_pc_offset())); |
5747
120820e30baa
added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents:
5624
diff
changeset
|
739 set_int(env, config, "threadMultiNewArrayStorageOffset", in_bytes(JavaThread::graal_multinewarray_storage_offset())); |
5783
22b0cb49cc60
clean up some entries in HotSpotVMConfig
Lukas Stadler <lukas.stadler@jku.at>
parents:
5776
diff
changeset
|
740 set_long(env, config, "safepointPollingAddress", (jlong)(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()))); |
22b0cb49cc60
clean up some entries in HotSpotVMConfig
Lukas Stadler <lukas.stadler@jku.at>
parents:
5776
diff
changeset
|
741 set_boolean(env, config, "isPollingPageFar", Assembler::is_polling_page_far()); |
4973
5d154704b04c
Merge fix #3.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4971
diff
changeset
|
742 set_int(env, config, "classMirrorOffset", in_bytes(Klass::java_mirror_offset())); |
5783
22b0cb49cc60
clean up some entries in HotSpotVMConfig
Lukas Stadler <lukas.stadler@jku.at>
parents:
5776
diff
changeset
|
743 set_int(env, config, "runtimeCallStackSize", (jint)frame::arg_reg_save_area_bytes); |
22b0cb49cc60
clean up some entries in HotSpotVMConfig
Lukas Stadler <lukas.stadler@jku.at>
parents:
5776
diff
changeset
|
744 set_int(env, config, "klassModifierFlagsOffset", in_bytes(Klass::modifier_flags_offset())); |
22b0cb49cc60
clean up some entries in HotSpotVMConfig
Lukas Stadler <lukas.stadler@jku.at>
parents:
5776
diff
changeset
|
745 set_int(env, config, "klassOopOffset", java_lang_Class::klass_offset_in_bytes()); |
22b0cb49cc60
clean up some entries in HotSpotVMConfig
Lukas Stadler <lukas.stadler@jku.at>
parents:
5776
diff
changeset
|
746 set_int(env, config, "graalMirrorKlassOffset", in_bytes(Klass::graal_mirror_offset())); |
22b0cb49cc60
clean up some entries in HotSpotVMConfig
Lukas Stadler <lukas.stadler@jku.at>
parents:
5776
diff
changeset
|
747 set_int(env, config, "nmethodEntryOffset", nmethod::verified_entry_point_offset()); |
22b0cb49cc60
clean up some entries in HotSpotVMConfig
Lukas Stadler <lukas.stadler@jku.at>
parents:
5776
diff
changeset
|
748 set_int(env, config, "methodCompiledEntryOffset", in_bytes(methodOopDesc::from_compiled_offset())); |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
749 |
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
750 set_int(env, config, "methodDataOopDataOffset", in_bytes(methodDataOopDesc::data_offset())); |
5114
dad1ac9dba7d
finished first implementation of disabling runtime feedback selectively based on deoptimization history
Christian Haeubl <christian.haeubl@oracle.com>
parents:
5062
diff
changeset
|
751 set_int(env, config, "methodDataOopTrapHistoryOffset", in_bytes(methodDataOopDesc::trap_history_offset())); |
4443
6fb167f79df6
fixed methodDataOop access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4442
diff
changeset
|
752 set_int(env, config, "dataLayoutHeaderSize", DataLayout::header_size_in_bytes()); |
6fb167f79df6
fixed methodDataOop access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4442
diff
changeset
|
753 set_int(env, config, "dataLayoutTagOffset", in_bytes(DataLayout::tag_offset())); |
6fb167f79df6
fixed methodDataOop access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4442
diff
changeset
|
754 set_int(env, config, "dataLayoutFlagsOffset", in_bytes(DataLayout::flags_offset())); |
6fb167f79df6
fixed methodDataOop access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4442
diff
changeset
|
755 set_int(env, config, "dataLayoutBCIOffset", in_bytes(DataLayout::bci_offset())); |
6fb167f79df6
fixed methodDataOop access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4442
diff
changeset
|
756 set_int(env, config, "dataLayoutCellsOffset", in_bytes(DataLayout::cell_offset(0))); |
6fb167f79df6
fixed methodDataOop access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4442
diff
changeset
|
757 set_int(env, config, "dataLayoutCellSize", DataLayout::cell_size); |
6fb167f79df6
fixed methodDataOop access
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4442
diff
changeset
|
758 set_int(env, config, "bciProfileWidth", BciProfileWidth); |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
759 set_int(env, config, "typeProfileWidth", TypeProfileWidth); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
760 |
5618
60ca7d300b8f
reverted to using fast_new_instance_init_check_id stub to use fast TLAB refilling
Doug Simon <doug.simon@oracle.com>
parents:
5602
diff
changeset
|
761 // We use the fast path stub so that we get TLAB refills whenever possible instead of |
60ca7d300b8f
reverted to using fast_new_instance_init_check_id stub to use fast TLAB refilling
Doug Simon <doug.simon@oracle.com>
parents:
5602
diff
changeset
|
762 // unconditionally allocating directly from the heap (which the slow path does). |
60ca7d300b8f
reverted to using fast_new_instance_init_check_id stub to use fast TLAB refilling
Doug Simon <doug.simon@oracle.com>
parents:
5602
diff
changeset
|
763 // The stub must also do initialization when the compiled check fails. |
60ca7d300b8f
reverted to using fast_new_instance_init_check_id stub to use fast TLAB refilling
Doug Simon <doug.simon@oracle.com>
parents:
5602
diff
changeset
|
764 Runtime1::StubID newInstanceStub = Runtime1::fast_new_instance_init_check_id; |
60ca7d300b8f
reverted to using fast_new_instance_init_check_id stub to use fast TLAB refilling
Doug Simon <doug.simon@oracle.com>
parents:
5602
diff
changeset
|
765 |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1427
diff
changeset
|
766 set_long(env, config, "debugStub", VmIds::addStub((address)warning)); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
767 set_long(env, config, "instanceofStub", VmIds::addStub(Runtime1::entry_for(Runtime1::slow_subtype_check_id))); |
5618
60ca7d300b8f
reverted to using fast_new_instance_init_check_id stub to use fast TLAB refilling
Doug Simon <doug.simon@oracle.com>
parents:
5602
diff
changeset
|
768 set_long(env, config, "newInstanceStub", VmIds::addStub(Runtime1::entry_for(newInstanceStub))); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
769 set_long(env, config, "newTypeArrayStub", VmIds::addStub(Runtime1::entry_for(Runtime1::new_type_array_id))); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
770 set_long(env, config, "newObjectArrayStub", VmIds::addStub(Runtime1::entry_for(Runtime1::new_object_array_id))); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
771 set_long(env, config, "newMultiArrayStub", VmIds::addStub(Runtime1::entry_for(Runtime1::new_multi_array_id))); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
772 set_long(env, config, "inlineCacheMissStub", VmIds::addStub(SharedRuntime::get_ic_miss_stub())); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
773 set_long(env, config, "handleExceptionStub", VmIds::addStub(Runtime1::entry_for(Runtime1::handle_exception_nofpu_id))); |
1936
8d88c9ac9247
Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1931
diff
changeset
|
774 set_long(env, config, "handleDeoptStub", VmIds::addStub(SharedRuntime::deopt_blob()->unpack())); |
1942
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1941
diff
changeset
|
775 set_long(env, config, "monitorEnterStub", VmIds::addStub(Runtime1::entry_for(Runtime1::monitorenter_id))); |
00bc9eaf0e24
Support for -XX:+UseFastLocking flag. Fixed monitor enter XIR template for correct debug info at the runtime call.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1941
diff
changeset
|
776 set_long(env, config, "monitorExitStub", VmIds::addStub(Runtime1::entry_for(Runtime1::monitorexit_id))); |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
777 set_long(env, config, "fastMonitorEnterStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_monitorenter_id))); |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
778 set_long(env, config, "fastMonitorExitStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_monitorexit_id))); |
5783
22b0cb49cc60
clean up some entries in HotSpotVMConfig
Lukas Stadler <lukas.stadler@jku.at>
parents:
5776
diff
changeset
|
779 set_long(env, config, "verifyOopStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_verify_oop_id))); |
4441
4e3aaf14cbc6
fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents:
4439
diff
changeset
|
780 |
3683
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
781 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
782 BarrierSet* bs = Universe::heap()->barrier_set(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
783 switch (bs->kind()) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
784 case BarrierSet::CardTableModRef: |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
785 case BarrierSet::CardTableExtension: { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
786 jlong base = (jlong)((CardTableModRefBS*)bs)->byte_map_base; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
787 assert(base != 0, "unexpected byte_map_base"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
788 set_long(env, config, "cardtableStartAddress", base); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
789 set_int(env, config, "cardtableShift", CardTableModRefBS::card_shift); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
790 break; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
791 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
792 case BarrierSet::ModRef: |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
793 case BarrierSet::Other: |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
794 set_long(env, config, "cardtableStartAddress", 0); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
795 set_int(env, config, "cardtableShift", 0); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
796 // No post barriers |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
797 break; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
798 #ifndef SERIALGC |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
799 case BarrierSet::G1SATBCT: |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
800 case BarrierSet::G1SATBCTLogging: |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
801 #endif // SERIALGC |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
802 default: |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
803 ShouldNotReachHere(); |
2926
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2901
diff
changeset
|
804 break; |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
805 } |
1425
98fffb304868
tlab-allocated "new instance", invokespecial, support for static fields in COMPILER_CLASSES_DO
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1423
diff
changeset
|
806 |
4973
5d154704b04c
Merge fix #3.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4971
diff
changeset
|
807 set_int(env, config, "arrayClassElementOffset", in_bytes(objArrayKlass::element_klass_offset())); |
1419
7bf6a77b9c5a
implement recent safepoint & exceptionobject ci changes, HotSpotVMConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1415
diff
changeset
|
808 } |
1412
9195b99c841b
Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1410
diff
changeset
|
809 |
5776
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
810 // public HotSpotCompiledMethod installMethod(HotSpotCompilationResult comp, boolean installCode); |
5839
58a607307306
renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5783
diff
changeset
|
811 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_installMethod(JNIEnv *jniEnv, jobject, jobject compResult, jboolean install_code, jobject info) { |
1449
8cfe3537a0d3
Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1445
diff
changeset
|
812 VM_ENTRY_MARK; |
3669
53636e2c9d03
No longer use shared ciFactory. Remove make_global usage in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3667
diff
changeset
|
813 ResourceMark rm; |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3669
diff
changeset
|
814 HandleMark hm; |
5839
58a607307306
renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5783
diff
changeset
|
815 Handle compResultHandle = JNIHandles::resolve(compResult); |
3619
5e9645341ec3
support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents:
3587
diff
changeset
|
816 nmethod* nm = NULL; |
3636
c7d4198a9bce
Use GraalEnv for installing code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3632
diff
changeset
|
817 Arena arena; |
c7d4198a9bce
Use GraalEnv for installing code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3632
diff
changeset
|
818 ciEnv env(&arena); |
5839
58a607307306
renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5783
diff
changeset
|
819 CodeInstaller installer(compResultHandle, nm, install_code != 0); |
3683
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
820 |
5275
290b3025b66f
added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents:
5259
diff
changeset
|
821 if (info != NULL) { |
290b3025b66f
added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents:
5259
diff
changeset
|
822 arrayOop codeCopy = oopFactory::new_byteArray(nm->code_size(), CHECK_0); |
290b3025b66f
added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents:
5259
diff
changeset
|
823 memcpy(codeCopy->base(T_BYTE), nm->code_begin(), nm->code_size()); |
290b3025b66f
added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents:
5259
diff
changeset
|
824 HotSpotCodeInfo::set_code(info, codeCopy); |
290b3025b66f
added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents:
5259
diff
changeset
|
825 HotSpotCodeInfo::set_start(info, (jlong) nm->code_begin()); |
290b3025b66f
added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents:
5259
diff
changeset
|
826 } |
290b3025b66f
added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents:
5259
diff
changeset
|
827 |
5537
80371cc2256d
Renaming RiCompiledMethod => InstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5530
diff
changeset
|
828 // if install_code is true then we installed the code into the given method, no need to return an InstalledCode |
3683
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
829 if (!install_code && nm != NULL) { |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
830 instanceKlass::cast(HotSpotCompiledMethod::klass())->initialize(CHECK_NULL); |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
831 Handle obj = instanceKlass::cast(HotSpotCompiledMethod::klass())->allocate_permanent_instance(CHECK_NULL); |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
832 assert(obj() != NULL, "must succeed in allocating instance"); |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
833 HotSpotCompiledMethod::set_nmethod(obj, (jlong) nm); |
5839
58a607307306
renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5783
diff
changeset
|
834 HotSpotCompiledMethod::set_method(obj, HotSpotCompilationResult::method(compResult)); |
3683
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
835 nm->set_graal_compiled_method(obj()); |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
836 return JNIHandles::make_local(obj()); |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
837 } else { |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
838 return NULL; |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
839 } |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
840 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
841 |
4297
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
842 // public String disassembleNative(byte[] code, long address); |
5062
5e9f38419819
Adjust C++ part according to the renaming.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5003
diff
changeset
|
843 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_disassembleNative(JNIEnv *jniEnv, jobject, jbyteArray code, jlong start_address) { |
4297
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
844 TRACE_graal_3("CompilerToVM::disassembleNative"); |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
845 VM_ENTRY_MARK; |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
846 ResourceMark rm; |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
847 HandleMark hm; |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
848 |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
849 stringStream(st); |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
850 arrayOop code_oop = (arrayOop) JNIHandles::resolve(code); |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
851 int len = code_oop->length(); |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
852 address begin = (address) code_oop->base(T_BYTE); |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
853 address end = begin + len; |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
854 Disassembler::decode(begin, end, &st); |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
855 |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
856 Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
857 return JNIHandles::make_local(result()); |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
858 } |
874fcc2ddd9d
Use HotSpot disassmblers for native code and bytecode
Christian Wimmer <christian.wimmer@oracle.com>
parents:
4223
diff
changeset
|
859 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
860 // public StackTraceElement JavaMethod_toStackTraceElement(HotSpotResolvedJavaMethod method, int bci); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
861 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1toStackTraceElement(JNIEnv *env, jobject, jobject hotspot_method, int bci) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
862 TRACE_graal_3("CompilerToVM::JavaMethod_toStackTraceElement"); |
5238
cce31bc56c00
made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents:
5154
diff
changeset
|
863 |
cce31bc56c00
made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents:
5154
diff
changeset
|
864 VM_ENTRY_MARK; |
cce31bc56c00
made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents:
5154
diff
changeset
|
865 ResourceMark rm; |
cce31bc56c00
made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents:
5154
diff
changeset
|
866 HandleMark hm; |
cce31bc56c00
made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents:
5154
diff
changeset
|
867 |
cce31bc56c00
made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents:
5154
diff
changeset
|
868 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
cce31bc56c00
made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents:
5154
diff
changeset
|
869 oop element = java_lang_StackTraceElement::create(method, bci, CHECK_NULL); |
cce31bc56c00
made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents:
5154
diff
changeset
|
870 return JNIHandles::make_local(element); |
cce31bc56c00
made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents:
5154
diff
changeset
|
871 } |
cce31bc56c00
made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents:
5154
diff
changeset
|
872 |
5246
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
873 // public Object executeCompiledMethodVarargs(HotSpotCompiledMethod method, Object... args); |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
874 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_executeCompiledMethodVarargs(JNIEnv *env, jobject, jobject method, jobject args) { |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
875 TRACE_graal_3("CompilerToVM::executeCompiledMethod"); |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
876 |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
877 VM_ENTRY_MARK; |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
878 ResourceMark rm; |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
879 HandleMark hm; |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
880 |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
881 assert(method != NULL, "just checking"); |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
882 methodHandle mh = getMethodFromHotSpotMethod(HotSpotCompiledMethod::method(method)); |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
883 Symbol* signature = mh->signature(); |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
884 JavaCallArguments jca; |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
885 |
5747
120820e30baa
added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents:
5624
diff
changeset
|
886 JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static()); |
5246
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
887 JavaValue result(jap.get_ret_type()); |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
888 |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
889 nmethod* nm = (nmethod*) HotSpotCompiledMethod::nmethod(method); |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
890 if (nm == NULL || !nm->is_alive()) { |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
891 THROW_0(vmSymbols::MethodInvalidatedException()); |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
892 } |
5466
af07e798947d
lifted fast subtype check into checkcast snippets
Doug Simon <doug.simon@oracle.com>
parents:
5450
diff
changeset
|
893 |
5246
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
894 JavaCalls::call(&result, mh, nm, &jca, CHECK_NULL); |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
895 |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
896 if (jap.get_ret_type() == T_VOID) { |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
897 return NULL; |
5395
fc1943f18fef
fixed bug in returning array values from CompilerToVMImpl.executeCompiledMethodVarargs
Doug Simon <doug.simon@oracle.com>
parents:
5318
diff
changeset
|
898 } else if (jap.get_ret_type() == T_OBJECT || jap.get_ret_type() == T_ARRAY) { |
5246
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
899 return JNIHandles::make_local((oop) result.get_jobject()); |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
900 } else { |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
901 oop o = java_lang_boxing_object::create(jap.get_ret_type(), (jvalue *) result.get_value_addr(), CHECK_NULL); |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
902 return JNIHandles::make_local(o); |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
903 } |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
904 } |
8bf2c37c46c4
added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents:
5238
diff
changeset
|
905 |
4993
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
906 // public Object executeCompiledMethod(HotSpotCompiledMethod method, Object arg1, Object arg2, Object arg3); |
5062
5e9f38419819
Adjust C++ part according to the renaming.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5003
diff
changeset
|
907 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_executeCompiledMethod(JNIEnv *env, jobject, jobject method, jobject arg1, jobject arg2, jobject arg3) { |
4993
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
908 TRACE_graal_3("CompilerToVM::executeCompiledMethod"); |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
909 |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
910 VM_ENTRY_MARK; |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
911 ResourceMark rm; |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
912 HandleMark hm; |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
913 |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
914 methodHandle actualMethod = getMethodFromHotSpotMethod(HotSpotCompiledMethod::method(method)); |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
915 assert(method != NULL, "just checking"); |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
916 JavaValue result(T_OBJECT); |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
917 JavaCallArguments args; |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
918 args.push_oop(JNIHandles::resolve(arg1)); |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
919 args.push_oop(JNIHandles::resolve(arg2)); |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
920 args.push_oop(JNIHandles::resolve(arg3)); |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
921 |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
922 nmethod* nm = (nmethod*) HotSpotCompiledMethod::nmethod(method); |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
923 if (nm == NULL || !nm->is_alive()) { |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
924 THROW_0(vmSymbols::MethodInvalidatedException()); |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
925 } |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
926 |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
927 JavaCalls::call(&result, actualMethod, nm, &args, CHECK_NULL); |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
928 |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
929 return JNIHandles::make_local((oop) result.get_jobject()); |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
930 } |
897b7d18bebc
added RiCompiledMethod.execute and the required VM infrastructure
Lukas Stadler <lukas.stadler@jku.at>
parents:
4973
diff
changeset
|
931 |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
932 // public native int JavaMethod_vtableEntryOffset(HotSpotResolvedJavaMethod method); |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
933 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_vtableEntryOffset(JNIEnv *, jobject, jobject hotspot_method) { |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
934 TRACE_graal_3("CompilerToVM::JavaMethod_vtableEntryOffset"); |
5003
5e6f1026a63e
fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
5000
diff
changeset
|
935 |
5e6f1026a63e
fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
5000
diff
changeset
|
936 methodOop method = getMethodFromHotSpotMethod(hotspot_method); |
5e6f1026a63e
fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
5000
diff
changeset
|
937 assert(!instanceKlass::cast(method->method_holder())->is_interface(), "vtableEntryOffset cannot be called for interface methods"); |
5e6f1026a63e
fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
5000
diff
changeset
|
938 |
5e6f1026a63e
fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
5000
diff
changeset
|
939 // get entry offset in words |
5e6f1026a63e
fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
5000
diff
changeset
|
940 int vtable_entry_offset = instanceKlass::vtable_start_offset() + method->vtable_index() * vtableEntry::size(); |
5e6f1026a63e
fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
5000
diff
changeset
|
941 // convert to bytes |
5e6f1026a63e
fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
5000
diff
changeset
|
942 vtable_entry_offset = vtable_entry_offset * wordSize + vtableEntry::method_offset_in_bytes(); |
5e6f1026a63e
fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
5000
diff
changeset
|
943 |
5e6f1026a63e
fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
5000
diff
changeset
|
944 return vtable_entry_offset; |
5e6f1026a63e
fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
5000
diff
changeset
|
945 } |
5e6f1026a63e
fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents:
5000
diff
changeset
|
946 |
5129
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
947 // public native long[] getDeoptedLeafGraphIds(); |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
948 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getDeoptedLeafGraphIds(JNIEnv *, jobject) { |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
949 TRACE_graal_3("CompilerToVM::getDeoptedLeafGraphIds"); |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
950 |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
951 VM_ENTRY_MARK; |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
952 |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
953 // the contract for this method is as follows: |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
954 // returning null: no deopted leaf graphs |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
955 // returning array (size > 0): the ids of the deopted leaf graphs |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
956 // returning array (size == 0): there was an overflow, the compiler needs to clear its cache completely |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
957 |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
958 oop array = GraalCompiler::instance()->dump_deopted_leaf_graphs(CHECK_NULL); |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
959 return JNIHandles::make_local(array); |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
960 } |
51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents:
5062
diff
changeset
|
961 |
5318
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
962 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_decodePC(JNIEnv *, jobject, jlong pc) { |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
963 TRACE_graal_3("CompilerToVM::decodePC"); |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
964 |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
965 VM_ENTRY_MARK; |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
966 |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
967 stringStream(st); |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
968 CodeBlob* blob = CodeCache::find_blob_unsafe((void*) pc); |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
969 if (blob == NULL) { |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
970 st.print("[unidentified pc]"); |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
971 } else { |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
972 st.print(blob->name()); |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
973 |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
974 nmethod* nm = blob->as_nmethod_or_null(); |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
975 if (nm != NULL && nm->method() != NULL) { |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
976 st.print(" %s.", nm->method()->method_holder()->klass_part()->external_name()); |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
977 nm->method()->name()->print_symbol_on(&st); |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
978 st.print(" @ %d", pc - (jlong) nm->entry_point()); |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
979 } |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
980 } |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
981 Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
982 return JNIHandles::make_local(result()); |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
983 |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
984 } |
b5cd7bc05695
Method entry counters: Enable the flag to collect an execution profile of compiled methods and their callers. This allows to, e.g., detect methods that should be inlined because they are called frequently.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents:
5275
diff
changeset
|
985 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
986 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
987 #define CC (char*) /*cast a literal from (const char*)*/ |
5062
5e9f38419819
Adjust C++ part according to the renaming.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5003
diff
changeset
|
988 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_##f)) |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
989 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
990 #define PROXY "J" |
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:
5540
diff
changeset
|
991 #define TYPE "Lcom/oracle/graal/api/meta/JavaType;" |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
992 #define RESOLVED_TYPE "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaType;" |
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:
5540
diff
changeset
|
993 #define METHOD "Lcom/oracle/graal/api/meta/JavaMethod;" |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
994 #define RESOLVED_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;" |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3552
diff
changeset
|
995 #define REFLECT_METHOD "Ljava/lang/reflect/Method;" |
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:
5540
diff
changeset
|
996 #define SIGNATURE "Lcom/oracle/graal/api/meta/Signature;" |
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:
5540
diff
changeset
|
997 #define FIELD "Lcom/oracle/graal/api/meta/JavaField;" |
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:
5540
diff
changeset
|
998 #define RESOLVED_FIELD "Lcom/oracle/graal/api/meta/ResolvedJavaField;" |
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:
5540
diff
changeset
|
999 #define CONSTANT_POOL "Lcom/oracle/graal/api/meta/ConstantPool;" |
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:
5540
diff
changeset
|
1000 #define EXCEPTION_HANDLERS "[Lcom/oracle/graal/api/meta/ExceptionHandler;" |
5776
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1001 #define HS_COMP_RESULT "Lcom/oracle/graal/hotspot/HotSpotCompilationResult;" |
5062
5e9f38419819
Adjust C++ part according to the renaming.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5003
diff
changeset
|
1002 #define CONFIG "Lcom/oracle/graal/hotspot/HotSpotVMConfig;" |
5548
8872bc0eebdf
Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1003 #define HS_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotMethod;" |
8872bc0eebdf
Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1004 #define HS_COMP_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotCompiledMethod;" |
8872bc0eebdf
Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1005 #define HS_CODE_INFO "Lcom/oracle/graal/hotspot/meta/HotSpotCodeInfo;" |
8872bc0eebdf
Renaming hotspot.ri => hotspot.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5547
diff
changeset
|
1006 #define METHOD_DATA "Lcom/oracle/graal/hotspot/meta/HotSpotMethodData;" |
5776
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1007 #define CONSTANT "Lcom/oracle/graal/api/meta/Constant;" |
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1008 #define KIND "Lcom/oracle/graal/api/meta/Kind;" |
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1009 #define RUNTIME_CALL "Lcom/oracle/graal/api/code/RuntimeCall;" |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
1010 #define STRING "Ljava/lang/String;" |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
1011 #define OBJECT "Ljava/lang/Object;" |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
1012 #define CLASS "Ljava/lang/Class;" |
5238
cce31bc56c00
made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents:
5154
diff
changeset
|
1013 #define STACK_TRACE_ELEMENT "Ljava/lang/StackTraceElement;" |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
1014 |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1015 JNINativeMethod CompilerToVM_methods[] = { |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1016 {CC"JavaMethod_code", CC"("RESOLVED_METHOD")[B", FN_PTR(JavaMethod_1code)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1017 {CC"JavaMethod_signature", CC"("RESOLVED_METHOD")"STRING, FN_PTR(JavaMethod_1signature)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1018 {CC"JavaMethod_exceptionHandlers", CC"("RESOLVED_METHOD")"EXCEPTION_HANDLERS, FN_PTR(JavaMethod_1exceptionHandlers)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1019 {CC"JavaMethod_hasBalancedMonitors", CC"("RESOLVED_METHOD")Z", FN_PTR(JavaMethod_1hasBalancedMonitors)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1020 {CC"JavaMethod_uniqueConcreteMethod", CC"("RESOLVED_METHOD")"METHOD, FN_PTR(JavaMethod_1uniqueConcreteMethod)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1021 {CC"getJavaMethod", CC"("REFLECT_METHOD")"METHOD, FN_PTR(getJavaMethod)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1022 {CC"JavaMethod_methodData", CC"("RESOLVED_METHOD")"METHOD_DATA, FN_PTR(JavaMethod_1methodData)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1023 {CC"JavaMethod_invocationCount", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_1invocationCount)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1024 {CC"JavaMethod_hasCompiledCode", CC"("RESOLVED_METHOD")Z", FN_PTR(JavaMethod_1hasCompiledCode)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1025 {CC"JavaMethod_getCompiledCodeSize", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_1getCompiledCodeSize)}, |
5776
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1026 {CC"Signature_lookupType", CC"("STRING RESOLVED_TYPE"Z)"TYPE, FN_PTR(Signature_1lookupType)}, |
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1027 {CC"ConstantPool_lookupConstant", CC"("RESOLVED_TYPE"I)"OBJECT, FN_PTR(ConstantPool_1lookupConstant)}, |
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1028 {CC"ConstantPool_lookupMethod", CC"("RESOLVED_TYPE"IB)"METHOD, FN_PTR(ConstantPool_1lookupMethod)}, |
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1029 {CC"ConstantPool_lookupType", CC"("RESOLVED_TYPE"I)"TYPE, FN_PTR(ConstantPool_1lookupType)}, |
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1030 {CC"ConstantPool_loadReferencedType", CC"("RESOLVED_TYPE"IB)V", FN_PTR(ConstantPool_1loadReferencedType)}, |
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1031 {CC"ConstantPool_lookupField", CC"("RESOLVED_TYPE"IB)"FIELD, FN_PTR(ConstantPool_1lookupField)}, |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1032 {CC"JavaType_resolveMethodImpl", CC"("RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(JavaType_3resolveMethodImpl)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1033 {CC"JavaType_isSubtypeOf", CC"("RESOLVED_TYPE TYPE")Z", FN_PTR(JavaType_2isSubtypeOf)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1034 {CC"JavaType_leastCommonAncestor", CC"("RESOLVED_TYPE RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_2leastCommonAncestor)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1035 {CC"JavaType_componentType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1componentType)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1036 {CC"JavaType_uniqueConcreteSubtype", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1uniqueConcreteSubtype)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1037 {CC"JavaType_superType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1superType)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1038 {CC"JavaType_arrayOf", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1arrayOf)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1039 {CC"JavaType_fields", CC"("RESOLVED_TYPE")["RESOLVED_FIELD, FN_PTR(JavaType_1fields)}, |
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1040 {CC"JavaType_isInitialized", CC"("RESOLVED_TYPE")Z", FN_PTR(JavaType_1isInitialized)}, |
5776
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1041 {CC"getPrimitiveArrayType", CC"("KIND")"TYPE, FN_PTR(getPrimitiveArrayType)}, |
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1042 {CC"getMaxCallTargetOffset", CC"("RUNTIME_CALL")J", FN_PTR(getMaxCallTargetOffset)}, |
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1043 {CC"getType", CC"("CLASS")"TYPE, FN_PTR(getType)}, |
6363
a73fcf1639fc
HotSpotVMConfig object is now allocated in Java
Doug Simon <doug.simon@oracle.com>
parents:
6346
diff
changeset
|
1044 {CC"initializeConfiguration", CC"("CONFIG")V", FN_PTR(initializeConfiguration)}, |
5776
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1045 {CC"installMethod", CC"("HS_COMP_RESULT"Z"HS_CODE_INFO")"HS_COMP_METHOD, FN_PTR(installMethod)}, |
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1046 {CC"disassembleNative", CC"([BJ)"STRING, FN_PTR(disassembleNative)}, |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1047 {CC"JavaMethod_toStackTraceElement", CC"("RESOLVED_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(JavaMethod_1toStackTraceElement)}, |
5776
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1048 {CC"executeCompiledMethod", CC"("HS_COMP_METHOD OBJECT OBJECT OBJECT")"OBJECT, FN_PTR(executeCompiledMethod)}, |
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1049 {CC"executeCompiledMethodVarargs", CC"("HS_COMP_METHOD "["OBJECT")"OBJECT, FN_PTR(executeCompiledMethodVarargs)}, |
5554
70f715dfbb41
Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
5548
diff
changeset
|
1050 {CC"JavaMethod_vtableEntryOffset", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_vtableEntryOffset)}, |
5776
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1051 {CC"getDeoptedLeafGraphIds", CC"()[J", FN_PTR(getDeoptedLeafGraphIds)}, |
2a64cf19ab2a
rename: HotSpotTargetMethod -> HotSpotCompilationResult
Doug Simon <doug.simon@oracle.com>
parents:
5763
diff
changeset
|
1052 {CC"decodePC", CC"(J)"STRING, FN_PTR(decodePC)}, |
1412
9195b99c841b
Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1410
diff
changeset
|
1053 }; |
9195b99c841b
Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1410
diff
changeset
|
1054 |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1055 int CompilerToVM_methods_count() { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1056 return sizeof(CompilerToVM_methods) / sizeof(JNINativeMethod); |
1421
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
1057 } |
3703
50a1d38cd7ac
Add newlines at the end of files, otherwise my version of gcc complains
Christian Wimmer <christian.wimmer@oracle.com>
parents:
3701
diff
changeset
|
1058 |