annotate src/share/vm/c1x/c1x_VMEntries.cpp @ 2499:ad9b14650e15

Fixed an issue with RiType.superType (wrong cast in the C++ part).
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Tue, 26 Apr 2011 16:46:23 +0200
parents 4e5515d09314
children 6594e6d8bfe7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1410
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
1 /*
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
2 * Copyright 2000-2010 Sun Microsystems, Inc. All Rights Reserved.
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
4 *
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
7 * published by the Free Software Foundation.
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
8 *
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
13 * accompanied this code).
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
14 *
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
15 * You should have received a copy of the GNU General Public License version
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
18 *
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
21 * have any questions.
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 */
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
24
2045
9c96c873c42b Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1942
diff changeset
25 #include "precompiled.hpp"
9c96c873c42b Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1942
diff changeset
26 #include "c1x/c1x_VMEntries.hpp"
9c96c873c42b Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1942
diff changeset
27 #include "c1x/c1x_Compiler.hpp"
2046
cf75612bdaa5 Renamed file.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2045
diff changeset
28 #include "c1x/c1x_JavaAccess.hpp"
2045
9c96c873c42b Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1942
diff changeset
29 #include "c1x/c1x_CodeInstaller.hpp"
9c96c873c42b Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1942
diff changeset
30 #include "c1x/c1x_VMExits.hpp"
9c96c873c42b Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1942
diff changeset
31 #include "c1x/c1x_VmIds.hpp"
9c96c873c42b Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1942
diff changeset
32 #include "c1/c1_Runtime1.hpp"
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
33
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
34 // public byte[] RiMethod_code(long vmId);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
35 JNIEXPORT jbyteArray JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1code(JNIEnv *env, jobject, jlong vmId) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
36 TRACE_C1X_3("VMEntries::RiMethod_code");
1463
7bc14f75a077 Another handle bug.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1461
diff changeset
37 methodHandle method = VmIds::get<methodOop>(vmId);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
38 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
39 jbyteArray result = env->NewByteArray(code_size);
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
40 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
41 return result;
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
42 }
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
43
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
44 // public int RiMethod_maxStackSize(long vmId);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
45 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxStackSize(JNIEnv *, jobject, jlong vmId) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
46 TRACE_C1X_3("VMEntries::RiMethod_maxStackSize");
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1427
diff changeset
47 return VmIds::get<methodOop>(vmId)->max_stack();
1413
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
48 }
1412
9195b99c841b Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1410
diff changeset
49
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
50 // public int RiMethod_maxLocals(long vmId);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
51 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxLocals(JNIEnv *, jobject, jlong vmId) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
52 TRACE_C1X_3("VMEntries::RiMethod_maxLocals");
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1427
diff changeset
53 return VmIds::get<methodOop>(vmId)->max_locals();
1413
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
54 }
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
55
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
56 // public RiType RiMethod_holder(long vmId);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
57 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1holder(JNIEnv *, jobject, jlong vmId) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
58 TRACE_C1X_3("VMEntries::RiMethod_holder");
1413
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
59 VM_ENTRY_MARK
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
60 KlassHandle klass = VmIds::get<methodOop>(vmId)->method_holder();
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
61 Handle name = VmIds::toString<Handle>(klass->name(), CHECK_NULL);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
62 oop holder = C1XCompiler::createHotSpotTypeResolved(klass, name, CHECK_NULL);
1422
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
63 return JNIHandles::make_local(THREAD, holder);
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
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
66 // public String RiMethod_signature(long vmId);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
67 JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1signature(JNIEnv *env, jobject, jlong vmId) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
68 TRACE_C1X_3("VMEntries::RiMethod_signature");
1422
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
69 VM_ENTRY_MARK
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1427
diff changeset
70 methodOop method = VmIds::get<methodOop>(vmId);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
71 method->constMethod()->exception_table();
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1427
diff changeset
72 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
73 }
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
74
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
75 // public int RiMethod_accessFlags(long vmId);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
76 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1accessFlags(JNIEnv *, jobject, jlong vmId) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
77 TRACE_C1X_3("VMEntries::RiMethod_accessFlags");
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1427
diff changeset
78 return VmIds::get<methodOop>(vmId)->access_flags().as_int();
1422
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
79 }
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
80
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
81 // public RiExceptionHandler[] RiMethod_exceptionHandlers(long vmId);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
82 JNIEXPORT jobjectArray JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1exceptionHandlers(JNIEnv *, jobject, jlong vmId) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
83 TRACE_C1X_3("VMEntries::RiMethod_exceptionHandlers");
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
84 VM_ENTRY_MARK
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
85 methodHandle method = VmIds::get<methodOop>(vmId);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
86 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
87 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
88
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
89 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
90 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
91
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
92 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
93 // 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
94 int base = i * 4;
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
95 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
96 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
97 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
98 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
99 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
100 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
101
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
102 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
103 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
104 } else {
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
105 constantPoolOop cp = instanceKlass::cast(method->method_holder())->constants();
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
106 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(method->method_holder());
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
107 bool is_accessible = false;
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
108 ciKlass *klass = CURRENT_ENV->get_klass_by_index(cp, catch_class_index, is_accessible, loading_klass);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
109 oop catch_class = C1XCompiler::get_RiType(klass, method->method_holder(), CHECK_NULL);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
110
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
111 HotSpotExceptionHandler::set_catchClass(entry, catch_class);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
112 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
113 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
114 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
115
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
116 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
117 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
118
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
119 // public boolean RiMethod_hasBalancedMonitors(long vmId);
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
120 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1hasBalancedMonitors(JNIEnv *, jobject, jlong vmId) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
121 TRACE_C1X_3("VMEntries::RiMethod_hasBalancedMonitors");
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
122 ciMethod* cimethod;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
123 {
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
124 VM_ENTRY_MARK;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
125 cimethod = (ciMethod*)CURRENT_ENV->get_object(VmIds::get<methodOop>(vmId));
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
126 }
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
127 return cimethod->has_balanced_monitors();
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
128 }
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
129
2049
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
130 // public boolean RiMethod_uniqueConcreteMethod(long vmId);
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
131 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1uniqueConcreteMethod(JNIEnv *, jobject, jlong vmId) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
132 TRACE_C1X_3("VMEntries::RiMethod_uniqueConcreteMethod");
2050
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
133 VM_ENTRY_MARK;
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
134 ciMethod* cimethod = (ciMethod*)CURRENT_ENV->get_object(VmIds::get<methodOop>(vmId));
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
135 if (cimethod->holder()->is_interface()) {
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
136 // 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
137 // interface I { void foo(); }
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
138 // 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
139 // 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
140 // 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
141 // class D extends B { }
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
142 // 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
143 return false;
2049
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
144 }
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
145 klassOop klass = (klassOop)cimethod->holder()->get_oop();
2061
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
146 methodHandle method((methodOop)cimethod->get_oop());
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
147 methodHandle unique_concrete;
2050
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
148 {
2061
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
149 ResourceMark rm;
2050
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
150 MutexLocker locker(Compile_lock);
2061
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
151 unique_concrete = methodHandle(Dependencies::find_unique_concrete_method(klass, method()));
2050
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
152 }
2061
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
153 if (unique_concrete.is_null()) {
2049
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
154 return NULL;
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
155 }
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
156
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
157 Handle name = VmIds::toString<Handle>(unique_concrete->name(), CHECK_NULL);
2061
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
158 oop method_resolved = VMExits::createRiMethodResolved(VmIds::add<methodOop>(unique_concrete()), name, CHECK_NULL);
2049
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
159 return JNIHandles::make_local(THREAD, method_resolved);
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
160 }
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
161
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
162 // public RiType RiSignature_lookupType(String returnType, HotSpotTypeResolved accessingClass);
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
163 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
164 TRACE_C1X_3("VMEntries::RiSignature_lookupType");
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
165 VM_ENTRY_MARK;
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
166
2182
9569fdf936ff Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2061
diff changeset
167 Symbol* nameSymbol = VmIds::toSymbol(jname);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
168 Handle name = JNIHandles::resolve(jname);
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
169
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
170 oop result;
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
171 if (nameSymbol == vmSymbols::int_signature()) {
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
172 result = VMExits::createRiTypePrimitive((int) T_INT, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
173 } else if (nameSymbol == vmSymbols::long_signature()) {
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
174 result = VMExits::createRiTypePrimitive((int) T_LONG, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
175 } else if (nameSymbol == vmSymbols::bool_signature()) {
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
176 result = VMExits::createRiTypePrimitive((int) T_BOOLEAN, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
177 } else if (nameSymbol == vmSymbols::char_signature()) {
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
178 result = VMExits::createRiTypePrimitive((int) T_CHAR, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
179 } else if (nameSymbol == vmSymbols::short_signature()) {
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
180 result = VMExits::createRiTypePrimitive((int) T_SHORT, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
181 } else if (nameSymbol == vmSymbols::byte_signature()) {
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
182 result = VMExits::createRiTypePrimitive((int) T_BYTE, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
183 } else if (nameSymbol == vmSymbols::double_signature()) {
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
184 result = VMExits::createRiTypePrimitive((int) T_DOUBLE, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
185 } else if (nameSymbol == vmSymbols::float_signature()) {
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
186 result = VMExits::createRiTypePrimitive((int) T_FLOAT, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
187 } else {
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
188 klassOop resolved_type = NULL;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
189 // 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
190 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
191 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
192 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
193 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
194 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
195 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
196 }
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
197 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
198 if (HAS_PENDING_EXCEPTION) {
fe69dec9a1ed Added support for CompileTheWorld.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1479
diff changeset
199 CLEAR_PENDING_EXCEPTION;
fe69dec9a1ed Added support for CompileTheWorld.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1479
diff changeset
200 resolved_type = NULL;
fe69dec9a1ed Added support for CompileTheWorld.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1479
diff changeset
201 }
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
202 }
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
203 if (resolved_type != NULL) {
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
204 result = C1XCompiler::createHotSpotTypeResolved(resolved_type, name, CHECK_NULL);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
205 } else {
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
206 result = VMExits::createRiTypeUnresolved(name, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
207 }
1413
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
208 }
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
209
1413
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
210 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
211 }
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
212
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
213 // public Object RiConstantPool_lookupConstant(long vmId, int cpi);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
214 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupConstant(JNIEnv *env, jobject, jlong vmId, jint index) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
215 TRACE_C1X_3("VMEntries::RiConstantPool_lookupConstant");
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
216 VM_ENTRY_MARK;
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
217
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1427
diff changeset
218 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId);
1413
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
219
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
220 oop result = NULL;
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
221 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
222 if (tag.is_int()) {
1470
ef7761803480 Fixes to get running again after C1X changes to pointer maps and register configuration.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1465
diff changeset
223 result = VMExits::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
224 } else if (tag.is_long()) {
1470
ef7761803480 Fixes to get running again after C1X changes to pointer maps and register configuration.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1465
diff changeset
225 result = VMExits::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
226 } else if (tag.is_float()) {
1422
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
227 result = VMExits::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
228 } else if (tag.is_double()) {
1422
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
229 result = VMExits::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
230 } 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
231 oop string = NULL;
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
232 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
233 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
234 } else {
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
235 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
236 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
237 CLEAR_PENDING_EXCEPTION;
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
238 // 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
239 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
240 return NULL;
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
241 }
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
242 }
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
243 result = VMExits::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
244 } else if (tag.is_klass() || tag.is_unresolved_klass()) {
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
245 bool ignore;
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
246 ciInstanceKlass* accessor = (ciInstanceKlass*) ciEnv::current()->get_object(cp->pool_holder());
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
247 ciKlass* klass = ciEnv::current()->get_klass_by_index(cp, index, ignore, accessor);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
248 result = C1XCompiler::get_RiType(klass, cp->pool_holder(), CHECK_NULL);
1413
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
249 } 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
250 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
251 assert(obj->is_instance(), "must be an instance");
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
252 result = VMExits::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
253 } else {
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
254 ShouldNotReachHere();
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
255 }
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
256
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
257 return JNIHandles::make_local(THREAD, result);
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
258 }
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
259
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
260 // public RiMethod RiConstantPool_lookupMethod(long vmId, int cpi, byte byteCode);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
261 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jlong vmId, jint index, jbyte byteCode) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
262 TRACE_C1X_3("VMEntries::RiConstantPool_lookupMethod");
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
263 VM_ENTRY_MARK;
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
264
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1481
diff changeset
265 index = C1XCompiler::to_cp_index_u2(index);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
266 constantPoolHandle cp = VmIds::get<constantPoolOop>(vmId);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
267
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
268 Bytecodes::Code bc = (Bytecodes::Code) (((int) byteCode) & 0xFF);
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
269 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder());
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
270 ciMethod *cimethod = CURRENT_ENV->get_method_by_index(cp, index, bc, loading_klass);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
271 if (cimethod->is_loaded()) {
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
272 methodOop method = (methodOop) cimethod->get_oop();
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
273 Handle name = VmIds::toString<Handle>(method->name(), CHECK_NULL);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
274 return JNIHandles::make_local(THREAD, VMExits::createRiMethodResolved(VmIds::add<methodOop>(method), name, THREAD));
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
275 } else {
2182
9569fdf936ff Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2061
diff changeset
276 Handle name = VmIds::toString<Handle>(cimethod->name()->get_symbol(), CHECK_NULL);
9569fdf936ff Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2061
diff changeset
277 Handle signature = VmIds::toString<Handle>(cimethod->signature()->as_symbol()->get_symbol(), CHECK_NULL);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
278 Handle holder = C1XCompiler::get_RiType(cimethod->holder(), cp->klass(), THREAD);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
279 return JNIHandles::make_local(THREAD, VMExits::createRiMethodUnresolved(name, signature, holder, THREAD));
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
280 }
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
281 }
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
282
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
283 // public RiSignature RiConstantPool_lookupSignature(long vmId, int cpi);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
284 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupSignature(JNIEnv *env, jobject, jlong vmId, jint index) {
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
285 fatal("currently unsupported");
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
286 return NULL;
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
287 }
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
288
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
289 // public RiType RiConstantPool_lookupType(long vmId, int cpi);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
290 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupType(JNIEnv *env, jobject, jlong vmId, jint index) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
291 TRACE_C1X_3("VMEntries::RiConstantPool_lookupType");
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
292 VM_ENTRY_MARK;
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
293
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1427
diff changeset
294 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
295
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
296 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder());
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
297 bool is_accessible = false;
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
298 ciKlass *klass = CURRENT_ENV->get_klass_by_index(cp, index, is_accessible, loading_klass);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
299 return JNIHandles::make_local(THREAD, C1XCompiler::get_RiType(klass, cp->klass(), THREAD));
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
300 }
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
301
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
302 // public RiField RiConstantPool_lookupField(long vmId, int cpi);
1452
9b22e3e5df8e Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1449
diff changeset
303 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupField(JNIEnv *env, jobject, jlong vmId, jint index, jbyte byteCode) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
304 TRACE_C1X_3("VMEntries::RiConstantPool_lookupField");
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
305 VM_ENTRY_MARK;
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
306
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1481
diff changeset
307 index = C1XCompiler::to_cp_index_u2(index);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1427
diff changeset
308 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
309
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
310 ciInstanceKlass* loading_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(cp->pool_holder());
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
311 ciField *field = CURRENT_ENV->get_field_by_index(loading_klass, index);
2492
4e5515d09314 Fixed merge issues.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2293
diff changeset
312
1452
9b22e3e5df8e Solved an issue with unresolved field patching.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1449
diff changeset
313 Bytecodes::Code code = (Bytecodes::Code)(((int) byteCode) & 0xFF);
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
314 Handle field_handle = C1XCompiler::get_RiField(field, loading_klass, cp->pool_holder(), code, THREAD);
2057
89bf01e6b049 Treat C1XOptions fields as final.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2050
diff changeset
315 bool is_constant = field->is_constant();
89bf01e6b049 Treat C1XOptions fields as final.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2050
diff changeset
316 if (is_constant && field->is_static()) {
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
317 ciConstant constant = field->constant_value();
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
318 oop constant_object = NULL;
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
319 switch (constant.basic_type()) {
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
320 case T_OBJECT:
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
321 case T_ARRAY:
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
322 {
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
323 ciObject* obj = constant.as_object();
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
324 if (obj->is_null_object()) {
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
325 constant_object = VMExits::createCiConstantObject(NULL, CHECK_0);
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
326 } else if (obj->can_be_constant()) {
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
327 constant_object = VMExits::createCiConstantObject(constant.as_object()->get_oop(), CHECK_0);
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
328 }
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
329 }
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
330 break;
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
331 case T_DOUBLE:
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
332 constant_object = VMExits::createCiConstantDouble(constant.as_double(), CHECK_0);
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
333 break;
1479
71cd4b9610eb Two fixes for DaCapo / SpecJVM2008 runs.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1477
diff changeset
334 case T_FLOAT:
71cd4b9610eb Two fixes for DaCapo / SpecJVM2008 runs.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1477
diff changeset
335 constant_object = VMExits::createCiConstantFloat(constant.as_float(), CHECK_0);
71cd4b9610eb Two fixes for DaCapo / SpecJVM2008 runs.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1477
diff changeset
336 break;
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
337 case T_LONG:
1470
ef7761803480 Fixes to get running again after C1X changes to pointer maps and register configuration.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1465
diff changeset
338 constant_object = VMExits::createCiConstant(CiKind::Long(), constant.as_long(), CHECK_0);
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
339 break;
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
340 case T_INT:
1470
ef7761803480 Fixes to get running again after C1X changes to pointer maps and register configuration.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1465
diff changeset
341 constant_object = VMExits::createCiConstant(CiKind::Int(), constant.as_int(), CHECK_0);
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
342 break;
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
343 case T_SHORT:
1470
ef7761803480 Fixes to get running again after C1X changes to pointer maps and register configuration.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1465
diff changeset
344 constant_object = VMExits::createCiConstant(CiKind::Short(), constant.as_int(), CHECK_0);
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
345 break;
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
346 case T_CHAR:
1470
ef7761803480 Fixes to get running again after C1X changes to pointer maps and register configuration.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1465
diff changeset
347 constant_object = VMExits::createCiConstant(CiKind::Char(), constant.as_int(), CHECK_0);
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
348 break;
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
349 case T_BYTE:
1470
ef7761803480 Fixes to get running again after C1X changes to pointer maps and register configuration.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1465
diff changeset
350 constant_object = VMExits::createCiConstant(CiKind::Byte(), constant.as_int(), CHECK_0);
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
351 break;
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
352 case T_BOOLEAN:
1470
ef7761803480 Fixes to get running again after C1X changes to pointer maps and register configuration.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1465
diff changeset
353 constant_object = VMExits::createCiConstant(CiKind::Boolean(), constant.as_int(), CHECK_0);
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
354 break;
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
355 default:
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
356 constant.print();
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
357 fatal("Unhandled constant");
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
358 }
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
359 if (constant_object != NULL) {
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
360 HotSpotField::set_constant(field_handle, constant_object);
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
361 }
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
362 }
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
363 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
364 }
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
365
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
366 // public RiConstantPool RiType_constantPool(HotSpotTypeResolved klass);
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
367 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool(JNIEnv *, jobject, jobject 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
368 TRACE_C1X_3("VMEntries::RiType_constantPool");
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
369 VM_ENTRY_MARK;
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
370
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
371 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
372 constantPoolOop constantPool = ((instanceKlass*)java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass))->klass_part())->constants();
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1427
diff changeset
373 return JNIHandles::make_local(VMExits::createRiConstantPool(VmIds::add<constantPoolOop>(constantPool), THREAD));
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
374 }
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
375
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
376 // public RiMethod RiType_resolveMethodImpl(HotSpotTypeResolved klass, String name, String signature);
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
377 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_3resolveMethodImpl(JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
378 TRACE_C1X_3("VMEntries::RiType_resolveMethodImpl");
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
379 VM_ENTRY_MARK;
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
380
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
381 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
382 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
383 Symbol* name_symbol = VmIds::toSymbol(name);
9569fdf936ff Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2061
diff changeset
384 Symbol* signature_symbol = VmIds::toSymbol(signature);
1477
30e1f67703da Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1470
diff changeset
385 methodOop method = klass->klass_part()->lookup_method(name_symbol, signature_symbol);
30e1f67703da Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1470
diff changeset
386 if (method == NULL) {
30e1f67703da Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1470
diff changeset
387 if (TraceC1X >= 3) {
30e1f67703da Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1470
diff changeset
388 ResourceMark rm;
2492
4e5515d09314 Fixed merge issues.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2293
diff changeset
389 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
390 }
30e1f67703da Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1470
diff changeset
391 return NULL;
30e1f67703da Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1470
diff changeset
392 }
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
393 return JNIHandles::make_local(THREAD, VMExits::createRiMethodResolved(VmIds::add<methodOop>(method), Handle(JNIHandles::resolve(name)), THREAD));
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
394 }
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
395
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
396 // public boolean RiType_isSubtypeOf(HotSpotTypeResolved klass, RiType other);
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
397 JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_2isSubtypeOf(JNIEnv *, jobject, jobject klass, jobject jother) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
398 TRACE_C1X_3("VMEntries::RiType_isSubtypeOf");
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
399 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
400 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
401 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
402 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
403 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
404 if (thisKlass->klass_part()->oop_is_instance_slow()) {
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
405 return instanceKlass::cast(thisKlass)->is_subtype_of(otherKlass);
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
406 } else if (thisKlass->klass_part()->oop_is_array()) {
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
407 return arrayKlass::cast(thisKlass)->is_subtype_of(otherKlass);
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
408 } else {
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
409 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
410 return false;
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
411 }
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
412 }
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
413
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
414 // public RiType RiType_componentType(HotSpotResolvedType klass);
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
415 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1componentType(JNIEnv *, jobject, jobject 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
416 TRACE_C1X_3("VMEntries::RiType_componentType");
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
417 ciArrayKlass* array_klass;
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
418 {
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
419 VM_ENTRY_MARK;
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
420 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
421 array_klass = (ciArrayKlass *) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)));
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
422 }
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
423 ciType* element_type = array_klass->element_type();
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
424
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
425 VM_ENTRY_MARK;
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
426 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
427 return JNIHandles::make_local(C1XCompiler::get_RiType(element_type, java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)), THREAD));
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
428 }
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
429
2293
e3c42b8de67e Removed a reference to getRiType(Class c) and some checkstyle fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2289
diff changeset
430 // public RiType RiType_superType(HotSpotResolvedType klass);
e3c42b8de67e Removed a reference to getRiType(Class c) and some checkstyle fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2289
diff changeset
431 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1superType(JNIEnv *, jobject, jobject 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
432 TRACE_C1X_3("VMEntries::RiType_superType");
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
433 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
434 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)));
e3c42b8de67e Removed a reference to getRiType(Class c) and some checkstyle fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2289
diff changeset
435 ciInstanceKlass* k = NULL;
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
436
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
437 if (klass_handle->oop_is_array()) {
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
438 k = (ciInstanceKlass *) CURRENT_ENV->get_object(SystemDictionary::Object_klass());
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
439 } else {
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
440 guarantee(klass_handle->oop_is_instance(), "must be instance klass");
2293
e3c42b8de67e Removed a reference to getRiType(Class c) and some checkstyle fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2289
diff changeset
441 k = (ciInstanceKlass *) CURRENT_ENV->get_object(klass_handle());
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
442 k = k->super();
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
443 }
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
444
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
445 if (k != NULL) {
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
446 return JNIHandles::make_local(C1XCompiler::get_RiType(k, klass_handle, THREAD));
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
447 } else {
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
448 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
449 }
e3c42b8de67e Removed a reference to getRiType(Class c) and some checkstyle fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2289
diff changeset
450 }
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
451
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
452 // public RiType RiType_uniqueConcreteSubtype(HotSpotResolvedType klass);
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
453 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject 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
454 TRACE_C1X_3("VMEntries::RiType_uniqueConcreteSubtype");
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
455 Thread* THREAD = Thread::current();
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
456 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)));
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
457 ciInstanceKlass* k = NULL;
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
458 {
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
459 VM_ENTRY_MARK;
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
460 k = (ciInstanceKlass *) CURRENT_ENV->get_object(klass_handle());
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
461 }
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
462
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
463 if (k->is_abstract()) {
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
464 ciInstanceKlass* sub = k->unique_concrete_subklass();
2050
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
465 if (sub != NULL && sub->is_leaf_type()) {
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
466 VM_ENTRY_MARK;
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
467 return JNIHandles::make_local(C1XCompiler::get_RiType(sub, klass_handle, THREAD));
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
468 }
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
469 } else if (k->is_leaf_type()) {
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
470 assert(!k->is_interface(), "");
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
471 return klass;
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
472 }
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
473
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
474 return NULL;
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
475 }
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
476
2058
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
477 // public RiType RiType_arrayOf(HotSpotTypeResolved klass);
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
478 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1arrayOf(JNIEnv *, jobject, jobject 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
479 TRACE_C1X_3("VMEntries::RiType_arrayOf");
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
480 VM_ENTRY_MARK;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
481
2058
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
482 KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(klass)));
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
483 KlassHandle array = klass_handle->array_klass(THREAD);
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
484 Handle name = VmIds::toString<Handle>(array->name(), CHECK_NULL);
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
485 return JNIHandles::make_local(THREAD, C1XCompiler::createHotSpotTypeResolved(array, 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
486 }
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
487
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
488 // public RiType getPrimitiveArrayType(CiKind kind);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
489 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
490 TRACE_C1X_3("VMEntries::VMEntries_getPrimitiveArrayType");
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
491 VM_ENTRY_MARK;
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
492 BasicType type = C1XCompiler::kindToBasicType(CiKind::typeChar(kind));
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
493 assert(type != T_OBJECT, "primitive type expecteds");
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
494 ciKlass* klass = ciTypeArrayKlass::make(type);
2215
999f8086cc4f More changes to make it compile and work on win64.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 2182
diff changeset
495 return JNIHandles::make_local(THREAD, C1XCompiler::get_RiType(klass, KlassHandle(), THREAD));
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
496 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
497
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
498 // public RiType getType(Class<?> javaClass);
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
499 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getType(JNIEnv *env, jobject, jobject javaClass) {
2499
ad9b14650e15 Fixed an issue with RiType.superType (wrong cast in the C++ part).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2492
diff changeset
500 TRACE_C1X_3("VMEntries::VMEntries_getType");
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
501 VM_ENTRY_MARK;
2058
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
502 oop javaClassOop = JNIHandles::resolve(javaClass);
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
503 if (javaClassOop == NULL) {
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
504 fatal("argument to VMEntries.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
505 return NULL;
2058
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
506 } else if (java_lang_Class::is_primitive(javaClassOop)) {
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
507 BasicType basicType = java_lang_Class::primitive_type(javaClassOop);
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
508 return JNIHandles::make_local(THREAD, VMExits::createRiTypePrimitive((int) basicType, THREAD));
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
509 } else {
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
510 KlassHandle klass = java_lang_Class::as_klassOop(javaClassOop);
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
511 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
512
2058
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
513 oop type = C1XCompiler::createHotSpotTypeResolved(klass, name, CHECK_NULL);
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
514 return JNIHandles::make_local(THREAD, type);
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
515 }
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
516 }
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
517
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
518
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
519 // helpers used to set fields in the HotSpotVMConfig object
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
520 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
521 jfieldID id = env->GetFieldID(env->GetObjectClass(obj), name, sig);
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
522 if (id == NULL) {
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
523 TRACE_C1X_1("field not found: %s (%s)", name, sig);
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
524 fatal("field not found");
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
525 }
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
526 return id;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
527 }
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
528
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
529 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
530 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
531 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
532 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
533 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
534
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
535 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
536 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
537 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
538 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
539 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
540
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
541
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
542 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
543 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
544
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
545 // public HotSpotVMConfig getConfiguration();
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
546 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getConfiguration(JNIEnv *env, jobject) {
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
547 jclass klass = env->FindClass("com/sun/hotspot/c1x/HotSpotVMConfig");
1419
7bf6a77b9c5a implement recent safepoint & exceptionobject ci changes, HotSpotVMConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1415
diff changeset
548 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
549 jobject config = env->AllocObject(klass);
1419
7bf6a77b9c5a implement recent safepoint & exceptionobject ci changes, HotSpotVMConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1415
diff changeset
550 #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
551 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
552 #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
553 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
554 #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
555 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
556 set_boolean(env, config, "useFastLocking", UseFastLocking);
2061
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
557 set_boolean(env, config, "useFastNewObjectArray", UseFastNewObjectArray);
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
558 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
559 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
560 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
561 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
562 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
563 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
564 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
565 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
566 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
567 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
568 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
569 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
570 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
571 set_int(env, config, "threadExceptionPcOffset", in_bytes(JavaThread::exception_pc_offset()));
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
572 set_int(env, config, "threadMultiNewArrayStorage", in_bytes(JavaThread::c1x_multinewarray_storage_offset()));
2060
40bcc41390e4 Added getClass intrinsic implementation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2059
diff changeset
573 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
574
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1427
diff changeset
575 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
576 set_long(env, config, "instanceofStub", VmIds::addStub(Runtime1::entry_for(Runtime1::slow_subtype_check_id)));
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
577 set_long(env, config, "verifyPointerStub", VmIds::addStub(Runtime1::entry_for(Runtime1::c1x_verify_pointer_id)));
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
578 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
579 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
580 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
581 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
582 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
583 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
584 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
585 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
586 set_long(env, config, "inlineCacheMissStub", VmIds::addStub(SharedRuntime::get_ic_miss_stub()));
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
587 set_long(env, config, "unwindExceptionStub", VmIds::addStub(Runtime1::entry_for(Runtime1::c1x_unwind_exception_call_id)));
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
588 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
589 set_long(env, config, "handleDeoptStub", VmIds::addStub(SharedRuntime::deopt_blob()->unpack()));
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
590 set_long(env, config, "throwClassCastException", VmIds::addStub(Runtime1::entry_for(Runtime1::throw_class_cast_exception_id)));
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
591 set_long(env, config, "throwArrayStoreException", VmIds::addStub(Runtime1::entry_for(Runtime1::throw_array_store_exception_id)));
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
592 set_long(env, config, "throwArrayIndexException", VmIds::addStub(Runtime1::entry_for(Runtime1::throw_range_check_failed_id)));
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
593 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
594 set_long(env, config, "monitorExitStub", VmIds::addStub(Runtime1::entry_for(Runtime1::monitorexit_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
595 set_long(env, config, "fastMonitorEnterStub", VmIds::addStub(Runtime1::entry_for(Runtime1::c1x_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
596 set_long(env, config, "fastMonitorExitStub", VmIds::addStub(Runtime1::entry_for(Runtime1::c1x_monitorexit_id)));
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
597 set_long(env, config, "safepointPollingAddress", (jlong)(os::get_polling_page() + (SafepointPollOffset % os::vm_page_size())));
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
598
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
599 BarrierSet* bs = Universe::heap()->barrier_set();
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
600 switch (bs->kind()) {
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
601 case BarrierSet::CardTableModRef:
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
602 case BarrierSet::CardTableExtension: {
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
603 jlong base = (jlong)((CardTableModRefBS*)bs)->byte_map_base;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
604 assert(base != 0, "unexpected byte_map_base");
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
605 set_long(env, config, "cardtableStartAddress", base);
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
606 set_int(env, config, "cardtableShift", CardTableModRefBS::card_shift);
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
607 break;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
608 }
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
609 case BarrierSet::ModRef:
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
610 case BarrierSet::Other:
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
611 set_long(env, config, "cardtableStartAddress", 0);
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
612 set_int(env, config, "cardtableShift", 0);
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
613 // No post barriers
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
614 break;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
615 #ifndef SERIALGC
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
616 case BarrierSet::G1SATBCT:
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
617 case BarrierSet::G1SATBCTLogging:
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
618 #endif // SERIALGC
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
619 default:
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
620 ShouldNotReachHere();
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
621 }
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
622
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
623 jintArray arrayOffsets = env->NewIntArray(basicTypeCount);
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
624 for (int i=0; i<basicTypeCount; i++) {
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
625 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
626 env->SetIntArrayRegion(arrayOffsets, i, 1, &offset);
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
627 }
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
628 set_int_array(env, config, "arrayOffsets", arrayOffsets);
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
629 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
630 return config;
7bf6a77b9c5a implement recent safepoint & exceptionobject ci changes, HotSpotVMConfig
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1415
diff changeset
631 }
1412
9195b99c841b Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1410
diff changeset
632
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
633 // public void installMethod(HotSpotTargetMethod targetMethod);
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
634 JNIEXPORT void JNICALL Java_com_sun_hotspot_c1x_VMEntries_installMethod(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
635 VM_ENTRY_MARK;
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
636 CodeInstaller installer(JNIHandles::resolve(targetMethod));
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
637 }
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
638
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
639 // public HotSpotProxy installStub(HotSpotTargetMethod targetMethod, String name);
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
640 JNIEXPORT jlong JNICALL Java_com_sun_hotspot_c1x_VMEntries_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
641 VM_ENTRY_MARK;
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
642 jlong id;
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
643 CodeInstaller installer(JNIHandles::resolve(targetMethod), id);
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
644 return id;
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
645 }
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
646
1445
a7b84a5e16c6 Remove caching for constant pool entries (same index can be used to retrieve e.g. type and field). Fast fail on bailout in C1X.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
647 // public void recordBailout(String reason);
2061
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
648 JNIEXPORT void JNICALL Java_com_sun_hotspot_c1x_VMEntries_recordBailout(JNIEnv *jniEnv, jobject message) {
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
649 if (C1XBailoutIsFatal) {
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
650 Handle msg = JNIHandles::resolve(message);
2492
4e5515d09314 Fixed merge issues.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2293
diff changeset
651 if (!msg.is_null()) {
2061
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
652 java_lang_String::print(msg, tty);
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
653 }
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
654 fatal("Bailout in C1X");
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
655 }
1445
a7b84a5e16c6 Remove caching for constant pool entries (same index can be used to retrieve e.g. type and field). Fast fail on bailout in C1X.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
656 }
a7b84a5e16c6 Remove caching for constant pool entries (same index can be used to retrieve e.g. type and field). Fast fail on bailout in C1X.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1434
diff changeset
657
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
658
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
659
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
660
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
661 #define CC (char*) /*cast a literal from (const char*)*/
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
662 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &f)
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
663
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
664 #define PROXY "J"
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
665 #define TYPE "Lcom/sun/cri/ri/RiType;"
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
666 #define RESOLVED_TYPE "Lcom/sun/hotspot/c1x/HotSpotTypeResolved;"
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
667 #define METHOD "Lcom/sun/cri/ri/RiMethod;"
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
668 #define SIGNATURE "Lcom/sun/cri/ri/RiSignature;"
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
669 #define FIELD "Lcom/sun/cri/ri/RiField;"
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
670 #define CONSTANT_POOL "Lcom/sun/cri/ri/RiConstantPool;"
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
671 #define EXCEPTION_HANDLERS "[Lcom/sun/cri/ri/RiExceptionHandler;"
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
672 #define TARGET_METHOD "Lcom/sun/hotspot/c1x/HotSpotTargetMethod;"
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
673 #define CONFIG "Lcom/sun/hotspot/c1x/HotSpotVMConfig;"
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
674 #define HS_METHOD "Lcom/sun/hotspot/c1x/HotSpotMethod;"
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
675 #define CI_CONSTANT "Lcom/sun/cri/ci/CiConstant;"
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
676 #define CI_KIND "Lcom/sun/cri/ci/CiKind;"
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
677 #define STRING "Ljava/lang/String;"
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
678 #define OBJECT "Ljava/lang/Object;"
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
679 #define CLASS "Ljava/lang/Class;"
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
680
1412
9195b99c841b Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1410
diff changeset
681 JNINativeMethod VMEntries_methods[] = {
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
682 {CC"RiMethod_code", CC"("PROXY")[B", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1code)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
683 {CC"RiMethod_maxStackSize", CC"("PROXY")I", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxStackSize)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
684 {CC"RiMethod_maxLocals", CC"("PROXY")I", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxLocals)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
685 {CC"RiMethod_holder", CC"("PROXY")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1holder)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
686 {CC"RiMethod_signature", CC"("PROXY")"STRING, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1signature)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
687 {CC"RiMethod_accessFlags", CC"("PROXY")I", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1accessFlags)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
688 {CC"RiMethod_exceptionHandlers", CC"("PROXY")"EXCEPTION_HANDLERS, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1exceptionHandlers)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
689 {CC"RiMethod_hasBalancedMonitors", CC"("PROXY")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1hasBalancedMonitors)},
2049
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
690 {CC"RiMethod_uniqueConcreteMethod", CC"("PROXY")"METHOD, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1uniqueConcreteMethod)},
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
691 {CC"RiSignature_lookupType", CC"("STRING RESOLVED_TYPE")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1lookupType)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
692 {CC"RiConstantPool_lookupConstant", CC"("PROXY"I)"OBJECT, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupConstant)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
693 {CC"RiConstantPool_lookupMethod", CC"("PROXY"IB)"METHOD, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupMethod)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
694 {CC"RiConstantPool_lookupSignature", CC"("PROXY"I)"SIGNATURE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupSignature)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
695 {CC"RiConstantPool_lookupType", CC"("PROXY"I)"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupType)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
696 {CC"RiConstantPool_lookupField", CC"("PROXY"IB)"FIELD, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupField)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
697 {CC"RiType_constantPool", CC"("RESOLVED_TYPE")"CONSTANT_POOL, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
698 {CC"RiType_resolveMethodImpl", CC"("RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_3resolveMethodImpl)},
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
699 {CC"RiType_isSubtypeOf", CC"("RESOLVED_TYPE TYPE")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_2isSubtypeOf)},
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
700 {CC"RiType_componentType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1componentType)},
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
701 {CC"RiType_uniqueConcreteSubtype", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1uniqueConcreteSubtype)},
2293
e3c42b8de67e Removed a reference to getRiType(Class c) and some checkstyle fixes.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2289
diff changeset
702 {CC"RiType_superType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1superType)},
2058
8f033d37798a Better support for array types.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2057
diff changeset
703 {CC"RiType_arrayOf", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1arrayOf)},
1941
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
704 {CC"getPrimitiveArrayType", CC"("CI_KIND")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getPrimitiveArrayType)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
705 {CC"getType", CC"("CLASS")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getType)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
706 {CC"getConfiguration", CC"()"CONFIG, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getConfiguration)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
707 {CC"installMethod", CC"("TARGET_METHOD")V", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installMethod)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
708 {CC"installStub", CC"("TARGET_METHOD")"PROXY, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installStub)},
79d04223b8a5 Added caching for resolved types and resolved fields.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1939
diff changeset
709 {CC"recordBailout", CC"("STRING")V", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_recordBailout)}
1412
9195b99c841b Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1410
diff changeset
710 };
9195b99c841b Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1410
diff changeset
711
9195b99c841b Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1410
diff changeset
712 int VMEntries_methods_count() {
9195b99c841b Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1410
diff changeset
713 return sizeof(VMEntries_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
714 }