Mercurial > hg > graal-jvmci-8
annotate src/share/vm/graal/graalCompilerToVM.cpp @ 4220:5c80ccb80036
Renaming of VMExits and VMEntries part 1.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Wed, 04 Jan 2012 20:59:11 +0100 |
parents | src/share/vm/graal/graalVMEntries.cpp@aaac4894175c |
children | 8e2985cdaaa5 |
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" |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
29 #include "graal/graalVMEntries.hpp" |
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" |
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
34 #include "graal/graalVMExits.hpp" |
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) { |
3646
148584b96a34
Remove ci usage for accessing branch probability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3641
diff
changeset
|
44 return (methodOop)HotSpotMethodResolved::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 |
3632
136ea96eb7f8
Remove the need for VmId (last usage was the constant pool).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3622
diff
changeset
|
47 // public byte[] RiMethod_code(HotSpotResolvedMethod method); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
48 JNIEXPORT jbyteArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1code(JNIEnv *env, jobject, jobject hotspot_method) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
49 TRACE_graal_3("CompilerToVM::RiMethod_code"); |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
50 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
51 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
|
52 jbyteArray result = env->NewByteArray(code_size); |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
53 env->SetByteArrayRegion(result, 0, code_size, (const jbyte *) method->code_base()); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
54 return result; |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
55 } |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
56 |
3632
136ea96eb7f8
Remove the need for VmId (last usage was the constant pool).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3622
diff
changeset
|
57 // public String RiMethod_signature(HotSpotResolvedMethod method); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
58 JNIEXPORT jstring JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1signature(JNIEnv *env, jobject, jobject hotspot_method) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
59 TRACE_graal_3("CompilerToVM::RiMethod_signature"); |
1422
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
60 VM_ENTRY_MARK |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
61 methodOop method = getMethodFromHotSpotMethod(hotspot_method); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
62 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
|
63 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
|
64 } |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
65 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
66 // public RiExceptionHandler[] RiMethod_exceptionHandlers(long vmId); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
67 JNIEXPORT jobjectArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1exceptionHandlers(JNIEnv *, jobject, jobject hotspot_method) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
68 TRACE_graal_3("CompilerToVM::RiMethod_exceptionHandlers"); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
69 VM_ENTRY_MARK |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
70 ResourceMark rm; |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
71 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
72 typeArrayHandle handlers = method->exception_table(); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
73 int handler_count = handlers.is_null() ? 0 : handlers->length() / 4; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
74 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
75 instanceKlass::cast(HotSpotExceptionHandler::klass())->initialize(CHECK_NULL); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
76 objArrayHandle array = oopFactory::new_objArray(SystemDictionary::RiExceptionHandler_klass(), handler_count, CHECK_NULL); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
77 |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
78 for (int i = 0; i < handler_count; i++) { |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
79 // exception handlers are stored as four integers: start bci, end bci, handler bci, catch class constant pool index |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
80 int base = i * 4; |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
81 Handle entry = instanceKlass::cast(HotSpotExceptionHandler::klass())->allocate_instance(CHECK_NULL); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
82 HotSpotExceptionHandler::set_startBci(entry, handlers->int_at(base + 0)); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
83 HotSpotExceptionHandler::set_endBci(entry, handlers->int_at(base + 1)); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
84 HotSpotExceptionHandler::set_handlerBci(entry, handlers->int_at(base + 2)); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
85 int catch_class_index = handlers->int_at(base + 3); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
86 HotSpotExceptionHandler::set_catchClassIndex(entry, catch_class_index); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
87 |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
88 if (catch_class_index == 0) { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
89 HotSpotExceptionHandler::set_catchClass(entry, NULL); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
90 } else { |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
91 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
|
92 KlassHandle loading_klass = method->method_holder(); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
93 Handle catch_class = GraalCompiler::get_RiType(cp, catch_class_index, loading_klass, CHECK_NULL); |
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
|
94 if (catch_class->klass() == HotSpotTypeResolved::klass() && java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(catch_class)) == SystemDictionary::Throwable_klass()) { |
67e92894d065
Set catch all to true if the caught class is java.lang.Throwable.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3688
diff
changeset
|
95 HotSpotExceptionHandler::set_catchClass(entry, NULL); |
67e92894d065
Set catch all to true if the caught class is java.lang.Throwable.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3688
diff
changeset
|
96 HotSpotExceptionHandler::set_catchClassIndex(entry, 0); |
67e92894d065
Set catch all to true if the caught class is java.lang.Throwable.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3688
diff
changeset
|
97 } else { |
67e92894d065
Set catch all to true if the caught class is java.lang.Throwable.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3688
diff
changeset
|
98 HotSpotExceptionHandler::set_catchClass(entry, catch_class()); |
67e92894d065
Set catch all to true if the caught class is java.lang.Throwable.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3688
diff
changeset
|
99 } |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
100 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
101 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
|
102 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
103 |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
104 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
|
105 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
106 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
107 // public boolean RiMethod_hasBalancedMonitors(long vmId); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
108 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1hasBalancedMonitors(JNIEnv *, jobject, jobject hotspot_method) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
109 TRACE_graal_3("CompilerToVM::RiMethod_hasBalancedMonitors"); |
3559
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
110 |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
111 VM_ENTRY_MARK; |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
112 |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
113 // 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
|
114 methodHandle method(THREAD, getMethodFromHotSpotMethod(hotspot_method)); |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
115 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
|
116 |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
117 // 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
|
118 if (method->guaranteed_monitor_matching()) { |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
119 return true; |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
120 } |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
121 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
122 { |
3559
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
123 EXCEPTION_MARK; |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
124 ResourceMark rm(THREAD); |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
125 GeneratePairingInfo gpi(method); |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
126 gpi.compute_map(CATCH); |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
127 if (!gpi.monitor_safe()) { |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
128 return false; |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
129 } |
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
130 method->set_guaranteed_monitor_matching(); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
131 } |
3559
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
132 return true; |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
133 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
134 |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3552
diff
changeset
|
135 // public RiMethod getRiMethod(java.lang.reflect.Method reflectionMethod); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
136 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getRiMethod(JNIEnv *, jobject, jobject reflection_method_handle) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
137 TRACE_graal_3("CompilerToVM::getRiMethod"); |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3552
diff
changeset
|
138 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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 methodOop method = instanceKlass::cast(holder)->method_with_idnum(slot); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
144 Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
145 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
|
146 } |
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3552
diff
changeset
|
147 |
2049
7e09ea4a8f36
Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2048
diff
changeset
|
148 // public boolean RiMethod_uniqueConcreteMethod(long vmId); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
149 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1uniqueConcreteMethod(JNIEnv *, jobject, jobject hotspot_method) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
150 TRACE_graal_3("CompilerToVM::RiMethod_uniqueConcreteMethod"); |
3559
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
151 |
2050
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
152 VM_ENTRY_MARK; |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
153 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
154 KlassHandle holder = method->method_holder(); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
155 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
|
156 // 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
|
157 // interface I { void foo(); } |
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
158 // 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
|
159 // 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
|
160 // 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
|
161 // class D extends B { } |
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
162 // Would lead to identify C.foo() as the unique concrete method for I.foo() without seeing A.foo(). |
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
163 return false; |
2049
7e09ea4a8f36
Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2048
diff
changeset
|
164 } |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
165 methodHandle unique_concrete; |
2050
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
166 { |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
167 ResourceMark rm; |
2050
b6d2c238e585
Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2049
diff
changeset
|
168 MutexLocker locker(Compile_lock); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
169 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
|
170 } |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
171 if (unique_concrete.is_null()) { |
2049
7e09ea4a8f36
Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2048
diff
changeset
|
172 return NULL; |
3559
f70a4cc629e7
remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents:
3555
diff
changeset
|
173 } else { |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
174 Handle method_resolved = GraalCompiler::createHotSpotMethodResolved(unique_concrete, CHECK_NULL); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
175 return JNIHandles::make_local(THREAD, method_resolved()); |
2049
7e09ea4a8f36
Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2048
diff
changeset
|
176 } |
7e09ea4a8f36
Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2048
diff
changeset
|
177 } |
7e09ea4a8f36
Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2048
diff
changeset
|
178 |
2927
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
179 // public native int RiMethod_invocationCount(long vmId); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
180 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1invocationCount(JNIEnv *, jobject, jobject hotspot_method) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
181 TRACE_graal_3("CompilerToVM::RiMethod_invocationCount"); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
182 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
|
183 } |
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2901
diff
changeset
|
184 |
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
|
185 // public native int RiMethod_exceptionProbability(long vmId, int bci); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
186 JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_2exceptionProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
187 TRACE_graal_3("CompilerToVM::RiMethod_exceptionProbability"); |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
188 VM_ENTRY_MARK; |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
189 ResourceMark rm; |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
190 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
191 methodDataHandle method_data = method->method_data(); |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
192 if (method_data == NULL || !method_data->is_mature()) { |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
193 return -1; |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
194 } |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
195 ProfileData* data = method_data->bci_to_data(bci); |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
196 if (data == NULL) { |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
197 return 0; |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
198 } |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
199 uint trap = Deoptimization::trap_state_is_recompiled(data->trap_state())? 1: 0; |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
200 if (trap > 0) { |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
201 return 100; |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
202 } else { |
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
203 return trap; |
3055
fecdb0a65fb2
runtime profiles exceptions at the call site
Lukas Stadler <lukas.stadler@jku.at>
parents:
3020
diff
changeset
|
204 } |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
205 } |
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
|
206 |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
207 // ------------------------------------------------------------------ |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
208 // Adjust a CounterData count to be commensurate with |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
209 // interpreter_invocation_count. If the MDO exists for |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
210 // 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
|
211 // 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
|
212 // they can be usefully and stably compared against the |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
213 // invocation counts in methods. |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
214 int scale_count(methodDataOop method_data, int count) { |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
215 if (count > 0) { |
3566
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
216 int counter_life; |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
217 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
|
218 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
|
219 int creation_mileage = method_data->creation_mileage(); |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
220 counter_life = current_mileage - creation_mileage; |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
221 |
3566
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
222 // 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
|
223 if (counter_life > method_life) |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
224 counter_life = method_life; |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
225 if (0 < counter_life && counter_life <= method_life) { |
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
226 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
|
227 count = (count > 0) ? count : 1; |
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
228 } |
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
|
229 } |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
230 return count; |
3055
fecdb0a65fb2
runtime profiles exceptions at the call site
Lukas Stadler <lukas.stadler@jku.at>
parents:
3020
diff
changeset
|
231 } |
fecdb0a65fb2
runtime profiles exceptions at the call site
Lukas Stadler <lukas.stadler@jku.at>
parents:
3020
diff
changeset
|
232 |
2927
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
233 // public native RiTypeProfile RiMethod_typeProfile(long vmId, int bci); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
234 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_2typeProfile(JNIEnv *, jobject, jobject hotspot_method, jint bci) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
235 TRACE_graal_3("CompilerToVM::RiMethod_typeProfile"); |
3662
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
236 VM_ENTRY_MARK; |
2926
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2901
diff
changeset
|
237 Handle obj; |
3662
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
238 |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
239 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
240 methodDataHandle method_data = method->method_data(); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
241 if (method_data == NULL || !method_data->is_mature()) { |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
242 return NULL; |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
243 } |
3663
8c46cdb684d4
Fixed another possible safepoint in the code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3662
diff
changeset
|
244 ResourceMark rm; |
3662
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
245 ProfileData* data = method_data->bci_to_data(bci); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
246 if (data != NULL && data->is_ReceiverTypeData()) { |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
247 ReceiverTypeData* recv = data->as_ReceiverTypeData(); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
248 GrowableArray<KlassHandle> receivers; |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
249 GrowableArray<int> counts; |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
250 // determine morphism |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
251 uint total_count = 0; |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
252 for (uint i = 0; i < recv->row_limit(); i++) { |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
253 klassOop receiver = recv->receiver(i); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
254 if (receiver == NULL) continue; |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
255 uint count = recv->receiver_count(i); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
256 total_count += count; |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
257 receivers.append(receiver); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
258 counts.append(count); |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
259 } |
3662
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
260 |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
261 instanceKlass::cast(RiTypeProfile::klass())->initialize(CHECK_NULL); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
262 obj = instanceKlass::cast(RiTypeProfile::klass())->allocate_instance(CHECK_NULL); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
263 assert(obj() != NULL, "must succeed in allocating instance"); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
264 |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
265 int count = MAX2(total_count, recv->count()); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
266 RiTypeProfile::set_count(obj, scale_count(method_data(), count)); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
267 RiTypeProfile::set_morphism(obj, receivers.length()); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
268 |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
269 if (receivers.length() > 0) { |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
270 typeArrayHandle probabilities = oopFactory::new_typeArray(T_FLOAT, receivers.length(), CHECK_NULL); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
271 objArrayHandle types = oopFactory::new_objArray(SystemDictionary::RiType_klass(), receivers.length(), CHECK_NULL); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
272 for (int i = 0; i < receivers.length(); i++) { |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
273 KlassHandle receiver = receivers.at(i); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
274 |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
275 float prob = counts.at(i) / (float) total_count; |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
276 Handle type = GraalCompiler::get_RiType(receiver, CHECK_NULL); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
277 |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
278 probabilities->float_at_put(i, prob); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
279 types->obj_at_put(i, type()); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
280 |
3565
b3f0f8a01ca2
remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents:
3559
diff
changeset
|
281 } |
2926
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2901
diff
changeset
|
282 |
3662
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
283 RiTypeProfile::set_probabilities(obj, probabilities()); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
284 RiTypeProfile::set_types(obj, types()); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
285 } else { |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
286 RiTypeProfile::set_probabilities(obj, NULL); |
e0bbc6b1c4a1
Fixed wrong type transition.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3656
diff
changeset
|
287 RiTypeProfile::set_types(obj, NULL); |
3566
b0d192f86f34
more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents:
3565
diff
changeset
|
288 } |
2926
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2901
diff
changeset
|
289 } |
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2901
diff
changeset
|
290 return JNIHandles::make_local(obj()); |
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2901
diff
changeset
|
291 } |
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2901
diff
changeset
|
292 |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
293 JNIEXPORT jdouble JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_2branchProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
294 TRACE_graal_3("CompilerToVM::RiMethod_typeProfile"); |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
295 ResourceMark rm; |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
296 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
297 methodDataHandle method_data = method->method_data(); |
2927
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
298 |
3014
681a227c332b
better inlining logic, DCE removes If with constant comparison
Lukas Stadler <lukas.stadler@jku.at>
parents:
3011
diff
changeset
|
299 if (method_data == NULL || !method_data->is_mature()) return -1; |
3646
148584b96a34
Remove ci usage for accessing branch probability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3641
diff
changeset
|
300 method_data->bci_to_data(bci); |
148584b96a34
Remove ci usage for accessing branch probability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3641
diff
changeset
|
301 |
148584b96a34
Remove ci usage for accessing branch probability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3641
diff
changeset
|
302 ProfileData* data = method_data->bci_to_data(bci); |
3014
681a227c332b
better inlining logic, DCE removes If with constant comparison
Lukas Stadler <lukas.stadler@jku.at>
parents:
3011
diff
changeset
|
303 if (data == NULL || !data->is_JumpData()) return -1; |
2927
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
304 |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
305 // get taken and not taken values |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
306 int taken = data->as_JumpData()->taken(); |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
307 int not_taken = 0; |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
308 if (data->is_BranchData()) { |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
309 not_taken = data->as_BranchData()->not_taken(); |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
310 } |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
311 |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
312 // Give up if too few (or too many, in which case the sum will overflow) counts to be meaningful. |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
313 // We also check that individual counters are positive first, otherwise the sum can become positive. |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
314 if (taken < 0 || not_taken < 0 || taken + not_taken < 40) return -1; |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
315 |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
316 // Pin probability to sane limits |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
317 if (taken == 0) |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
318 return 0; |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
319 else if (not_taken == 0) |
3211
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
320 return 1; |
2927
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
321 else { // Compute probability of true path |
3211
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
322 return (jdouble)(taken) / (taken + not_taken); |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
323 } |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
324 } |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
325 |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
326 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_2switchProbability(JNIEnv *, jobject, jobject hotspot_method, jint bci) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
327 TRACE_graal_3("CompilerToVM::RiMethod_typeProfile"); |
3647
dea89750a867
Remove ci usage from switchProbability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3646
diff
changeset
|
328 VM_ENTRY_MARK; |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
329 ResourceMark rm; |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
330 methodHandle method = getMethodFromHotSpotMethod(hotspot_method); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
331 methodDataHandle method_data = method->method_data(); |
3211
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
332 |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
333 if (method_data == NULL || !method_data->is_mature()) return NULL; |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
334 |
3647
dea89750a867
Remove ci usage from switchProbability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3646
diff
changeset
|
335 ProfileData* data = method_data->bci_to_data(bci); |
3211
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
336 if (data == NULL || !data->is_MultiBranchData()) return NULL; |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
337 |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
338 MultiBranchData* branch_data = data->as_MultiBranchData(); |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
339 |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
340 long sum = 0; |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
341 int cases = branch_data->number_of_cases(); |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
342 GrowableArray<uint>* counts = new GrowableArray<uint>(cases + 1); |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
343 |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
344 for (int i = 0; i < cases; i++) { |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
345 uint value = branch_data->count_at(i); |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
346 sum += value; |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
347 counts->append(value); |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
348 } |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
349 uint value = branch_data->default_count(); |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
350 sum += value; |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
351 counts->append(value); |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
352 |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
353 // Give up if too few (or too many, in which case the sum will overflow) counts to be meaningful. |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
354 // We also check that individual counters are positive first, otherwise the sum can become positive. |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
355 if (sum < 10 * (cases + 3)) return NULL; |
76507b87dd25
global absolute probability analysis:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3098
diff
changeset
|
356 |
3647
dea89750a867
Remove ci usage from switchProbability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3646
diff
changeset
|
357 typeArrayOop probability = oopFactory::new_typeArray(T_DOUBLE, cases + 1, CHECK_NULL); |
dea89750a867
Remove ci usage from switchProbability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3646
diff
changeset
|
358 for (int i = 0; i < cases + 1; i++) { |
dea89750a867
Remove ci usage from switchProbability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3646
diff
changeset
|
359 probability->double_at_put(i, counts->at(i) / (double) sum); |
2927
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
360 } |
3647
dea89750a867
Remove ci usage from switchProbability.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3646
diff
changeset
|
361 return JNIHandles::make_local(probability); |
2927
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
362 } |
f9c6d9bc4fbc
RiMethod provides branch prediction information
Lukas Stadler <lukas.stadler@jku.at>
parents:
2926
diff
changeset
|
363 |
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
|
364 // public native boolean RiMethod_hasCompiledCode(HotSpotMethodResolved method); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
365 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiMethod_1hasCompiledCode(JNIEnv *, jobject, jobject hotspot_method) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
366 TRACE_graal_3("CompilerToVM::RiMethod_hasCompiledCode"); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
367 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
|
368 } |
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
|
369 |
1941
79d04223b8a5
Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1939
diff
changeset
|
370 // public RiType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
371 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiSignature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
372 TRACE_graal_3("CompilerToVM::RiSignature_lookupType"); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
373 VM_ENTRY_MARK; |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
374 ResourceMark rm; |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
375 |
2182
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2061
diff
changeset
|
376 Symbol* nameSymbol = VmIds::toSymbol(jname); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
377 Handle name = JNIHandles::resolve(jname); |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
378 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
379 oop result; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
380 if (nameSymbol == vmSymbols::int_signature()) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
381 result = VMToCompiler::createRiTypePrimitive((int) T_INT, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
382 } else if (nameSymbol == vmSymbols::long_signature()) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
383 result = VMToCompiler::createRiTypePrimitive((int) T_LONG, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
384 } else if (nameSymbol == vmSymbols::bool_signature()) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
385 result = VMToCompiler::createRiTypePrimitive((int) T_BOOLEAN, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
386 } else if (nameSymbol == vmSymbols::char_signature()) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
387 result = VMToCompiler::createRiTypePrimitive((int) T_CHAR, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
388 } else if (nameSymbol == vmSymbols::short_signature()) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
389 result = VMToCompiler::createRiTypePrimitive((int) T_SHORT, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
390 } else if (nameSymbol == vmSymbols::byte_signature()) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
391 result = VMToCompiler::createRiTypePrimitive((int) T_BYTE, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
392 } else if (nameSymbol == vmSymbols::double_signature()) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
393 result = VMToCompiler::createRiTypePrimitive((int) T_DOUBLE, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
394 } else if (nameSymbol == vmSymbols::float_signature()) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
395 result = VMToCompiler::createRiTypePrimitive((int) T_FLOAT, THREAD); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
396 } else { |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
397 klassOop resolved_type = NULL; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
398 // 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
|
399 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
|
400 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
|
401 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
|
402 if (JNIHandles::resolve(accessingClass) != NULL) { |
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
|
403 classloader = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(accessingClass))->klass_part()->class_loader(); |
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
|
404 protectionDomain = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(accessingClass))->klass_part()->protection_domain(); |
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
|
405 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
406 resolved_type = SystemDictionary::resolve_or_null(nameSymbol, classloader, protectionDomain, THREAD); |
1481
fe69dec9a1ed
Added support for CompileTheWorld.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1479
diff
changeset
|
407 if (HAS_PENDING_EXCEPTION) { |
fe69dec9a1ed
Added support for CompileTheWorld.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1479
diff
changeset
|
408 CLEAR_PENDING_EXCEPTION; |
fe69dec9a1ed
Added support for CompileTheWorld.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1479
diff
changeset
|
409 resolved_type = NULL; |
fe69dec9a1ed
Added support for CompileTheWorld.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1479
diff
changeset
|
410 } |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
411 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
412 if (resolved_type != NULL) { |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
413 Handle type = GraalCompiler::createHotSpotTypeResolved(resolved_type, name, CHECK_NULL); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
414 result = type(); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
415 } else { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
416 Handle type = VMToCompiler::createRiTypeUnresolved(name, THREAD); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
417 result = type(); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
418 } |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
419 } |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
420 |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
421 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
|
422 } |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
423 |
3632
136ea96eb7f8
Remove the need for VmId (last usage was the constant pool).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3622
diff
changeset
|
424 // public Object RiConstantPool_lookupConstant(HotSpotTypeResolved type, int cpi); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
425 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupConstant(JNIEnv *env, jobject, jobject type, jint index) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
426 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupConstant"); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
427 VM_ENTRY_MARK; |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
428 |
3632
136ea96eb7f8
Remove the need for VmId (last usage was the constant pool).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3622
diff
changeset
|
429 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::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
|
430 |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
431 oop result = NULL; |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
432 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
|
433 if (tag.is_int()) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
434 result = VMToCompiler::createCiConstant(CiKind::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
|
435 } else if (tag.is_long()) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
436 result = VMToCompiler::createCiConstant(CiKind::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
|
437 } else if (tag.is_float()) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
438 result = VMToCompiler::createCiConstantFloat(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
|
439 } else if (tag.is_double()) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
440 result = VMToCompiler::createCiConstantDouble(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
|
441 } 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
|
442 oop string = NULL; |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
443 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
|
444 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
|
445 } else { |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
446 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
|
447 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
|
448 CLEAR_PENDING_EXCEPTION; |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
449 // 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
|
450 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
|
451 return NULL; |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
452 } |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
453 } |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
454 result = VMToCompiler::createCiConstantObject(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
|
455 } else if (tag.is_klass() || tag.is_unresolved_klass()) { |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
456 Handle type = GraalCompiler::get_RiType(cp, index, cp->pool_holder(), CHECK_NULL); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
457 result = type(); |
1413
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
458 } 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
|
459 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
|
460 assert(obj->is_instance(), "must be an instance"); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
461 result = VMToCompiler::createCiConstantObject(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
|
462 } else { |
1ecc8f0aad00
Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1412
diff
changeset
|
463 ShouldNotReachHere(); |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
464 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
465 |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
466 return JNIHandles::make_local(THREAD, result); |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
467 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
468 |
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
|
469 // public RiMethod RiConstantPool_lookupMethod(long vmId, int cpi, byte byteCode); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
470 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
471 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupMethod"); |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
472 VM_ENTRY_MARK; |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
473 index = GraalCompiler::to_cp_index_u2(index); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
474 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3669
diff
changeset
|
475 instanceKlassHandle pool_holder(cp->pool_holder()); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
476 |
1432
b61a43cd1255
sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1429
diff
changeset
|
477 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
|
478 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
|
479 if (!method.is_null()) { |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
480 Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
481 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
|
482 } else { |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
483 // Get the method's name and signature. |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
484 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
|
485 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
|
486 int holder_index = cp->klass_ref_index_at(index); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
487 Handle type = GraalCompiler::get_RiType(cp, holder_index, cp->pool_holder(), CHECK_NULL); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
488 return JNIHandles::make_local(THREAD, VMToCompiler::createRiMethodUnresolved(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
|
489 } |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
490 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
491 |
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
|
492 // public RiType RiConstantPool_lookupType(long vmId, int cpi); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
493 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupType(JNIEnv *env, jobject, jobject type, jint index) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
494 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupType"); |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
495 VM_ENTRY_MARK; |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
496 |
3632
136ea96eb7f8
Remove the need for VmId (last usage was the constant pool).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3622
diff
changeset
|
497 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)))->constants(); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
498 Handle result = GraalCompiler::get_RiType(cp, index, cp->pool_holder(), CHECK_NULL); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
499 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
|
500 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
501 |
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
|
502 // public void RiConstantPool_loadReferencedType(long vmId, int cpi); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
503 JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1loadReferencedType(JNIEnv *env, jobject, jobject type, jint index, jbyte op) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
504 TRACE_graal_3("CompilerToVM::RiConstantPool_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
|
505 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
|
506 |
136ea96eb7f8
Remove the need for VmId (last usage was the constant pool).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3622
diff
changeset
|
507 constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::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
|
508 int byteCode = (op & 0xFF); |
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
|
509 if (byteCode != Bytecodes::_checkcast && byteCode != Bytecodes::_instanceof && byteCode != Bytecodes::_new && byteCode != Bytecodes::_anewarray && byteCode != Bytecodes::_multianewarray) { |
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
|
510 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
|
511 } |
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
|
512 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
|
513 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
|
514 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
|
515 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
|
516 } |
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
|
517 |
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
|
518 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
|
519 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
|
520 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
|
521 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
|
522 } |
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
|
523 } |
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
|
524 } |
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
|
525 |
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
|
526 // public RiField RiConstantPool_lookupField(long vmId, int cpi); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
527 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiConstantPool_1lookupField(JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte byteCode) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
528 TRACE_graal_3("CompilerToVM::RiConstantPool_lookupField"); |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
529 VM_ENTRY_MARK; |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
530 ResourceMark rm; |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
531 |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
532 index = GraalCompiler::to_cp_index_u2(index); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
533 constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(constantPoolHolder)))->constants(); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
534 |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
535 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
|
536 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
|
537 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
|
538 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
|
539 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
|
540 int holder_index = cp->klass_ref_index_at(index); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
541 Handle holder = GraalCompiler::get_RiType(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
|
542 instanceKlassHandle holder_klass; |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
543 |
1452
9b22e3e5df8e
Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1449
diff
changeset
|
544 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
|
545 int offset = -1; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
546 AccessFlags flags; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
547 BasicType basic_type; |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
548 if (holder->klass() == SystemDictionary::HotSpotTypeResolved_klass()) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
549 FieldAccessInfo result; |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
550 LinkResolver::resolve_field(result, cp, index, |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
551 Bytecodes::java_code(code), |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
552 true, false, Thread::current()); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
553 if (HAS_PENDING_EXCEPTION) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
554 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
|
555 } else { |
2a0cb564e470
Do not use result when resolve_field throws an exception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
556 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
|
557 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
|
558 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
|
559 basic_type = result.field_type(); |
2a0cb564e470
Do not use result when resolve_field throws an exception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3653
diff
changeset
|
560 holder = GraalCompiler::get_RiType(holder_klass, CHECK_NULL); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
561 } |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
562 } |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
563 |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
564 Handle type = GraalCompiler::get_RiTypeFromSignature(cp, sig_index, cp->pool_holder(), CHECK_NULL); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
565 Handle field_handle = GraalCompiler::get_RiField(offset, flags.as_int(), name, holder, type, code, THREAD); |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
566 |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
567 oop constant_object = NULL; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
568 // Check to see if the field is constant. |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
569 if (!holder_klass.is_null() && holder_klass->is_initialized() && flags.is_final() && flags.is_static()) { |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
570 // This field just may be constant. The only cases where it will |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
571 // not be constant are: |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
572 // |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
573 // 1. The field holds a non-perm-space oop. The field is, strictly |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
574 // speaking, constant but we cannot embed non-perm-space oops into |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
575 // generated code. For the time being we need to consider the |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
576 // field to be not constant. |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
577 // 2. The field is a *special* static&final field whose value |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
578 // may change. The three examples are java.lang.System.in, |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
579 // java.lang.System.out, and java.lang.System.err. |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
580 |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
581 bool ok = true; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
582 assert( SystemDictionary::System_klass() != NULL, "Check once per vm"); |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
583 if( holder_klass->as_klassOop() == SystemDictionary::System_klass() ) { |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
584 // Check offsets for case 2: System.in, System.out, or System.err |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
585 if( offset == java_lang_System::in_offset_in_bytes() || |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
586 offset == java_lang_System::out_offset_in_bytes() || |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
587 offset == java_lang_System::err_offset_in_bytes() ) { |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
588 ok = false; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
589 } |
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
|
590 } |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
591 |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
592 if (ok) { |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
593 Handle mirror = holder_klass->java_mirror(); |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
594 switch(basic_type) { |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
595 case T_OBJECT: |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
596 case T_ARRAY: |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
597 constant_object = VMToCompiler::createCiConstantObject(mirror->obj_field(offset), CHECK_0); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
598 break; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
599 case T_DOUBLE: |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
600 constant_object = VMToCompiler::createCiConstantDouble(mirror->double_field(offset), CHECK_0); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
601 break; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
602 case T_FLOAT: |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
603 constant_object = VMToCompiler::createCiConstantFloat(mirror->float_field(offset), CHECK_0); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
604 break; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
605 case T_LONG: |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
606 constant_object = VMToCompiler::createCiConstant(CiKind::Long(), mirror->long_field(offset), CHECK_0); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
607 break; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
608 case T_INT: |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
609 constant_object = VMToCompiler::createCiConstant(CiKind::Int(), mirror->int_field(offset), CHECK_0); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
610 break; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
611 case T_SHORT: |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
612 constant_object = VMToCompiler::createCiConstant(CiKind::Short(), mirror->short_field(offset), CHECK_0); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
613 break; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
614 case T_CHAR: |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
615 constant_object = VMToCompiler::createCiConstant(CiKind::Char(), mirror->char_field(offset), CHECK_0); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
616 break; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
617 case T_BYTE: |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
618 constant_object = VMToCompiler::createCiConstant(CiKind::Byte(), mirror->byte_field(offset), CHECK_0); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
619 break; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
620 case T_BOOLEAN: |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
621 constant_object = VMToCompiler::createCiConstant(CiKind::Boolean(), mirror->bool_field(offset), CHECK_0); |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
622 break; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
623 default: |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
624 fatal("Unhandled constant"); |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
625 break; |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
626 } |
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
|
627 } |
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
|
628 } |
3649
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
629 if (constant_object != NULL) { |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
630 HotSpotField::set_constant(field_handle, constant_object); |
5a8c44b5fb80
Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3648
diff
changeset
|
631 } |
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
|
632 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
|
633 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
634 |
1941
79d04223b8a5
Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1939
diff
changeset
|
635 // public RiMethod RiType_resolveMethodImpl(HotSpotTypeResolved klass, String name, String signature); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
636 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_3resolveMethodImpl(JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
637 TRACE_graal_3("CompilerToVM::RiType_resolveMethodImpl"); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
638 VM_ENTRY_MARK; |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
639 |
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
|
640 assert(JNIHandles::resolve(resolved_type) != NULL, ""); |
1941
79d04223b8a5
Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1939
diff
changeset
|
641 klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(resolved_type)); |
2182
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2061
diff
changeset
|
642 Symbol* name_symbol = VmIds::toSymbol(name); |
9569fdf936ff
Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2061
diff
changeset
|
643 Symbol* signature_symbol = VmIds::toSymbol(signature); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
644 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
|
645 if (method == NULL) { |
2901
d577d07cedec
Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2891
diff
changeset
|
646 if (TraceGraal >= 3) { |
1477
30e1f67703da
Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1470
diff
changeset
|
647 ResourceMark rm; |
2492
4e5515d09314
Fixed merge issues.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2293
diff
changeset
|
648 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
|
649 } |
30e1f67703da
Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1470
diff
changeset
|
650 return NULL; |
30e1f67703da
Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1470
diff
changeset
|
651 } |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
652 Handle ret = GraalCompiler::createHotSpotMethodResolved(method, CHECK_NULL); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
653 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
|
654 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
655 |
1941
79d04223b8a5
Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1939
diff
changeset
|
656 // public boolean RiType_isSubtypeOf(HotSpotTypeResolved klass, RiType other); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
657 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_2isSubtypeOf(JNIEnv *, jobject, jobject klass, jobject jother) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
658 TRACE_graal_3("CompilerToVM::RiType_isSubtypeOf"); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
659 oop other = JNIHandles::resolve(jother); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
660 assert(other->is_a(HotSpotTypeResolved::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
|
661 assert(JNIHandles::resolve(klass) != NULL, ""); |
1941
79d04223b8a5
Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1939
diff
changeset
|
662 klassOop thisKlass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); |
79d04223b8a5
Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1939
diff
changeset
|
663 klassOop otherKlass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(other)); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
664 if (thisKlass->klass_part()->oop_is_instance_slow()) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
665 return instanceKlass::cast(thisKlass)->is_subtype_of(otherKlass); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
666 } else if (thisKlass->klass_part()->oop_is_array()) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
667 return arrayKlass::cast(thisKlass)->is_subtype_of(otherKlass); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
668 } else { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
669 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
|
670 return false; |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
671 } |
1414
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
672 } |
e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1413
diff
changeset
|
673 |
1941
79d04223b8a5
Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
1939
diff
changeset
|
674 // public RiType RiType_componentType(HotSpotResolvedType klass); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
675 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1componentType(JNIEnv *, jobject, jobject klass) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
676 TRACE_graal_3("CompilerToVM::RiType_componentType"); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
677 VM_ENTRY_MARK; |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
678 KlassHandle array_klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); |
3697
872e949a0827
fix componentType for the primitive array case
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
3688
diff
changeset
|
679 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
|
680 BasicType t = typeArrayKlass::cast(array_klass())->element_type(); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
681 oop primitive_type = VMToCompiler::createRiTypePrimitive((int) t, CHECK_NULL); |
3697
872e949a0827
fix componentType for the primitive array case
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
3688
diff
changeset
|
682 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
|
683 } |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
684 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
|
685 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
|
686 assert(JNIHandles::resolve(klass) != NULL, ""); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
687 return JNIHandles::make_local(GraalCompiler::get_RiType(element_type, THREAD)()); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
688 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
689 |
2293
e3c42b8de67e
Removed a reference to getRiType(Class c) and some checkstyle fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2289
diff
changeset
|
690 // public RiType RiType_superType(HotSpotResolvedType klass); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
691 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1superType(JNIEnv *, jobject, jobject klass) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
692 TRACE_graal_3("CompilerToVM::RiType_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
|
693 VM_ENTRY_MARK; |
2293
e3c42b8de67e
Removed a reference to getRiType(Class c) and some checkstyle fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2289
diff
changeset
|
694 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
695 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
|
696 |
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
697 if (klass_handle->oop_is_array()) { |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
698 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
|
699 } else { |
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
700 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
|
701 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
|
702 } |
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
703 |
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
704 if (k != NULL) { |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
705 return JNIHandles::make_local(GraalCompiler::get_RiType(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
|
706 } else { |
ad9b14650e15
Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2492
diff
changeset
|
707 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
|
708 } |
e3c42b8de67e
Removed a reference to getRiType(Class c) and some checkstyle fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
2289
diff
changeset
|
709 } |
2048
177398c6147d
Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
710 |
177398c6147d
Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
711 // public RiType RiType_uniqueConcreteSubtype(HotSpotResolvedType klass); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
712 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
713 TRACE_graal_3("CompilerToVM::RiType_uniqueConcreteSubtype"); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
714 VM_ENTRY_MARK; |
2048
177398c6147d
Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
715 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
716 Klass *up_cast = klass_handle->up_cast_abstract(); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
717 if (up_cast->is_leaf_class()) { |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
718 return JNIHandles::make_local(GraalCompiler::get_RiType(up_cast, THREAD)()); |
2048
177398c6147d
Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
719 } |
177398c6147d
Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
720 return NULL; |
177398c6147d
Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
721 } |
177398c6147d
Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2046
diff
changeset
|
722 |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
723 // public bool RiType_isInitialized(HotSpotResolvedType klass); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
724 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
725 TRACE_graal_3("CompilerToVM::RiType_isInitialized"); |
3011
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
726 klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::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
|
727 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
|
728 return instanceKlass::cast(klass)->is_initialized(); |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
729 } |
f00918f35c7f
inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents:
2990
diff
changeset
|
730 |
2058
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
731 // public RiType RiType_arrayOf(HotSpotTypeResolved klass); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
732 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1arrayOf(JNIEnv *, jobject, jobject klass) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
733 TRACE_graal_3("CompilerToVM::RiType_arrayOf"); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
734 VM_ENTRY_MARK; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
735 |
2058
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
736 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))); |
3674
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3670
diff
changeset
|
737 KlassHandle arr = klass_handle->array_klass(THREAD); |
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3670
diff
changeset
|
738 Handle name = VmIds::toString<Handle>(arr->name(), CHECK_NULL); |
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3670
diff
changeset
|
739 assert(arr->oop_is_array(), ""); |
d3d3dd0a3421
Fixed a regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3670
diff
changeset
|
740 return JNIHandles::make_local(THREAD, GraalCompiler::createHotSpotTypeResolved(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
|
741 } |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
742 |
3701
713131edb435
Return a RiResolvedField array when looking up the fields of a class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3700
diff
changeset
|
743 // public RiResolvedField[] RiType_fields(HotSpotTypeResolved klass); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
744 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_RiType_1fields(JNIEnv *, jobject, jobject klass) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
745 TRACE_graal_3("CompilerToVM::RiType_fields"); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
746 VM_ENTRY_MARK; |
3650
0e8a2a629afb
Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3649
diff
changeset
|
747 ResourceMark rm; |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
748 |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
749 instanceKlassHandle k = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)); |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
750 class MyFieldClosure : public FieldClosure { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
751 public: |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
752 instanceKlassHandle _holder; |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
753 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
|
754 GrowableArray<Handle> _field_array; |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
755 |
3638
e53cfcb230a7
Fixed an issue with the runtime queried escape analysis field array.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3637
diff
changeset
|
756 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
|
757 |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
758 virtual void do_field(fieldDescriptor* fd) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
759 if (!Thread::current()->has_pending_exception()) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
760 if (fd->field_holder() == _holder()) { |
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
761 Handle type = GraalCompiler::get_RiTypeFromSignature(fd->constants(), fd->signature_index(), fd->field_holder(), Thread::current()); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
762 Handle field = VMToCompiler::createRiField(_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
|
763 _field_array.append(field()); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
764 } |
3587
1692a2f9bfc5
Only return declared fields on fields() call.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3586
diff
changeset
|
765 } |
1692a2f9bfc5
Only return declared fields on fields() call.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3586
diff
changeset
|
766 } |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
767 }; |
3638
e53cfcb230a7
Fixed an issue with the runtime queried escape analysis field array.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3637
diff
changeset
|
768 MyFieldClosure closure(k, JNIHandles::resolve(klass)); |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
769 k->do_nonstatic_fields(&closure); |
3701
713131edb435
Return a RiResolvedField array when looking up the fields of a class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3700
diff
changeset
|
770 objArrayHandle field_array = oopFactory::new_objArray(SystemDictionary::RiResolvedField_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
|
771 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
|
772 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
|
773 } |
3637
ff6a991c6e3c
Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3636
diff
changeset
|
774 return JNIHandles::make_local(field_array()); |
3090
536528f48708
more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents:
3055
diff
changeset
|
775 } |
536528f48708
more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents:
3055
diff
changeset
|
776 |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
777 // public RiType getPrimitiveArrayType(CiKind kind); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
778 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
779 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
|
780 VM_ENTRY_MARK; |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
781 BasicType type = GraalCompiler::kindToBasicType(CiKind::typeChar(kind)); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
782 assert(type != T_OBJECT, "primitive type expecteds"); |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
783 Handle result = GraalCompiler::get_RiType(Universe::typeArrayKlassObj(type), CHECK_NULL); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
784 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
|
785 } |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
786 |
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
|
787 // public long getMaxCallTargetOffset(CiRuntimeCall rtcall); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
788 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getMaxCallTargetOffset(JNIEnv *env, jobject, jobject rtcall) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
789 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
|
790 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
|
791 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
|
792 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
|
793 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
|
794 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
|
795 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
|
796 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
|
797 } |
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
|
798 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
|
799 } |
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
|
800 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
801 // public RiType getType(Class<?> javaClass); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
802 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getType(JNIEnv *env, jobject, jobject javaClass) { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
803 TRACE_graal_3("CompilerToVM::getType"); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
804 VM_ENTRY_MARK; |
2058
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
805 oop javaClassOop = JNIHandles::resolve(javaClass); |
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
806 if (javaClassOop == NULL) { |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
807 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
|
808 return NULL; |
2058
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
809 } else if (java_lang_Class::is_primitive(javaClassOop)) { |
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
810 BasicType basicType = java_lang_Class::primitive_type(javaClassOop); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
811 return JNIHandles::make_local(THREAD, VMToCompiler::createRiTypePrimitive((int) basicType, THREAD)); |
2058
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
812 } else { |
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
813 KlassHandle klass = java_lang_Class::as_klassOop(javaClassOop); |
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
814 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
|
815 |
3653
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
816 Handle type = GraalCompiler::createHotSpotTypeResolved(klass, name, CHECK_NULL); |
6aef50c6d967
Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3650
diff
changeset
|
817 return JNIHandles::make_local(THREAD, type()); |
2058
8f033d37798a
Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2057
diff
changeset
|
818 } |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
819 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
820 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
821 |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
822 // helpers used to set fields in the HotSpotVMConfig object |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
823 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
|
824 jfieldID id = env->GetFieldID(env->GetObjectClass(obj), name, sig); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
825 if (id == NULL) { |
3552
aa7b62997aa0
better error message of field not found
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3549
diff
changeset
|
826 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
|
827 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
828 return id; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
829 } |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
830 |
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
|
831 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
|
832 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
|
833 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
|
834 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
|
835 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
|
836 |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
837 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
|
838 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
|
839 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
|
840 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
|
841 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
|
842 |
6223633ce7dd
changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1419
diff
changeset
|
843 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
844 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
|
845 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
|
846 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
847 // public HotSpotVMConfig getConfiguration(); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
848 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getConfiguration(JNIEnv *env, jobject) { |
3586
7604c69a6301
rename com.oracle.max.graal.runtime to com.oracle.max.graal.hotspot
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
3584
diff
changeset
|
849 jclass klass = env->FindClass("com/oracle/max/graal/hotspot/HotSpotVMConfig"); |
1419
7bf6a77b9c5a
implement recent safepoint & exceptionobject ci changes, HotSpotVMConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1415
diff
changeset
|
850 assert(klass != NULL, "HotSpot vm config class not found"); |
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
|
851 jobject config = env->AllocObject(klass); |
1419
7bf6a77b9c5a
implement recent safepoint & exceptionobject ci changes, HotSpotVMConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1415
diff
changeset
|
852 #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
|
853 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
|
854 #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
|
855 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
|
856 #endif |
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
|
857 set_boolean(env, config, "verifyPointers", 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
|
858 set_boolean(env, config, "useFastLocking", UseFastLocking); |
2061
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
859 set_boolean(env, config, "useFastNewObjectArray", UseFastNewObjectArray); |
c0b1d6a44a02
Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2060
diff
changeset
|
860 set_boolean(env, config, "useFastNewTypeArray", UseFastNewTypeArray); |
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
|
861 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
|
862 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
|
863 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
|
864 set_int(env, config, "hubOffset", oopDesc::klass_offset_in_bytes()); |
1422
3483ec571caf
* using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1421
diff
changeset
|
865 set_int(env, config, "arrayLengthOffset", arrayOopDesc::length_offset_in_bytes()); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
866 set_int(env, config, "klassStateOffset", instanceKlass::init_state_offset_in_bytes() + sizeof(oopDesc)); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
867 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
|
868 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
|
869 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
|
870 set_int(env, config, "threadObjectOffset", in_bytes(JavaThread::threadObj_offset())); |
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
|
871 set_int(env, config, "instanceHeaderPrototypeOffset", Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes()); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
872 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
|
873 set_int(env, config, "threadExceptionPcOffset", in_bytes(JavaThread::exception_pc_offset())); |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
874 set_int(env, config, "threadMultiNewArrayStorage", in_bytes(JavaThread::graal_multinewarray_storage_offset())); |
2060
40bcc41390e4
Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents:
2059
diff
changeset
|
875 set_int(env, config, "classMirrorOffset", klassOopDesc::klass_part_offset_in_bytes() + Klass::java_mirror_offset_in_bytes()); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
876 |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1427
diff
changeset
|
877 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
|
878 set_long(env, config, "instanceofStub", VmIds::addStub(Runtime1::entry_for(Runtime1::slow_subtype_check_id))); |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
879 set_long(env, config, "verifyPointerStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_verify_pointer_id))); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
880 set_long(env, config, "newInstanceStub", VmIds::addStub(Runtime1::entry_for(Runtime1::fast_new_instance_init_check_id))); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
881 set_long(env, config, "unresolvedNewInstanceStub", VmIds::addStub(Runtime1::entry_for(Runtime1::new_instance_id))); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
882 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
|
883 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
|
884 set_long(env, config, "newMultiArrayStub", VmIds::addStub(Runtime1::entry_for(Runtime1::new_multi_array_id))); |
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
885 set_long(env, config, "loadKlassStub", VmIds::addStub(Runtime1::entry_for(Runtime1::load_klass_patching_id))); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
886 set_long(env, config, "accessFieldStub", VmIds::addStub(Runtime1::entry_for(Runtime1::access_field_patching_id))); |
1428
695451afc619
refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1427
diff
changeset
|
887 set_long(env, config, "resolveStaticCallStub", VmIds::addStub(SharedRuntime::get_resolve_static_call_stub())); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
888 set_long(env, config, "inlineCacheMissStub", VmIds::addStub(SharedRuntime::get_ic_miss_stub())); |
2891
75a99b4f1c98
Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
2890
diff
changeset
|
889 set_long(env, config, "unwindExceptionStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_unwind_exception_call_id))); |
1429
abc670a709dc
* -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1428
diff
changeset
|
890 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
|
891 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
|
892 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
|
893 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
|
894 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
|
895 set_long(env, config, "fastMonitorExitStub", VmIds::addStub(Runtime1::entry_for(Runtime1::graal_monitorexit_id))); |
1434
72cfb36c6bb2
* enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1433
diff
changeset
|
896 set_long(env, config, "safepointPollingAddress", (jlong)(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size()))); |
3569
76a7f1732bb0
New runtime parameter: runtimeCallStackSize (size on the stack that must be left empty in case of runtime calls)
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3563
diff
changeset
|
897 set_int(env, config, "runtimeCallStackSize", (jint)frame::arg_reg_save_area_bytes); |
3571
a72615456c50
Add two VM configs for intrinsifications.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3570
diff
changeset
|
898 set_int(env, config, "klassModifierFlagsOffset", Klass::modifier_flags_offset_in_bytes() + sizeof(oopDesc)); |
a72615456c50
Add two VM configs for intrinsifications.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3570
diff
changeset
|
899 set_int(env, config, "klassOopOffset", java_lang_Class::klass_offset_in_bytes()); |
3549
25765a764212
Add support for polling mark in code installer
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
3487
diff
changeset
|
900 set_boolean(env, config, "isPollingPageFar", Assembler::is_polling_page_far()); |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
901 |
3683
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
902 set_int(env, config, "nmethodEntryOffset", nmethod::verified_entry_point_offset()); |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
903 |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
904 BarrierSet* bs = Universe::heap()->barrier_set(); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
905 switch (bs->kind()) { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
906 case BarrierSet::CardTableModRef: |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
907 case BarrierSet::CardTableExtension: { |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
908 jlong base = (jlong)((CardTableModRefBS*)bs)->byte_map_base; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
909 assert(base != 0, "unexpected byte_map_base"); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
910 set_long(env, config, "cardtableStartAddress", base); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
911 set_int(env, config, "cardtableShift", CardTableModRefBS::card_shift); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
912 break; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
913 } |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
914 case BarrierSet::ModRef: |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
915 case BarrierSet::Other: |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
916 set_long(env, config, "cardtableStartAddress", 0); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
917 set_int(env, config, "cardtableShift", 0); |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
918 // No post barriers |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
919 break; |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
920 #ifndef SERIALGC |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
921 case BarrierSet::G1SATBCT: |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
922 case BarrierSet::G1SATBCTLogging: |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
923 #endif // SERIALGC |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
924 default: |
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
925 ShouldNotReachHere(); |
2926
0e3ec0a4eda4
RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents:
2901
diff
changeset
|
926 break; |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
927 } |
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
|
928 |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
929 jintArray arrayOffsets = env->NewIntArray(basicTypeCount); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
930 for (int i=0; i<basicTypeCount; i++) { |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
931 jint offset = arrayOopDesc::base_offset_in_bytes(basicTypes[i]); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
932 env->SetIntArrayRegion(arrayOffsets, i, 1, &offset); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
933 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
934 set_int_array(env, config, "arrayOffsets", arrayOffsets); |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
935 set_int(env, config, "arrayClassElementOffset", objArrayKlass::element_klass_offset_in_bytes() + sizeof(oopDesc)); |
1419
7bf6a77b9c5a
implement recent safepoint & exceptionobject ci changes, HotSpotVMConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1415
diff
changeset
|
936 return config; |
7bf6a77b9c5a
implement recent safepoint & exceptionobject ci changes, HotSpotVMConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1415
diff
changeset
|
937 } |
1412
9195b99c841b
Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1410
diff
changeset
|
938 |
3683
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
939 // public HotSpotCompiledMethod installMethod(HotSpotTargetMethod targetMethod, boolean installCode); |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
940 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_installMethod(JNIEnv *jniEnv, jobject, jobject targetMethod, jboolean install_code) { |
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
|
941 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
|
942 ResourceMark rm; |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3669
diff
changeset
|
943 HandleMark hm; |
3667
e755289380e3
Removed a safepoint possibility in the code installer when creating CiVirtualObject objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3663
diff
changeset
|
944 Handle targetMethodHandle = JNIHandles::resolve(targetMethod); |
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
|
945 nmethod* nm = NULL; |
3636
c7d4198a9bce
Use GraalEnv for installing code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3632
diff
changeset
|
946 Arena arena; |
c7d4198a9bce
Use GraalEnv for installing code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3632
diff
changeset
|
947 ciEnv env(&arena); |
3667
e755289380e3
Removed a safepoint possibility in the code installer when creating CiVirtualObject objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3663
diff
changeset
|
948 CodeInstaller installer(targetMethodHandle, nm, install_code != 0); |
3683
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
949 |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
950 // if install_code is true then we installed the code into the given method, no need to return an RiCompiledMethod |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
951 if (!install_code && nm != NULL) { |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
952 instanceKlass::cast(HotSpotCompiledMethod::klass())->initialize(CHECK_NULL); |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
953 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
|
954 assert(obj() != NULL, "must succeed in allocating instance"); |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
955 HotSpotCompiledMethod::set_nmethod(obj, (jlong) nm); |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
956 HotSpotCompiledMethod::set_method(obj, HotSpotTargetMethod::method(targetMethod)); |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
957 nm->set_graal_compiled_method(obj()); |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
958 return JNIHandles::make_local(obj()); |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
959 } else { |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
960 return NULL; |
345c3bbf9c3c
store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents:
3632
diff
changeset
|
961 } |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
962 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
963 |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
964 // public long installStub(HotSpotTargetMethod targetMethod, String name); |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
965 JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_installStub(JNIEnv *jniEnv, jobject, jobject targetMethod) { |
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
|
966 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
|
967 ResourceMark rm; |
3670
f198b24093f3
put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3669
diff
changeset
|
968 HandleMark hm; |
3667
e755289380e3
Removed a safepoint possibility in the code installer when creating CiVirtualObject objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3663
diff
changeset
|
969 Handle targetMethodHandle = JNIHandles::resolve(targetMethod); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
970 jlong id; |
3636
c7d4198a9bce
Use GraalEnv for installing code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3632
diff
changeset
|
971 Arena arena; |
c7d4198a9bce
Use GraalEnv for installing code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3632
diff
changeset
|
972 ciEnv env(&arena); |
3667
e755289380e3
Removed a safepoint possibility in the code installer when creating CiVirtualObject objects.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
3663
diff
changeset
|
973 CodeInstaller installer(targetMethodHandle, id); |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
974 return id; |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
975 } |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
976 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
977 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
978 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
979 #define CC (char*) /*cast a literal from (const char*)*/ |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
980 #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
|
981 |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
982 #define PROXY "J" |
4199
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4197
diff
changeset
|
983 #define TYPE "Lcom/oracle/max/cri/ri/RiType;" |
4197
b765172082ac
Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4176
diff
changeset
|
984 #define RESOLVED_TYPE "Lcom/oracle/max/graal/hotspot/ri/HotSpotTypeResolved;" |
4199
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4197
diff
changeset
|
985 #define METHOD "Lcom/oracle/max/cri/ri/RiMethod;" |
4197
b765172082ac
Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4176
diff
changeset
|
986 #define RESOLVED_METHOD "Lcom/oracle/max/graal/hotspot/ri/HotSpotMethodResolved;" |
3555
22d11b3bc561
Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents:
3552
diff
changeset
|
987 #define REFLECT_METHOD "Ljava/lang/reflect/Method;" |
4199
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4197
diff
changeset
|
988 #define TYPE_PROFILE "Lcom/oracle/max/cri/ri/RiTypeProfile;" |
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4197
diff
changeset
|
989 #define SIGNATURE "Lcom/oracle/max/cri/ri/RiSignature;" |
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4197
diff
changeset
|
990 #define FIELD "Lcom/oracle/max/cri/ri/RiField;" |
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4197
diff
changeset
|
991 #define RESOLVED_FIELD "Lcom/oracle/max/cri/ri/RiResolvedField;" |
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4197
diff
changeset
|
992 #define CONSTANT_POOL "Lcom/oracle/max/cri/ri/RiConstantPool;" |
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4197
diff
changeset
|
993 #define EXCEPTION_HANDLERS "[Lcom/oracle/max/cri/ri/RiExceptionHandler;" |
3586
7604c69a6301
rename com.oracle.max.graal.runtime to com.oracle.max.graal.hotspot
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
3584
diff
changeset
|
994 #define TARGET_METHOD "Lcom/oracle/max/graal/hotspot/HotSpotTargetMethod;" |
7604c69a6301
rename com.oracle.max.graal.runtime to com.oracle.max.graal.hotspot
Gilles Duboscq <gilles.m.duboscq@gmail.com>
parents:
3584
diff
changeset
|
995 #define CONFIG "Lcom/oracle/max/graal/hotspot/HotSpotVMConfig;" |
4197
b765172082ac
Move HotSpotMethod* and HotSpotType* implementations into ri subpackage.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4176
diff
changeset
|
996 #define HS_METHOD "Lcom/oracle/max/graal/hotspot/ri/HotSpotMethod;" |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
997 #define HS_COMP_METHOD "Lcom/oracle/max/graal/hotspot/ri/HotSpotCompiledMethod;" |
4199
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4197
diff
changeset
|
998 #define CI_CONSTANT "Lcom/oracle/max/cri/ci/CiConstant;" |
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4197
diff
changeset
|
999 #define CI_KIND "Lcom/oracle/max/cri/ci/CiKind;" |
aaac4894175c
Renamed cri packages from sun to oracle.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4197
diff
changeset
|
1000 #define CI_RUNTIME_CALL "Lcom/oracle/max/cri/ci/CiRuntimeCall;" |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
1001 #define STRING "Ljava/lang/String;" |
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
1002 #define OBJECT "Ljava/lang/Object;" |
1433
efba53f86c4f
various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1432
diff
changeset
|
1003 #define CLASS "Ljava/lang/Class;" |
1423
760213a60e8b
* rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents:
1422
diff
changeset
|
1004 |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1005 JNINativeMethod CompilerToVM_methods[] = { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1006 {CC"RiMethod_code", CC"("RESOLVED_METHOD")[B", FN_PTR(RiMethod_1code)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1007 {CC"RiMethod_signature", CC"("RESOLVED_METHOD")"STRING, FN_PTR(RiMethod_1signature)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1008 {CC"RiMethod_exceptionHandlers", CC"("RESOLVED_METHOD")"EXCEPTION_HANDLERS, FN_PTR(RiMethod_1exceptionHandlers)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1009 {CC"RiMethod_hasBalancedMonitors", CC"("RESOLVED_METHOD")Z", FN_PTR(RiMethod_1hasBalancedMonitors)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1010 {CC"RiMethod_uniqueConcreteMethod", CC"("RESOLVED_METHOD")"METHOD, FN_PTR(RiMethod_1uniqueConcreteMethod)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1011 {CC"getRiMethod", CC"("REFLECT_METHOD")"METHOD, FN_PTR(getRiMethod)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1012 {CC"RiMethod_typeProfile", CC"("RESOLVED_METHOD"I)"TYPE_PROFILE, FN_PTR(RiMethod_2typeProfile)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1013 {CC"RiMethod_branchProbability", CC"("RESOLVED_METHOD"I)D", FN_PTR(RiMethod_2branchProbability)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1014 {CC"RiMethod_switchProbability", CC"("RESOLVED_METHOD"I)[D", FN_PTR(RiMethod_2switchProbability)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1015 {CC"RiMethod_invocationCount", CC"("RESOLVED_METHOD")I", FN_PTR(RiMethod_1invocationCount)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1016 {CC"RiMethod_exceptionProbability", CC"("RESOLVED_METHOD"I)I", FN_PTR(RiMethod_2exceptionProbability)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1017 {CC"RiMethod_hasCompiledCode", CC"("RESOLVED_METHOD")Z", FN_PTR(RiMethod_1hasCompiledCode)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1018 {CC"RiSignature_lookupType", CC"("STRING RESOLVED_TYPE")"TYPE, FN_PTR(RiSignature_1lookupType)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1019 {CC"RiConstantPool_lookupConstant", CC"("RESOLVED_TYPE"I)"OBJECT, FN_PTR(RiConstantPool_1lookupConstant)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1020 {CC"RiConstantPool_lookupMethod", CC"("RESOLVED_TYPE"IB)"METHOD, FN_PTR(RiConstantPool_1lookupMethod)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1021 {CC"RiConstantPool_lookupType", CC"("RESOLVED_TYPE"I)"TYPE, FN_PTR(RiConstantPool_1lookupType)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1022 {CC"RiConstantPool_loadReferencedType", CC"("RESOLVED_TYPE"IB)V", FN_PTR(RiConstantPool_1loadReferencedType)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1023 {CC"RiConstantPool_lookupField", CC"("RESOLVED_TYPE"IB)"FIELD, FN_PTR(RiConstantPool_1lookupField)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1024 {CC"RiType_resolveMethodImpl", CC"("RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(RiType_3resolveMethodImpl)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1025 {CC"RiType_isSubtypeOf", CC"("RESOLVED_TYPE TYPE")Z", FN_PTR(RiType_2isSubtypeOf)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1026 {CC"RiType_componentType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(RiType_1componentType)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1027 {CC"RiType_uniqueConcreteSubtype", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(RiType_1uniqueConcreteSubtype)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1028 {CC"RiType_superType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(RiType_1superType)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1029 {CC"RiType_arrayOf", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(RiType_1arrayOf)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1030 {CC"RiType_fields", CC"("RESOLVED_TYPE")["RESOLVED_FIELD, FN_PTR(RiType_1fields)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1031 {CC"RiType_isInitialized", CC"("RESOLVED_TYPE")Z", FN_PTR(RiType_1isInitialized)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1032 {CC"getPrimitiveArrayType", CC"("CI_KIND")"TYPE, FN_PTR(getPrimitiveArrayType)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1033 {CC"getMaxCallTargetOffset", CC"("CI_RUNTIME_CALL")J", FN_PTR(getMaxCallTargetOffset)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1034 {CC"getType", CC"("CLASS")"TYPE, FN_PTR(getType)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1035 {CC"getConfiguration", CC"()"CONFIG, FN_PTR(getConfiguration)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1036 {CC"installMethod", CC"("TARGET_METHOD"Z)"HS_COMP_METHOD, FN_PTR(installMethod)}, |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1037 {CC"installStub", CC"("TARGET_METHOD")"PROXY, FN_PTR(installStub)} |
1412
9195b99c841b
Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1410
diff
changeset
|
1038 }; |
9195b99c841b
Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
1410
diff
changeset
|
1039 |
4220
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1040 int CompilerToVM_methods_count() { |
5c80ccb80036
Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
4199
diff
changeset
|
1041 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
|
1042 } |
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
|
1043 |