annotate src/share/vm/graal/graalCompilerToVM.cpp @ 10477:7943479d36f3

Fix for invalidateInstalledCode.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 21 Jun 2013 22:09:25 +0200
parents cd68d6902328
children 26c69598db3e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2516
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
1 /*
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
4 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
7 * published by the Free Software Foundation.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
8 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
13 * accompanied this code).
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
14 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
15 * You should have received a copy of the GNU General Public License version
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
18 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
21 * questions.
1410
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
22 */
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
23
2045
9c96c873c42b Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1942
diff changeset
24 #include "precompiled.hpp"
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
25 #include "runtime/fieldDescriptor.hpp"
6559
d5f7e737827f fixed compilation issues on Solaris. When using SunStudio compiler, Solaris build with DONT_USE_PRECOMPILED_HEADER
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6549
diff changeset
26 #include "memory/oopFactory.hpp"
d5f7e737827f fixed compilation issues on Solaris. When using SunStudio compiler, Solaris build with DONT_USE_PRECOMPILED_HEADER
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6549
diff changeset
27 #include "oops/generateOopMap.hpp"
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
28 #include "oops/fieldStreams.hpp"
6559
d5f7e737827f fixed compilation issues on Solaris. When using SunStudio compiler, Solaris build with DONT_USE_PRECOMPILED_HEADER
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6549
diff changeset
29 #include "runtime/javaCalls.hpp"
7125
1baf7f1e3f23 decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents: 7094
diff changeset
30 #include "graal/graalRuntime.hpp"
3619
5e9645341ec3 support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents: 3587
diff changeset
31 #include "compiler/compileBroker.hpp"
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
32 #include "compiler/compilerOracle.hpp"
7735
a7a93887b4c4 fix Solaris build and initial SPARC support
twisti
parents: 7569
diff changeset
33 #include "compiler/disassembler.hpp"
4222
8e2985cdaaa5 Renaming of VMExits and VMEntries part 3.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
34 #include "graal/graalCompilerToVM.hpp"
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
35 #include "graal/graalCompiler.hpp"
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
36 #include "graal/graalEnv.hpp"
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
37 #include "graal/graalJavaAccess.hpp"
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
38 #include "graal/graalCodeInstaller.hpp"
4222
8e2985cdaaa5 Renaming of VMExits and VMEntries part 3.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
39 #include "graal/graalVMToCompiler.hpp"
8490
1567c6cc6561 Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8489
diff changeset
40 #include "gc_implementation/g1/heapRegion.hpp"
6559
d5f7e737827f fixed compilation issues on Solaris. When using SunStudio compiler, Solaris build with DONT_USE_PRECOMPILED_HEADER
Laurent Daynes <Laurent.Daynes@oracle.com>
parents: 6549
diff changeset
41
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
42
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
43 Method* getMethodFromHotSpotMethod(oop hotspot_method) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
44 assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethod::klass()), "sanity");
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
45 return asMethod(HotSpotResolvedJavaMethod::metaspaceMethod(hotspot_method));
4446
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4444
diff changeset
46 }
48756b901156 bugfixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4444
diff changeset
47
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
48 // Entry to native method implementation that transitions current thread to '_thread_in_vm'.
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
49 #define C2V_VMENTRY(result_type, name, signature) \
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
50 JNIEXPORT result_type JNICALL c2v_ ## name signature { \
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
51 TRACE_graal_3("CompilerToVM::" #name); \
7126
ce248dc0a656 removed all Graal modifications to ci and c1
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
52 GRAAL_VM_ENTRY_MARK; \
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
53
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
54 // Entry to native method implementation that calls a JNI function
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
55 // and hence cannot transition current thread to '_thread_in_vm'.
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
56 #define C2V_ENTRY(result_type, name, signature) \
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
57 JNIEXPORT result_type JNICALL c2v_ ## name signature { \
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
58 TRACE_graal_3("CompilerToVM::" #name); \
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
59
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
60 #define C2V_END }
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
61
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
62 C2V_ENTRY(jbyteArray, initializeBytecode, (JNIEnv *env, jobject, jlong metaspace_method, jbyteArray result))
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
63 methodHandle method = asMethod(metaspace_method);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
64 ResourceMark rm;
8945
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
65
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
66 int code_size = method->code_size();
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
67 jbyte* reconstituted_code = NULL;
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
68
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
69 // replace all breakpoints - must be done before undoing any rewriting
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
70 if (method->number_of_breakpoints() > 0) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
71 reconstituted_code = NEW_RESOURCE_ARRAY(jbyte, code_size);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
72 memcpy(reconstituted_code, (jbyte *) method->code_base(), code_size);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
73 BreakpointInfo* bp = InstanceKlass::cast(method->method_holder())->breakpoints();
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
74 for (; bp != NULL; bp = bp->next()) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
75 if (bp->match(method())) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
76 jbyte code = bp->orig_bytecode();
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
77 reconstituted_code[bp->bci()] = code;
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
78 }
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
79 }
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
80 }
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
81
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5130
diff changeset
82 // iterate over all bytecodes and replace non-Java bytecodes
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
83 if (RewriteBytecodes || RewriteFrequentPairs || InstanceKlass::cast(method->method_holder())->is_rewritten()) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
84 if (reconstituted_code == NULL) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
85 reconstituted_code = NEW_RESOURCE_ARRAY(jbyte, code_size);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
86 memcpy(reconstituted_code, (jbyte *) method->code_base(), code_size);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
87 }
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5130
diff changeset
88 BytecodeStream s(method);
8269
985a97ba083c Fix spacing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8215
diff changeset
89 while (!s.is_last_bytecode()) {
5154
ae72dd38eeb1 bugfix, parallel GC seems stable
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5150
diff changeset
90 s.next();
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
91 Bytecodes::Code opcode = s.raw_code();
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
92 if (!Bytecodes::is_java_code(opcode)) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
93 jbyte original_opcode = Bytecodes::java_code(opcode);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
94 int bci = s.bci();
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
95 reconstituted_code[bci] = original_opcode;
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
96 if (opcode == Bytecodes::_fast_aldc_w) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
97 int cpci = Bytes::get_native_u2((address) reconstituted_code + bci + 1);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
98 int i = method->constants()->object_to_cp_index(cpci);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
99 assert(i < method->constants()->length(), "sanity check");
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
100 Bytes::put_Java_u2((address) reconstituted_code + bci + 1, (u2)i);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
101 } else if (opcode == Bytecodes::_fast_aldc) {
7002
74f0207b82f5 fixed bug in bytecode reconstitution
Doug Simon <doug.simon@oracle.com>
parents: 7000
diff changeset
102 int cpci = reconstituted_code[bci + 1] & 0xff;
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
103 int i = method->constants()->object_to_cp_index(cpci);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
104 assert(i < method->constants()->length(), "sanity check");
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
105 reconstituted_code[bci + 1] = (jbyte)i;
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
106 }
5154
ae72dd38eeb1 bugfix, parallel GC seems stable
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5150
diff changeset
107 }
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5130
diff changeset
108 }
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
109 }
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5130
diff changeset
110
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
111 if (reconstituted_code == NULL) {
6990
e3ada110d3cf Small cleanups after NPG
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6951
diff changeset
112 env->SetByteArrayRegion(result, 0, code_size, (jbyte *) method->code_base());
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
113 } else {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
114 env->SetByteArrayRegion(result, 0, code_size, reconstituted_code);
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5130
diff changeset
115 }
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5130
diff changeset
116
1413
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
117 return result;
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
118 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
119
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
120 C2V_VMENTRY(jstring, getSignature, (JNIEnv *env, jobject, jlong metaspace_method))
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
121 Method* method = asMethod(metaspace_method);
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2990
diff changeset
122 assert(method != NULL && method->signature() != NULL, "signature required");
7811
94ea9a864fc6 Remove usages of VmIds.toString.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7810
diff changeset
123 return (jstring)JNIHandles::make_local(java_lang_String::create_from_symbol(method->signature(), THREAD)());
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
124 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
125
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
126 C2V_VMENTRY(jobjectArray, initializeExceptionHandlers, (JNIEnv *, jobject, jlong metaspace_method, jobjectArray java_handlers))
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
127 ResourceMark rm;
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
128 methodHandle method = asMethod(metaspace_method);
6275
957c266d8bc5 Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 5839
diff changeset
129 int handler_count = method->exception_table_length();
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
130 objArrayHandle array = (objArrayOop) JNIHandles::resolve(java_handlers);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
131 assert(array->length() == handler_count, "wrong length");
6275
957c266d8bc5 Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 5839
diff changeset
132 ExceptionTableElement* handlers = handler_count == 0 ? NULL : method->exception_table_start();
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
133
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
134 for (int i = 0; i < handler_count; i++) {
6275
957c266d8bc5 Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 5839
diff changeset
135 ExceptionTableElement* handler = handlers + i;
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
136 Handle entry = array->obj_at(i);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
137 assert(!entry.is_null(), "entry should not be null");
6275
957c266d8bc5 Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 5839
diff changeset
138 ExceptionHandler::set_startBCI(entry, handler->start_pc);
957c266d8bc5 Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 5839
diff changeset
139 ExceptionHandler::set_endBCI(entry, handler->end_pc);
957c266d8bc5 Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 5839
diff changeset
140 ExceptionHandler::set_handlerBCI(entry, handler->handler_pc);
957c266d8bc5 Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 5839
diff changeset
141 int catch_class_index = handler->catch_type_index;
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
142 ExceptionHandler::set_catchTypeCPI(entry, catch_class_index);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
143
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
144 if (catch_class_index == 0) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
145 ExceptionHandler::set_catchType(entry, NULL);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
146 } else {
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
147 ConstantPool* cp = InstanceKlass::cast(method->method_holder())->constants();
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
148 KlassHandle loading_klass = method->method_holder();
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
149 Handle catch_class = GraalCompiler::get_JavaType(cp, catch_class_index, loading_klass, CHECK_NULL);
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
150 if (catch_class->klass() == HotSpotResolvedObjectType::klass() && java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(catch_class)) == SystemDictionary::Throwable_klass()) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
151 ExceptionHandler::set_catchType(entry, NULL);
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
152 ExceptionHandler::set_catchTypeCPI(entry, 0);
3699
67e92894d065 Set catch all to true if the caught class is java.lang.Throwable.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3688
diff changeset
153 } else {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
154 ExceptionHandler::set_catchType(entry, catch_class());
3699
67e92894d065 Set catch all to true if the caught class is java.lang.Throwable.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3688
diff changeset
155 }
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
156 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
157 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
158 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
159
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
160 return (jobjectArray) JNIHandles::make_local(array());
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
161 C2V_END
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
162
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
163 C2V_VMENTRY(jint, hasBalancedMonitors, (JNIEnv *, jobject, jlong metaspace_method))
3559
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
164
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
165 // Analyze the method to see if monitors are used properly.
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
166 methodHandle method(THREAD, asMethod(metaspace_method));
3559
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
167 assert(method->has_monitor_bytecodes(), "should have checked this");
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
168
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
169 // Check to see if a previous compilation computed the monitor-matching analysis.
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
170 if (method->guaranteed_monitor_matching()) {
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
171 return true;
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
172 }
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
173
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
174 {
3559
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
175 EXCEPTION_MARK;
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
176 ResourceMark rm(THREAD);
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
177 GeneratePairingInfo gpi(method);
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
178 gpi.compute_map(CATCH);
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
179 if (!gpi.monitor_safe()) {
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
180 return false;
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
181 }
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
182 method->set_guaranteed_monitor_matching();
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
183 }
3559
f70a4cc629e7 remove some dependencies on ci interface
Lukas Stadler <lukas.stadler@jku.at>
parents: 3555
diff changeset
184 return true;
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
185 C2V_END
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
186
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
187 C2V_VMENTRY(jlong, getMetaspaceMethod, (JNIEnv *, jobject, jobject reflection_method_handle, jobject resultHolder))
3555
22d11b3bc561 Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3552
diff changeset
188 oop reflection_method = JNIHandles::resolve(reflection_method_handle);
22d11b3bc561 Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3552
diff changeset
189 oop reflection_holder = java_lang_reflect_Method::clazz(reflection_method);
22d11b3bc561 Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3552
diff changeset
190 int slot = java_lang_reflect_Method::slot(reflection_method);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
191 Klass* holder = java_lang_Class::as_Klass(reflection_holder);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
192 methodHandle method = InstanceKlass::cast(holder)->method_with_idnum(slot);
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
193 Handle type = GraalCompiler::createHotSpotResolvedObjectType(method, CHECK_0);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
194 objArrayOop(JNIHandles::resolve(resultHolder))->obj_at_put(0, type());
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
195 return (jlong) (address) method();
3555
22d11b3bc561 Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3552
diff changeset
196 }
22d11b3bc561 Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3552
diff changeset
197
7044
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
198 C2V_VMENTRY(jlong, getMetaspaceConstructor, (JNIEnv *, jobject, jobject reflection_ctor_handle, jobject resultHolder))
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
199 oop reflection_ctor = JNIHandles::resolve(reflection_ctor_handle);
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
200 oop reflection_holder = java_lang_reflect_Constructor::clazz(reflection_ctor);
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
201 int slot = java_lang_reflect_Constructor::slot(reflection_ctor);
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
202 Klass* holder = java_lang_Class::as_Klass(reflection_holder);
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
203 methodHandle method = InstanceKlass::cast(holder)->method_with_idnum(slot);
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
204 Handle type = GraalCompiler::createHotSpotResolvedObjectType(method, CHECK_0);
7044
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
205 objArrayOop(JNIHandles::resolve(resultHolder))->obj_at_put(0, type());
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
206 return (jlong) (address) method();
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
207 }
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
208
6442
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
209 C2V_VMENTRY(jobject, getJavaField, (JNIEnv *, jobject, jobject reflection_field_handle))
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
210 oop reflection_field = JNIHandles::resolve(reflection_field_handle);
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
211 oop reflection_holder = java_lang_reflect_Field::clazz(reflection_field);
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
212 int slot = java_lang_reflect_Field::slot(reflection_field);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
213 InstanceKlass* holder = InstanceKlass::cast(java_lang_Class::as_Klass(reflection_holder));
6442
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
214
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
215 int offset = holder->field_offset(slot);
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
216 int flags = holder->field_access_flags(slot);
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
217 Symbol* field_name = holder->field_name(slot);
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
218 Handle field_holder = GraalCompiler::get_JavaTypeFromClass(reflection_holder, CHECK_NULL);
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
219 Handle field_type = GraalCompiler::get_JavaTypeFromClass(java_lang_reflect_Field::type(reflection_field), CHECK_NULL);
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
220
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
221 Handle ret = GraalCompiler::get_JavaField(offset, flags, field_name, field_holder, field_type, CHECK_NULL);
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
222 return JNIHandles::make_local(THREAD, ret());
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
223 }
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
224
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
225 C2V_VMENTRY(jlong, getUniqueConcreteMethod, (JNIEnv *, jobject, jlong metaspace_method, jobject resultHolder))
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
226 methodHandle method = asMethod(metaspace_method);
3653
6aef50c6d967 Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
227 KlassHandle holder = method->method_holder();
6aef50c6d967 Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
228 if (holder->is_interface()) {
2050
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
229 // 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
230 // interface I { void foo(); }
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
231 // 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
232 // 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
233 // 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
234 // class D extends B { }
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
235 // Would lead to identify C.foo() as the unique concrete method for I.foo() without seeing A.foo().
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
236 return 0L;
2049
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
237 }
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
238 methodHandle ucm;
2050
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
239 {
2061
c0b1d6a44a02 Implemented fast inline array allocation.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2060
diff changeset
240 ResourceMark rm;
2050
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
241 MutexLocker locker(Compile_lock);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
242 ucm = Dependencies::find_unique_concrete_method(holder(), method());
2050
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
243 }
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
244
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
245 if (ucm.is_null()) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
246 return 0L;
2050
b6d2c238e585 Two fixes for leaf type and leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2049
diff changeset
247 }
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
248
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
249 Handle type = GraalCompiler::createHotSpotResolvedObjectType(ucm(), CHECK_0);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
250 objArrayOop(JNIHandles::resolve(resultHolder))->obj_at_put(0, type());
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
251 return (jlong) (address) ucm();
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
252 C2V_END
2049
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
253
7226
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
254 C2V_VMENTRY(jobject, getUniqueImplementor, (JNIEnv *, jobject, jobject interface_type))
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
255 InstanceKlass* klass = (InstanceKlass*) asKlass(HotSpotResolvedObjectType::metaspaceKlass(interface_type));
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
256 assert(klass->is_interface(), "must be");
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
257 if (klass->nof_implementors() == 1) {
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
258 InstanceKlass* implementor = (InstanceKlass*) klass->implementor();
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
259 if (!implementor->is_abstract() && !implementor->is_interface() && implementor->is_leaf_class()) {
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
260 Handle type = GraalCompiler::get_JavaType(implementor, CHECK_NULL);
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
261 return JNIHandles::make_local(THREAD, type());
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
262 }
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
263 }
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
264 return NULL;
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
265 C2V_END
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
266
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
267 C2V_ENTRY(jint, getInvocationCount, (JNIEnv *, jobject, jlong metaspace_method))
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
268 Method* method = asMethod(metaspace_method);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
269 return method->invocation_count();
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
270 C2V_END
2049
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
271
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
272 C2V_VMENTRY(void, initializeMethod,(JNIEnv *, jobject, jlong metaspace_method, jobject hotspot_method))
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
273 methodHandle method = asMethod(metaspace_method);
7811
94ea9a864fc6 Remove usages of VmIds.toString.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7810
diff changeset
274 Handle name = java_lang_String::create_from_symbol(method->name(), CHECK);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
275 InstanceKlass::cast(HotSpotResolvedJavaMethod::klass())->initialize(CHECK);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
276 HotSpotResolvedJavaMethod::set_name(hotspot_method, name());
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
277 HotSpotResolvedJavaMethod::set_codeSize(hotspot_method, method->code_size());
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
278 HotSpotResolvedJavaMethod::set_exceptionHandlerCount(hotspot_method, method->exception_table_length());
9416
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9355
diff changeset
279 HotSpotResolvedJavaMethod::set_callerSensitive(hotspot_method, method->caller_sensitive());
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9355
diff changeset
280 HotSpotResolvedJavaMethod::set_forceInline(hotspot_method, method->force_inline());
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9355
diff changeset
281 HotSpotResolvedJavaMethod::set_dontInline(hotspot_method, method->dont_inline());
16c354398d09 intrinsify Reflection.getCallerClass
twisti
parents: 9355
diff changeset
282 HotSpotResolvedJavaMethod::set_ignoredBySecurityStackWalk(hotspot_method, method->is_ignored_by_security_stack_walk());
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
283 C2V_END
2926
0e3ec0a4eda4 RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
284
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
285 C2V_VMENTRY(jboolean, isMethodCompilable,(JNIEnv *, jobject, jlong metaspace_method))
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
286 methodHandle method = asMethod(metaspace_method);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
287 return !method->is_not_compilable() && !CompilerOracle::should_not_inline(method);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
288 C2V_END
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
289
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
290 C2V_VMENTRY(void, initializeMethodData,(JNIEnv *, jobject, jlong metaspace_method_data, jobject hotspot_method_data))
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
291 MethodData* method_data = asMethodData(metaspace_method_data);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
292 HotSpotMethodData::set_normalDataSize(hotspot_method_data, method_data->data_size());
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
293 HotSpotMethodData::set_extraDataSize(hotspot_method_data, method_data->extra_data_size());
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
294 C2V_END
3487
b9ed7199f6fb special handling for VirtualObject(Field) in IdentifyBlocksPhase (don't schedule out of loops), better toString for HotSpotMethod/Field
Lukas Stadler <lukas.stadler@jku.at>
parents: 3465
diff changeset
295
3565
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3559
diff changeset
296 // ------------------------------------------------------------------
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3559
diff changeset
297 // Adjust a CounterData count to be commensurate with
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3559
diff changeset
298 // interpreter_invocation_count. If the MDO exists for
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3559
diff changeset
299 // only 25% of the time the method exists, then the
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3559
diff changeset
300 // counts in the MDO should be scaled by 4X, so that
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3559
diff changeset
301 // they can be usefully and stably compared against the
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3559
diff changeset
302 // invocation counts in methods.
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
303 int scale_count(MethodData* method_data, int count) {
3565
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3559
diff changeset
304 if (count > 0) {
3566
b0d192f86f34 more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents: 3565
diff changeset
305 int counter_life;
b0d192f86f34 more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents: 3565
diff changeset
306 int method_life = method_data->method()->interpreter_invocation_count();
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
307 int current_mileage = MethodData::mileage_of(method_data->method());
3566
b0d192f86f34 more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents: 3565
diff changeset
308 int creation_mileage = method_data->creation_mileage();
b0d192f86f34 more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents: 3565
diff changeset
309 counter_life = current_mileage - creation_mileage;
3565
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3559
diff changeset
310
3566
b0d192f86f34 more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents: 3565
diff changeset
311 // counter_life due to backedge_counter could be > method_life
b0d192f86f34 more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents: 3565
diff changeset
312 if (counter_life > method_life)
b0d192f86f34 more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents: 3565
diff changeset
313 counter_life = method_life;
b0d192f86f34 more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents: 3565
diff changeset
314 if (0 < counter_life && counter_life <= method_life) {
b0d192f86f34 more work on ci removal
Lukas Stadler <lukas.stadler@jku.at>
parents: 3565
diff changeset
315 count = (int)((double)count * method_life / counter_life + 0.5);
3565
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3559
diff changeset
316 count = (count > 0) ? count : 1;
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3559
diff changeset
317 }
3487
b9ed7199f6fb special handling for VirtualObject(Field) in IdentifyBlocksPhase (don't schedule out of loops), better toString for HotSpotMethod/Field
Lukas Stadler <lukas.stadler@jku.at>
parents: 3465
diff changeset
318 }
3565
b3f0f8a01ca2 remove some ci-dependencies
Lukas Stadler <lukas.stadler@jku.at>
parents: 3559
diff changeset
319 return count;
3055
fecdb0a65fb2 runtime profiles exceptions at the call site
Lukas Stadler <lukas.stadler@jku.at>
parents: 3020
diff changeset
320 }
fecdb0a65fb2 runtime profiles exceptions at the call site
Lukas Stadler <lukas.stadler@jku.at>
parents: 3020
diff changeset
321
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
322 C2V_ENTRY(jint, getCompiledCodeSize, (JNIEnv *env, jobject, jlong metaspace_method))
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
323 nmethod* code = (asMethod(metaspace_method))->code();
4528
e6e14d25e608 added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4475
diff changeset
324 return code == NULL ? 0 : code->insts_size();
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
325 C2V_END
4528
e6e14d25e608 added two inlining policies for comparison
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4475
diff changeset
326
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 9027
diff changeset
327 C2V_VMENTRY(jint, constantPoolLength, (JNIEnv *env, jobject, jobject type))
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 9027
diff changeset
328 ConstantPool* cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants();
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 9027
diff changeset
329 return cp->length();
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 9027
diff changeset
330 C2V_END
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 9027
diff changeset
331
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
332 C2V_VMENTRY(jobject, lookupType, (JNIEnv *env, jobject, jstring jname, jobject accessingClass, jboolean eagerResolve))
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
333 ResourceMark rm;
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
334
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
335 Handle name = JNIHandles::resolve(jname);
7812
a42dc71ad051 Remove usages of VmIds.toSymbol.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7811
diff changeset
336 Symbol* nameSymbol = java_lang_String::as_symbol(name, THREAD);
7027
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
337 assert(nameSymbol != NULL, "name to symbol creation failed");
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
338
7027
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
339 oop result = NULL;
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
340 if (nameSymbol == vmSymbols::int_signature()) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
341 result = VMToCompiler::createPrimitiveJavaType((int) T_INT, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
342 } else if (nameSymbol == vmSymbols::long_signature()) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
343 result = VMToCompiler::createPrimitiveJavaType((int) T_LONG, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
344 } else if (nameSymbol == vmSymbols::bool_signature()) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
345 result = VMToCompiler::createPrimitiveJavaType((int) T_BOOLEAN, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
346 } else if (nameSymbol == vmSymbols::char_signature()) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
347 result = VMToCompiler::createPrimitiveJavaType((int) T_CHAR, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
348 } else if (nameSymbol == vmSymbols::short_signature()) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
349 result = VMToCompiler::createPrimitiveJavaType((int) T_SHORT, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
350 } else if (nameSymbol == vmSymbols::byte_signature()) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
351 result = VMToCompiler::createPrimitiveJavaType((int) T_BYTE, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
352 } else if (nameSymbol == vmSymbols::double_signature()) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
353 result = VMToCompiler::createPrimitiveJavaType((int) T_DOUBLE, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
354 } else if (nameSymbol == vmSymbols::float_signature()) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
355 result = VMToCompiler::createPrimitiveJavaType((int) T_FLOAT, THREAD);
6325
2691e320d37c Handle void type when resolving a signature type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6277
diff changeset
356 } else if (nameSymbol == vmSymbols::void_signature()) {
2691e320d37c Handle void type when resolving a signature type.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6277
diff changeset
357 result = VMToCompiler::createPrimitiveJavaType((int) T_VOID, THREAD);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
358 } else {
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
359 Klass* resolved_type = NULL;
7027
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
360 Handle classloader;
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
361 Handle protectionDomain;
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
362 if (JNIHandles::resolve(accessingClass) != NULL) {
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
363 classloader = java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(accessingClass))->class_loader();
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
364 protectionDomain = java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(accessingClass))->protection_domain();
7027
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
365 }
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
366
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
367 if (eagerResolve) {
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
368 resolved_type = SystemDictionary::resolve_or_fail(nameSymbol, classloader, protectionDomain, true, THREAD);
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
369 } else {
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
370 resolved_type = SystemDictionary::resolve_or_null(nameSymbol, classloader, protectionDomain, THREAD);
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
371 }
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
372
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
373 if (!HAS_PENDING_EXCEPTION) {
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
374 if (resolved_type == NULL) {
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
375 assert(!eagerResolve, "failed eager resolution should have caused an exception");
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
376 Handle type = VMToCompiler::createUnresolvedJavaType(name, THREAD);
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
377 result = type();
4484
14a00ee82980 Implement eager type resolving.
Andreas Woess <andreas.woess@jku.at>
parents: 4475
diff changeset
378 } else {
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
379 Handle type = GraalCompiler::createHotSpotResolvedObjectType(resolved_type, name, CHECK_NULL);
7027
58dbea9fb973 CompilerToVM.lookupType() now fails with an exception if eagerResolve is true and resolution fails
Doug Simon <doug.simon@oracle.com>
parents: 7019
diff changeset
380 result = type();
4484
14a00ee82980 Implement eager type resolving.
Andreas Woess <andreas.woess@jku.at>
parents: 4475
diff changeset
381 }
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
382 }
1413
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
383 }
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
384
1413
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
385 return JNIHandles::make_local(THREAD, result);
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
386 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
387
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
388 C2V_VMENTRY(jobject, lookupConstantInPool, (JNIEnv *env, jobject, jobject type, jint index))
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
389
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
390 ConstantPool* cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants();
1413
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
391
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
392 oop result = NULL;
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
393 constantTag tag = cp->tag_at(index);
9584
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
394
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
395 switch (tag.value()) {
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
396 case JVM_CONSTANT_Integer:
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
397 result = VMToCompiler::createConstant(Kind::Int(), cp->int_at(index), CHECK_NULL);
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
398 break;
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
399
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
400 case JVM_CONSTANT_Long:
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
401 result = VMToCompiler::createConstant(Kind::Long(), cp->long_at(index), CHECK_NULL);
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
402 break;
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
403
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
404 case JVM_CONSTANT_Float:
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
405 result = VMToCompiler::createConstantFloat(cp->float_at(index), CHECK_NULL);
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
406 break;
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
407
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
408 case JVM_CONSTANT_Double:
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
409 result = VMToCompiler::createConstantDouble(cp->double_at(index), CHECK_NULL);
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
410 break;
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
411
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
412 case JVM_CONSTANT_Class:
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
413 case JVM_CONSTANT_UnresolvedClass:
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
414 case JVM_CONSTANT_UnresolvedClassInError:
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
415 {
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
416 Handle type = GraalCompiler::get_JavaType(cp, index, cp->pool_holder(), CHECK_NULL);
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
417 result = type();
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
418 break;
1413
1ecc8f0aad00 Draft implementation of HotSpot CRI / first method compiling without exception.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1412
diff changeset
419 }
9584
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
420
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
421 case JVM_CONSTANT_String:
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
422 {
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
423 oop result_oop = cp->resolve_possibly_cached_constant_at(index, CHECK_NULL);
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
424 result = VMToCompiler::createConstantObject(result_oop, CHECK_NULL);
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
425 break;
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
426 }
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
427
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
428 case JVM_CONSTANT_MethodHandle:
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
429 case JVM_CONSTANT_MethodHandleInError:
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
430 case JVM_CONSTANT_MethodType:
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
431 case JVM_CONSTANT_MethodTypeInError:
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
432 {
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
433 oop result_oop = cp->resolve_constant_at(index, CHECK_NULL);
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
434 result = VMToCompiler::createConstantObject(result_oop, CHECK_NULL);
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
435 break;
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
436 }
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
437
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
438 default:
4172233f32fd make lookupConstantInPool use ConstantPool logic
twisti
parents: 9583
diff changeset
439 fatal(err_msg_res("unknown constant pool tag %s at cpi %d in %s", tag.internal_name(), index, cp->pool_holder()->name()->as_C_string()));
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
440 }
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
441
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
442 return JNIHandles::make_local(THREAD, result);
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
443 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
444
9011
23762f2438b6 support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents: 8996
diff changeset
445 C2V_VMENTRY(jobject, lookupAppendixInPool, (JNIEnv *env, jobject, jobject type, jint index, jbyte opcode))
23762f2438b6 support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents: 8996
diff changeset
446 Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF);
23762f2438b6 support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents: 8996
diff changeset
447 index = GraalCompiler::to_cp_index(index, bc);
8945
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
448 constantPoolHandle cpool(InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants());
9011
23762f2438b6 support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents: 8996
diff changeset
449 oop appendix_oop = ConstantPool::appendix_at_if_loaded(cpool, index);
8945
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
450
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
451 return JNIHandles::make_local(THREAD, appendix_oop);
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
452 C2V_END
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
453
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
454 C2V_VMENTRY(jobject, lookupMethodInPool, (JNIEnv *env, jobject, jobject type, jint index, jbyte opcode))
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
455 constantPoolHandle cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants();
3670
f198b24093f3 put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3669
diff changeset
456 instanceKlassHandle pool_holder(cp->pool_holder());
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
457
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
458 Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF);
9011
23762f2438b6 support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents: 8996
diff changeset
459 index = GraalCompiler::to_cp_index(index, bc);
8945
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
460
3670
f198b24093f3 put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3669
diff changeset
461 methodHandle method = GraalEnv::get_method_by_index(cp, index, bc, pool_holder);
3648
81ad8ab1f9fe Remove ci usage on method lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3647
diff changeset
462 if (!method.is_null()) {
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
463 Handle holder = GraalCompiler::get_JavaType(method->method_holder(), CHECK_NULL);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
464 return JNIHandles::make_local(THREAD, VMToCompiler::createResolvedJavaMethod(holder, method(), THREAD));
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
465 } else {
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
466 // Get the method's name and signature.
7811
94ea9a864fc6 Remove usages of VmIds.toString.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7810
diff changeset
467 Handle name = java_lang_String::create_from_symbol(cp->name_ref_at(index), CHECK_NULL);
94ea9a864fc6 Remove usages of VmIds.toString.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7810
diff changeset
468 Handle signature = java_lang_String::create_from_symbol(cp->signature_ref_at(index), CHECK_NULL);
8945
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
469 Handle type;
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
470 if (bc != Bytecodes::_invokedynamic) {
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
471 int holder_index = cp->klass_ref_index_at(index);
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
472 type = GraalCompiler::get_JavaType(cp, holder_index, cp->pool_holder(), CHECK_NULL);
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
473 } else {
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
474 type = Handle(SystemDictionary::MethodHandle_klass()->java_mirror());
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
475 }
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
476 return JNIHandles::make_local(THREAD, VMToCompiler::createUnresolvedJavaMethod(name, signature, type, THREAD));
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
477 }
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
478 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
479
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
480 C2V_VMENTRY(jobject, lookupTypeInPool, (JNIEnv *env, jobject, jobject type, jint index))
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
481
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
482 ConstantPool* cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants();
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
483 Handle result = GraalCompiler::get_JavaType(cp, index, cp->pool_holder(), CHECK_NULL);
3653
6aef50c6d967 Handlize to fix GC issue.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
484 return JNIHandles::make_local(THREAD, result());
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
485 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
486
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
487 C2V_VMENTRY(void, lookupReferencedTypeInPool, (JNIEnv *env, jobject, jobject type, jint index, jbyte op))
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
488 ConstantPool* cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type)))->constants();
9011
23762f2438b6 support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents: 8996
diff changeset
489 Bytecodes::Code bc = (Bytecodes::Code) (((int) op) & 0xFF);
23762f2438b6 support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents: 8996
diff changeset
490 if (bc != Bytecodes::_checkcast && bc != Bytecodes::_instanceof && bc != Bytecodes::_new && bc != Bytecodes::_anewarray
23762f2438b6 support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents: 8996
diff changeset
491 && bc != Bytecodes::_multianewarray && bc != Bytecodes::_ldc && bc != Bytecodes::_ldc_w && bc != Bytecodes::_ldc2_w)
4316
b4b16e4e043f Fix eager resolving for class constants
Peter Hofer <peter.hofer@jku.at>
parents: 4297
diff changeset
492 {
9011
23762f2438b6 support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents: 8996
diff changeset
493 index = cp->remap_instruction_operand_from_cache(GraalCompiler::to_cp_index(index, bc));
3577
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3572
diff changeset
494 }
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3572
diff changeset
495 constantTag tag = cp->tag_at(index);
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3572
diff changeset
496 if (tag.is_field_or_method()) {
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3572
diff changeset
497 index = cp->uncached_klass_ref_index_at(index);
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3572
diff changeset
498 tag = cp->tag_at(index);
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3572
diff changeset
499 }
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3572
diff changeset
500
4176
a428df0139f3 Initialize resolved as well as unresolved classes in the native implementation of HotSpotConstantPool.loadReferencedType()
Peter Hofer <peter.hofer@jku.at>
parents: 4139
diff changeset
501 if (tag.is_unresolved_klass() || tag.is_klass()) {
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
502 Klass* klass = cp->klass_at(index, CHECK);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
503 if (klass->oop_is_instance()) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
504 InstanceKlass::cast(klass)->initialize(CHECK);
3577
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3572
diff changeset
505 }
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3572
diff changeset
506 }
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
507 C2V_END
3577
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3572
diff changeset
508
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
509 C2V_VMENTRY(jobject, lookupFieldInPool, (JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte opcode))
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
510 ResourceMark rm;
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
511
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
512 index = GraalCompiler::to_cp_index_u2(index);
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
513 constantPoolHandle cp = InstanceKlass::cast(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(constantPoolHolder)))->constants();
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
514
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
515 int nt_index = cp->name_and_type_ref_index_at(index);
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
516 int sig_index = cp->signature_ref_index_at(nt_index);
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
517 Symbol* signature = cp->symbol_at(sig_index);
3649
5a8c44b5fb80 Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3648
diff changeset
518 int name_index = cp->name_ref_index_at(nt_index);
5a8c44b5fb80 Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3648
diff changeset
519 Symbol* name = cp->symbol_at(name_index);
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
520 int holder_index = cp->klass_ref_index_at(index);
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
521 Handle holder = GraalCompiler::get_JavaType(cp, holder_index, cp->pool_holder(), CHECK_NULL);
3649
5a8c44b5fb80 Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3648
diff changeset
522 instanceKlassHandle holder_klass;
8945
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
523
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
524 Bytecodes::Code code = (Bytecodes::Code)(((int) opcode) & 0xFF);
3649
5a8c44b5fb80 Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3648
diff changeset
525 int offset = -1;
5a8c44b5fb80 Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3648
diff changeset
526 AccessFlags flags;
5a8c44b5fb80 Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3648
diff changeset
527 BasicType basic_type;
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
528 if (holder->klass() == SystemDictionary::HotSpotResolvedObjectType_klass()) {
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
529 FieldAccessInfo result;
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
530 LinkResolver::resolve_field(result, cp, index,
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
531 Bytecodes::java_code(code),
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
532 true, false, Thread::current());
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
533 if (HAS_PENDING_EXCEPTION) {
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
534 CLEAR_PENDING_EXCEPTION;
3655
2a0cb564e470 Do not use result when resolve_field throws an exception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3653
diff changeset
535 } else {
2a0cb564e470 Do not use result when resolve_field throws an exception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3653
diff changeset
536 offset = result.field_offset();
2a0cb564e470 Do not use result when resolve_field throws an exception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3653
diff changeset
537 flags = result.access_flags();
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
538 holder_klass = result.klass()();
3655
2a0cb564e470 Do not use result when resolve_field throws an exception.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3653
diff changeset
539 basic_type = result.field_type();
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5548
diff changeset
540 holder = GraalCompiler::get_JavaType(holder_klass, CHECK_NULL);
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
541 }
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
542 }
8945
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
543
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
544 Handle type = GraalCompiler::get_JavaTypeFromSignature(signature, cp->pool_holder(), CHECK_NULL);
6442
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
545 Handle field_handle = GraalCompiler::get_JavaField(offset, flags.as_int(), name, holder, type, THREAD);
3649
5a8c44b5fb80 Remove ci usage on field lookup.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3648
diff changeset
546
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
547 return JNIHandles::make_local(THREAD, field_handle());
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
548 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
549
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
550 C2V_VMENTRY(jobject, resolveMethod, (JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature))
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
551
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
552 assert(JNIHandles::resolve(resolved_type) != NULL, "");
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
553 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(resolved_type));
7812
a42dc71ad051 Remove usages of VmIds.toSymbol.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7811
diff changeset
554 Symbol* name_symbol = java_lang_String::as_symbol(JNIHandles::resolve(name), THREAD);
a42dc71ad051 Remove usages of VmIds.toSymbol.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7811
diff changeset
555 Symbol* signature_symbol = java_lang_String::as_symbol(JNIHandles::resolve(signature), THREAD);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
556 methodHandle method = klass->lookup_method(name_symbol, signature_symbol);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
557 if (method.is_null()) {
2901
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
558 if (TraceGraal >= 3) {
1477
30e1f67703da Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1470
diff changeset
559 ResourceMark rm;
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
560 tty->print_cr("Could not resolve method %s %s on klass %s", name_symbol->as_C_string(), signature_symbol->as_C_string(), klass->name()->as_C_string());
1477
30e1f67703da Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1470
diff changeset
561 }
30e1f67703da Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1470
diff changeset
562 return NULL;
30e1f67703da Fix for failed method lookup.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1470
diff changeset
563 }
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
564 Handle holder = GraalCompiler::get_JavaType(method->method_holder(), CHECK_NULL);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
565 return JNIHandles::make_local(THREAD, VMToCompiler::createResolvedJavaMethod(holder, method(), THREAD));
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
566 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
567
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
568 C2V_VMENTRY(jboolean, isTypeInitialized,(JNIEnv *, jobject, jobject hotspot_klass))
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
569 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(hotspot_klass));
3618
e82da3a1bbc9 Fix crash in branch prediction if there's no current environment.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3587
diff changeset
570 assert(klass != NULL, "method must not be called for primitive types");
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
571 return InstanceKlass::cast(klass)->is_initialized();
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
572 C2V_END
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2990
diff changeset
573
9126
bc26f978b0ce HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
Bernhard Urban <bernhard.urban@jku.at>
parents: 9108
diff changeset
574 C2V_VMENTRY(jboolean, hasFinalizableSubclass,(JNIEnv *, jobject, jobject hotspot_klass))
bc26f978b0ce HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
Bernhard Urban <bernhard.urban@jku.at>
parents: 9108
diff changeset
575 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(hotspot_klass));
bc26f978b0ce HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
Bernhard Urban <bernhard.urban@jku.at>
parents: 9108
diff changeset
576 assert(klass != NULL, "method must not be called for primitive types");
bc26f978b0ce HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
Bernhard Urban <bernhard.urban@jku.at>
parents: 9108
diff changeset
577 return Dependencies::find_finalizable_subclass(klass) != NULL;
bc26f978b0ce HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
Bernhard Urban <bernhard.urban@jku.at>
parents: 9108
diff changeset
578 C2V_END
bc26f978b0ce HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
Bernhard Urban <bernhard.urban@jku.at>
parents: 9108
diff changeset
579
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
580 C2V_VMENTRY(void, initializeType, (JNIEnv *, jobject, jobject hotspot_klass))
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
581 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(hotspot_klass));
6549
15e04f248d6b Add functionality to initialize a type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6521
diff changeset
582 assert(klass != NULL, "method must not be called for primitive types");
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
583 InstanceKlass::cast(klass)->initialize(JavaThread::current());
6549
15e04f248d6b Add functionality to initialize a type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6521
diff changeset
584 C2V_END
15e04f248d6b Add functionality to initialize a type
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6521
diff changeset
585
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
586 C2V_VMENTRY(jobject, getInstanceFields, (JNIEnv *, jobject, jobject klass))
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
587 ResourceMark rm;
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
588
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
589 instanceKlassHandle k = java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(klass));
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
590 GrowableArray<Handle> fields(k->java_fields_count());
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
591
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
592 for (AllFieldStream fs(k()); !fs.done(); fs.next()) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
593 if (!fs.access_flags().is_static()) {
9985
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
594 Handle type = GraalCompiler::get_JavaTypeFromSignature(fs.signature(), k, THREAD);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
595 int flags = fs.access_flags().as_int();
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
596 bool internal = fs.access_flags().is_internal();
9985
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
597 Handle name = java_lang_String::create_from_symbol(fs.name(), THREAD);
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
598 Handle field = VMToCompiler::createJavaField(JNIHandles::resolve(klass), name, type, fs.offset(), flags, internal, THREAD);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
599 fields.append(field());
3587
1692a2f9bfc5 Only return declared fields on fields() call.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3586
diff changeset
600 }
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
601 }
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
602 objArrayHandle field_array = oopFactory::new_objArray(SystemDictionary::HotSpotResolvedJavaField_klass(), fields.length(), CHECK_NULL);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
603 for (int i = 0; i < fields.length(); ++i) {
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
604 field_array->obj_at_put(i, fields.at(i)());
3638
e53cfcb230a7 Fixed an issue with the runtime queried escape analysis field array.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3637
diff changeset
605 }
9985
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
606 return JNIHandles::make_local(THREAD, field_array());
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
607 C2V_END
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
608
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
609 C2V_VMENTRY(jobject, getMethods, (JNIEnv *, jobject, jobject klass))
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
610 ResourceMark rm;
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
611
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
612 instanceKlassHandle k(THREAD, java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(klass)));
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
613 Array<Method*>* methods = k->methods();
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
614 int methods_length = methods->length();
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
615
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
616 // Allocate result
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
617 objArrayOop r = oopFactory::new_objArray(SystemDictionary::HotSpotResolvedJavaMethod_klass(), methods_length, CHECK_NULL);
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
618 objArrayHandle result (THREAD, r);
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
619
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
620 for (int i = 0; i < methods_length; i++) {
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
621 methodHandle method(THREAD, methods->at(i));
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
622 Handle holder = JNIHandles::resolve(klass);
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
623 oop m = VMToCompiler::createResolvedJavaMethod(holder, method(), THREAD);
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
624 result->obj_at_put(i, m);
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
625 }
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
626
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
627 return JNIHandles::make_local(THREAD, result());
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
628 C2V_END
3090
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3055
diff changeset
629
9649
dd62ccda1849 rename parameter
Doug Simon <doug.simon@oracle.com>
parents: 9610
diff changeset
630 C2V_VMENTRY(jlong, getMaxCallTargetOffset, (JNIEnv *env, jobject, jlong addr))
dd62ccda1849 rename parameter
Doug Simon <doug.simon@oracle.com>
parents: 9610
diff changeset
631 address target_addr = (address) addr;
3563
8780fa370aab Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents: 3559
diff changeset
632 if (target_addr != 0x0) {
8780fa370aab Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents: 3559
diff changeset
633 int64_t off_low = (int64_t)target_addr - ((int64_t)CodeCache::low_bound() + sizeof(int));
8780fa370aab Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents: 3559
diff changeset
634 int64_t off_high = (int64_t)target_addr - ((int64_t)CodeCache::high_bound() + sizeof(int));
8780fa370aab Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents: 3559
diff changeset
635 return MAX2(ABS(off_low), ABS(off_high));
8780fa370aab Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents: 3559
diff changeset
636 }
8780fa370aab Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents: 3559
diff changeset
637 return -1;
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
638 C2V_END
3563
8780fa370aab Support runtime calls to targets that don't fit in a 32-bit immediate: allow to query the maximum offset of a CiRuntimeCall target to determine the required immediate size and patch call sites with a mov/call instruction pair for indirect calls
Peter Hofer <peter.hofer@jku.at>
parents: 3559
diff changeset
639
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
640 C2V_VMENTRY(jobject, getResolvedType, (JNIEnv *env, jobject, jobject javaClass))
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
641 oop java_mirror = JNIHandles::resolve(javaClass);
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
642 assert(java_mirror != NULL, "argument to CompilerToVM.getResolvedType must not be NULL");
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
643 Handle type = GraalCompiler::get_JavaTypeFromClass(java_mirror, CHECK_NULL);
6442
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6387
diff changeset
644 return JNIHandles::make_local(THREAD, type());
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
645 C2V_END
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
646
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
647
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
648 // helpers used to set fields in the HotSpotVMConfig object
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
649 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
650 jfieldID id = env->GetFieldID(env->GetObjectClass(obj), name, sig);
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
651 if (id == NULL) {
3552
aa7b62997aa0 better error message of field not found
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3549
diff changeset
652 fatal(err_msg("field not found: %s (%s)", name, sig));
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
653 }
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
654 return id;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
655 }
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
656
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
657 C2V_ENTRY(void, initializeConfiguration, (JNIEnv *env, jobject, jobject config))
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
658
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
659 #define set_boolean(name, value) do { env->SetBooleanField(config, getFieldID(env, config, name, "Z"), value); } while (0)
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
660 #define set_int(name, value) do { env->SetIntField(config, getFieldID(env, config, name, "I"), value); } while (0)
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
661 #define set_long(name, value) do { env->SetLongField(config, getFieldID(env, config, name, "J"), value); } while (0)
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
662 #define set_address(name, value) do { set_long(name, (jlong) value); } while (0)
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
663 #define set_object(name, value) do { env->SetObjectField(config, getFieldID(env, config, name, "Ljava/lang/Object;"), value); } while (0)
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
664 #define set_int_array(name, value) do { env->SetObjectField(config, getFieldID(env, config, name, "[I"), value); } while (0)
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
665
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
666 guarantee(HeapWordSize == sizeof(char*), "Graal assumption that HeadWordSize == machine word size is wrong");
9585
404eb9b2c511 use os.name property to identify Windows OS
twisti
parents: 9584
diff changeset
667
9519
af0b79174c3d exposed whether ASSERT is defined to Java code and use it to enable checks in ExceptionHandlerStub
Doug Simon <doug.simon@oracle.com>
parents: 9471
diff changeset
668 set_boolean("cAssertions", DEBUG_ONLY(true) NOT_DEBUG(false));
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
669 set_boolean("verifyOops", VerifyOops);
7569
7cae58134ff7 collection of Graal compilation speed metrics is now triggered by -XX:+CITime instead of -Dgraal.benchmark.compilation=true
Doug Simon <doug.simon@oracle.com>
parents: 7484
diff changeset
670 set_boolean("ciTime", CITime);
10069
abb9d3a26025 an instanceof instruction lowers to a deoptimize-on-hint-miss snippet only if its profile indicates a miss (of a hint type) occurs an order of magnitude less than the compilation threshold
Doug Simon <doug.simon@oracle.com>
parents: 10056
diff changeset
671 set_int("compileThreshold", CompileThreshold);
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 9027
diff changeset
672 set_boolean("compileTheWorld", CompileTheWorld);
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 9027
diff changeset
673 set_int("compileTheWorldStartAt", CompileTheWorldStartAt);
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 9027
diff changeset
674 set_int("compileTheWorldStopAt", CompileTheWorldStopAt);
8996
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8960
diff changeset
675 set_boolean("printCompilation", PrintCompilation);
6d86ce1297bc GRAAL-213: add HotSpot-style PrintCompilation and PrintInlining
twisti
parents: 8960
diff changeset
676 set_boolean("printInlining", PrintInlining);
7154
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
677 set_boolean("useFastLocking", GraalUseFastLocking);
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
678 set_boolean("useBiasedLocking", UseBiasedLocking);
7373
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents: 7363
diff changeset
679 set_boolean("usePopCountInstruction", UsePopCountInstruction);
6b2c55fc9ba8 reworked mechanism for omitting intrinsics if the underlying hardware support is not available and used it to make intrinsification of Integer.bitCount() dependent on whether the POPCNT instruction is available
Doug Simon <doug.simon@oracle.com>
parents: 7363
diff changeset
680 set_boolean("useAESIntrinsics", UseAESIntrinsics);
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
681 set_boolean("useTLAB", UseTLAB);
8488
225c984588ee -Snippetization of CMS write barriers
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 7786
diff changeset
682 set_boolean("useG1GC", UseG1GC);
9934
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents: 9928
diff changeset
683 #ifdef TARGET_ARCH_x86
9189
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 9126
diff changeset
684 set_int("useSSE", UseSSE);
0331f7512be2 CPU capability detection.
Roland Schatz <roland.schatz@oracle.com>
parents: 9126
diff changeset
685 set_int("useAVX", UseAVX);
9934
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents: 9928
diff changeset
686 #endif
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
687 set_int("codeEntryAlignment", CodeEntryAlignment);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
688 set_int("stackShadowPages", StackShadowPages);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
689 set_int("hubOffset", oopDesc::klass_offset_in_bytes());
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
690 set_int("markOffset", oopDesc::mark_offset_in_bytes());
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
691 set_int("prototypeMarkWordOffset", in_bytes(Klass::prototype_header_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
692 set_int("superCheckOffsetOffset", in_bytes(Klass::super_check_offset_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
693 set_int("secondarySuperCacheOffset", in_bytes(Klass::secondary_super_cache_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
694 set_int("secondarySupersOffset", in_bytes(Klass::secondary_supers_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
695 set_int("subklassOffset", in_bytes(Klass::subklass_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
696 set_int("nextSiblingOffset", in_bytes(Klass::next_sibling_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
697 set_int("arrayLengthOffset", arrayOopDesc::length_offset_in_bytes());
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
698 set_int("klassStateOffset", in_bytes(InstanceKlass::init_state_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
699 set_int("klassStateFullyInitialized", (int)InstanceKlass::fully_initialized);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
700 set_int("threadTlabTopOffset", in_bytes(JavaThread::tlab_top_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
701 set_int("threadTlabEndOffset", in_bytes(JavaThread::tlab_end_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
702 set_int("threadObjectOffset", in_bytes(JavaThread::threadObj_offset()));
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9519
diff changeset
703 set_int("threadIsMethodHandleReturnOffset", in_bytes(JavaThread::is_method_handle_return_offset()));
8451
2ffd472c5d25 Backed out changeset: 10293cbfc2b6
Doug Simon <doug.simon@oracle.com>
parents: 8436
diff changeset
704 set_int("osThreadOffset", in_bytes(JavaThread::osthread_offset()));
7226
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
705 set_int("osThreadInterruptedOffset", in_bytes(OSThread::interrupted_offset()));
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
706 set_int("unlockedMask", (int) markOopDesc::unlocked_value);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
707 set_int("biasedLockMaskInPlace", (int) markOopDesc::biased_lock_mask_in_place);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
708 set_int("ageMaskInPlace", (int) markOopDesc::age_mask_in_place);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
709 set_int("epochMaskInPlace", (int) markOopDesc::epoch_mask_in_place);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
710 set_int("biasedLockPattern", (int) markOopDesc::biased_lock_pattern);
7483
729a79037bd5 Fixes after merge with hs25-b15.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7373
diff changeset
711 set_int("methodMaxLocalsOffset", in_bytes(ConstMethod::size_of_locals_offset()));
7212
291ffc492eb6 Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
712 set_int("methodConstMethodOffset", in_bytes(Method::const_offset()));
291ffc492eb6 Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
713 set_int("constMethodMaxStackOffset", in_bytes(ConstMethod::max_stack_offset()));
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9693
diff changeset
714 set_int("constMethodConstantsOffset", in_bytes(ConstMethod::constants_offset()));
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9693
diff changeset
715 set_int("constantPoolHolderOffset", ConstantPool::pool_holder_offset_in_bytes());
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
716 set_int("extraStackEntries", Method::extra_stack_entries());
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
717 set_int("methodAccessFlagsOffset", in_bytes(Method::access_flags_offset()));
10056
a323a9e20f9d Fixed a few race conditions in the compilation queue.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 10026
diff changeset
718 set_int("methodQueuedForCompilationBit", (int) JVM_ACC_QUEUED);
9013
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 9011
diff changeset
719 set_int("methodIntrinsicIdOffset", Method::intrinsic_id_offset_in_bytes());
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
720 set_int("klassHasFinalizerFlag", JVM_ACC_HAS_FINALIZER);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
721 set_int("threadExceptionOopOffset", in_bytes(JavaThread::exception_oop_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
722 set_int("threadExceptionPcOffset", in_bytes(JavaThread::exception_pc_offset()));
9934
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents: 9928
diff changeset
723 #ifdef TARGET_ARCH_x86
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
724 set_boolean("isPollingPageFar", Assembler::is_polling_page_far());
9934
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents: 9928
diff changeset
725 set_int("runtimeCallStackSize", (jint)frame::arg_reg_save_area_bytes);
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents: 9928
diff changeset
726 #endif
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
727 set_int("classMirrorOffset", in_bytes(Klass::java_mirror_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
728 set_int("klassModifierFlagsOffset", in_bytes(Klass::modifier_flags_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
729 set_int("klassAccessFlagsOffset", in_bytes(Klass::access_flags_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
730 set_int("klassOffset", java_lang_Class::klass_offset_in_bytes());
10026
2beeb916aa31 Add arrayKlassOffset field to HotSpotVMConfig.
Roland Schatz <roland.schatz@oracle.com>
parents: 9994
diff changeset
731 set_int("arrayKlassOffset", java_lang_Class::array_klass_offset_in_bytes());
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
732 set_int("graalMirrorInClassOffset", java_lang_Class::graal_mirror_offset_in_bytes());
7226
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
733 set_int("klassLayoutHelperOffset", in_bytes(Klass::layout_helper_offset()));
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
734 set_int("klassSuperKlassOffset", in_bytes(Klass::super_offset()));
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
735 set_int("methodDataOffset", in_bytes(Method::method_data_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
736 set_int("nmethodEntryOffset", nmethod::verified_entry_point_offset());
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
737 set_int("methodCompiledEntryOffset", in_bytes(Method::from_compiled_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
738 set_int("basicLockSize", sizeof(BasicLock));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
739 set_int("basicLockDisplacedHeaderOffset", BasicLock::displaced_header_offset_in_bytes());
7226
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
740 set_int("uninitializedIdentityHashCodeValue", markOopDesc::no_hash);
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
741 set_int("identityHashCodeShift", markOopDesc::hash_shift);
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
742
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
743 set_int("arrayKlassLayoutHelperIdentifier", 0x80000000);
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
744 assert((Klass::_lh_array_tag_obj_value & Klass::_lh_array_tag_type_value & 0x80000000) != 0, "obj_array and type_array must have first bit set");
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
745 set_int("arrayKlassComponentMirrorOffset", in_bytes(ArrayKlass::component_mirror_offset()));
8945
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
746
8337
37977d1dcedc Transmit deoptimization reason in thread local.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8269
diff changeset
747
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
748 set_int("pendingExceptionOffset", in_bytes(ThreadShadow::pending_exception_offset()));
8337
37977d1dcedc Transmit deoptimization reason in thread local.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8269
diff changeset
749 set_int("pendingDeoptimizationOffset", in_bytes(ThreadShadow::pending_deoptimization_offset()));
37977d1dcedc Transmit deoptimization reason in thread local.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8269
diff changeset
750
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
751 set_int("metaspaceArrayLengthOffset", Array<Klass*>::length_offset_in_bytes());
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
752 set_int("metaspaceArrayBaseOffset", Array<Klass*>::base_offset_in_bytes());
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
753 set_int("methodDataOopDataOffset", in_bytes(MethodData::data_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
754 set_int("methodDataOopTrapHistoryOffset", in_bytes(MethodData::trap_history_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
755 set_int("dataLayoutHeaderSize", DataLayout::header_size_in_bytes());
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
756 set_int("dataLayoutTagOffset", in_bytes(DataLayout::tag_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
757 set_int("dataLayoutFlagsOffset", in_bytes(DataLayout::flags_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
758 set_int("dataLayoutBCIOffset", in_bytes(DataLayout::bci_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
759 set_int("dataLayoutCellsOffset", in_bytes(DataLayout::cell_offset(0)));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
760 set_int("dataLayoutCellSize", DataLayout::cell_size);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
761 set_int("bciProfileWidth", BciProfileWidth);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
762 set_int("typeProfileWidth", TypeProfileWidth);
9760
c76b43ed5089 Added infrastructure for recording invoked methods in the profiling information.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 9693
diff changeset
763 set_int("methodProfileWidth", MethodProfileWidth);
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
764
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
765 set_int("tlabAlignmentReserve", (int32_t)ThreadLocalAllocBuffer::alignment_reserve());
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
766 set_long("tlabIntArrayMarkWord", (intptr_t)markOopDesc::prototype()->copy_set_hash(0x2));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
767 set_long("heapTopAddress", (jlong)(address) Universe::heap()->top_addr());
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
768 set_long("heapEndAddress", (jlong)(address) Universe::heap()->end_addr());
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
769 set_int("threadTlabStartOffset", in_bytes(JavaThread::tlab_start_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
770 set_int("threadTlabSizeOffset", in_bytes(JavaThread::tlab_size_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
771 set_int("threadAllocatedBytesOffset", in_bytes(JavaThread::allocated_bytes_offset()));
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
772 set_int("threadLastJavaSpOffset", in_bytes(JavaThread::last_Java_sp_offset()));
9934
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents: 9928
diff changeset
773 #ifdef TARGET_ARCH_x86
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
774 set_int("threadLastJavaFpOffset", in_bytes(JavaThread::last_Java_fp_offset()));
9934
0f7ca53be929 CR-806: Changes to build Graal for SPARC
Morris Meyer <morris.meyer@oracle.com>
parents: 9928
diff changeset
775 #endif
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
776 set_int("threadLastJavaPcOffset", in_bytes(JavaThread::last_Java_pc_offset()));
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
777 set_int("threadObjectResultOffset", in_bytes(JavaThread::vm_result_offset()));
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
778 set_int("tlabSlowAllocationsOffset", in_bytes(JavaThread::tlab_slow_allocations_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
779 set_int("tlabFastRefillWasteOffset", in_bytes(JavaThread::tlab_fast_refill_waste_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
780 set_int("tlabNumberOfRefillsOffset", in_bytes(JavaThread::tlab_number_of_refills_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
781 set_int("tlabRefillWasteLimitOffset", in_bytes(JavaThread::tlab_refill_waste_limit_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
782 set_int("tlabRefillWasteIncrement", (int32_t) ThreadLocalAllocBuffer::refill_waste_limit_increment());
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
783 set_int("klassInstanceSizeOffset", in_bytes(Klass::layout_helper_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
784 set_boolean("tlabStats", TLABStats);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
785 set_boolean("inlineContiguousAllocationSupported", !CMSIncrementalMode && Universe::heap()->supports_inline_contig_alloc());
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
786
9582
7df076e74e8e fixed bug in updating of VerifyOops counter
Doug Simon <doug.simon@oracle.com>
parents: 9581
diff changeset
787 set_long("verifyOopCounterAddress", (jlong)(address) StubRoutines::verify_oop_count_addr());
9574
df3aa336a313 replaced verify_oop assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9562
diff changeset
788 set_long("verifyOopMask", Universe::verify_oop_mask());
df3aa336a313 replaced verify_oop assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9562
diff changeset
789 set_long("verifyOopBits", Universe::verify_oop_bits());
df3aa336a313 replaced verify_oop assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9562
diff changeset
790
7147
88d626e2c2a8 added TLAB fast refill stub for array allocation
Doug Simon <doug.simon@oracle.com>
parents: 7145
diff changeset
791 set_long("arrayPrototypeMarkWord", (intptr_t)markOopDesc::prototype());
88d626e2c2a8 added TLAB fast refill stub for array allocation
Doug Simon <doug.simon@oracle.com>
parents: 7145
diff changeset
792 set_int("layoutHelperLog2ElementSizeShift", Klass::_lh_log2_element_size_shift);
88d626e2c2a8 added TLAB fast refill stub for array allocation
Doug Simon <doug.simon@oracle.com>
parents: 7145
diff changeset
793 set_int("layoutHelperLog2ElementSizeMask", Klass::_lh_log2_element_size_mask);
88d626e2c2a8 added TLAB fast refill stub for array allocation
Doug Simon <doug.simon@oracle.com>
parents: 7145
diff changeset
794 set_int("layoutHelperElementTypeShift", Klass::_lh_element_type_shift);
88d626e2c2a8 added TLAB fast refill stub for array allocation
Doug Simon <doug.simon@oracle.com>
parents: 7145
diff changeset
795 set_int("layoutHelperElementTypeMask", Klass::_lh_element_type_mask);
7760
0ae87cf94914 add primitive type mask to HotSpotVMConfig
Lukas Stadler <lukas.stadler@jku.at>
parents: 7735
diff changeset
796 // this filters out the bit that differentiates a type array from an object array
0ae87cf94914 add primitive type mask to HotSpotVMConfig
Lukas Stadler <lukas.stadler@jku.at>
parents: 7735
diff changeset
797 set_int("layoutHelperElementTypePrimitiveInPlace", (Klass::_lh_array_tag_type_value & ~Klass::_lh_array_tag_obj_value) << Klass::_lh_array_tag_shift);
7147
88d626e2c2a8 added TLAB fast refill stub for array allocation
Doug Simon <doug.simon@oracle.com>
parents: 7145
diff changeset
798 set_int("layoutHelperHeaderSizeShift", Klass::_lh_header_size_shift);
88d626e2c2a8 added TLAB fast refill stub for array allocation
Doug Simon <doug.simon@oracle.com>
parents: 7145
diff changeset
799 set_int("layoutHelperHeaderSizeMask", Klass::_lh_header_size_mask);
88d626e2c2a8 added TLAB fast refill stub for array allocation
Doug Simon <doug.simon@oracle.com>
parents: 7145
diff changeset
800 set_int("layoutHelperOffset", in_bytes(Klass::layout_helper_offset()));
88d626e2c2a8 added TLAB fast refill stub for array allocation
Doug Simon <doug.simon@oracle.com>
parents: 7145
diff changeset
801
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
802 set_address("inlineCacheMissStub", SharedRuntime::get_ic_miss_stub());
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
803 set_address("handleDeoptStub", SharedRuntime::deopt_blob()->unpack());
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
804 set_address("aescryptEncryptBlockStub", StubRoutines::aescrypt_encryptBlock());
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
805 set_address("aescryptDecryptBlockStub", StubRoutines::aescrypt_decryptBlock());
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
806 set_address("cipherBlockChainingEncryptAESCryptStub", StubRoutines::cipherBlockChaining_encryptAESCrypt());
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
807 set_address("cipherBlockChainingDecryptAESCryptStub", StubRoutines::cipherBlockChaining_decryptAESCrypt());
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
808
9352
d4684b468e93 made NewInstanceStub a RuntimeStub that directly calls the C runtime (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9338
diff changeset
809 set_address("newInstanceAddress", GraalRuntime::new_instance);
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
810 set_address("newArrayAddress", GraalRuntime::new_array);
9355
4e260c2ced0e removed new_multi_array assembler stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9352
diff changeset
811 set_address("newMultiArrayAddress", GraalRuntime::new_multi_array);
9419
640d86a6bf4a replaced register_finalizer assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9355
diff changeset
812 set_address("registerFinalizerAddress", SharedRuntime::register_finalizer);
9420
393d62a868da replaced thread_is_interrupted assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9419
diff changeset
813 set_address("threadIsInterruptedAddress", GraalRuntime::thread_is_interrupted);
9453
cdc839f22a23 renamed HotSpot specific parts of deoptimization stub: DEOPTIMIZE -> UNCOMMON_TRAP
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
814 set_address("uncommonTrapStub", SharedRuntime::deopt_blob()->uncommon_trap());
9471
5fa54bf57f8c replaced exception_handler_nofpu assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9463
diff changeset
815 set_address("vmMessageAddress", GraalRuntime::vm_message);
9461
a14fef4fca7d replaced identity_hash_code assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9421
diff changeset
816 set_address("identityHashCodeAddress", GraalRuntime::identity_hash_code);
9562
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9519
diff changeset
817 set_address("exceptionHandlerForPcAddress", GraalRuntime::exception_handler_for_pc);
99ef9bcb3f32 replaced unwind_exception_call assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9519
diff changeset
818 set_address("exceptionHandlerForReturnAddressAddress", SharedRuntime::exception_handler_for_return_address);
9577
ffd3d85e055f replaced OSR_migration_end assembler stub with a compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9574
diff changeset
819 set_address("osrMigrationEndAddress", SharedRuntime::OSR_migration_end);
9590
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9582
diff changeset
820 set_address("monitorenterAddress", GraalRuntime::monitorenter);
5f9c41cd3b1e replaced monitorenter/monitorexit assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9582
diff changeset
821 set_address("monitorexitAddress", GraalRuntime::monitorexit);
9591
0381c7937e7a replaced create_null_pointer_exception assembler stub with compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9590
diff changeset
822 set_address("createNullPointerExceptionAddress", GraalRuntime::create_null_exception);
9592
efb8c1918ea5 replaced create_out_of_bounds_exception assembler stub with compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9591
diff changeset
823 set_address("createOutOfBoundsExceptionAddress", GraalRuntime::create_out_of_bounds_exception);
9593
a3b4bcc22313 replaced log_* assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9592
diff changeset
824 set_address("logPrimitiveAddress", GraalRuntime::log_primitive);
a3b4bcc22313 replaced log_* assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9592
diff changeset
825 set_address("logObjectAddress", GraalRuntime::log_object);
a3b4bcc22313 replaced log_* assembler stubs with compiled stubs (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9592
diff changeset
826 set_address("logPrintfAddress", GraalRuntime::log_printf);
9594
743326387173 replaced vm_error assembler stub with compiled stub (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9593
diff changeset
827 set_address("vmErrorAddress", GraalRuntime::vm_error);
9820
1b60f639ac4b implemented alternative implementation for loading the exception object from the thread at the start of an exception dispatcher
Doug Simon <doug.simon@oracle.com>
parents: 9760
diff changeset
828 set_address("loadAndClearExceptionAddress", GraalRuntime::load_and_clear_exception);
9693
d04944441454 cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents: 9669
diff changeset
829 set_address("javaTimeMillisAddress", CAST_FROM_FN_PTR(address, os::javaTimeMillis));
d04944441454 cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents: 9669
diff changeset
830 set_address("javaTimeNanosAddress", CAST_FROM_FN_PTR(address, os::javaTimeNanos));
d04944441454 cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents: 9669
diff changeset
831 set_address("arithmeticSinAddress", CAST_FROM_FN_PTR(address, SharedRuntime::dsin));
d04944441454 cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents: 9669
diff changeset
832 set_address("arithmeticCosAddress", CAST_FROM_FN_PTR(address, SharedRuntime::dcos));
d04944441454 cleaned up and simplified runtime call mechanisms
Doug Simon <doug.simon@oracle.com>
parents: 9669
diff changeset
833 set_address("arithmeticTanAddress", CAST_FROM_FN_PTR(address, SharedRuntime::dtan));
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
834
7154
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
835 set_int("deoptReasonNone", Deoptimization::Reason_none);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
836 set_int("deoptReasonNullCheck", Deoptimization::Reason_null_check);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
837 set_int("deoptReasonRangeCheck", Deoptimization::Reason_range_check);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
838 set_int("deoptReasonClassCheck", Deoptimization::Reason_class_check);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
839 set_int("deoptReasonArrayCheck", Deoptimization::Reason_array_check);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
840 set_int("deoptReasonUnreached0", Deoptimization::Reason_unreached0);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
841 set_int("deoptReasonTypeCheckInlining", Deoptimization::Reason_type_checked_inlining);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
842 set_int("deoptReasonOptimizedTypeCheck", Deoptimization::Reason_optimized_type_check);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
843 set_int("deoptReasonNotCompiledExceptionHandler", Deoptimization::Reason_not_compiled_exception_handler);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
844 set_int("deoptReasonUnresolved", Deoptimization::Reason_unresolved);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
845 set_int("deoptReasonJsrMismatch", Deoptimization::Reason_jsr_mismatch);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
846 set_int("deoptReasonDiv0Check", Deoptimization::Reason_div0_check);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
847 set_int("deoptReasonConstraint", Deoptimization::Reason_constraint);
9444
fd60b73f1759 Add LoopLimitCheck deoptimization reason
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9421
diff changeset
848 set_int("deoptReasonLoopLimitCheck", Deoptimization::Reason_loop_limit_check);
7154
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
849
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
850 set_int("deoptActionNone", Deoptimization::Action_none);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
851 set_int("deoptActionMaybeRecompile", Deoptimization::Action_maybe_recompile);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
852 set_int("deoptActionReinterpret", Deoptimization::Action_reinterpret);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
853 set_int("deoptActionMakeNotEntrant", Deoptimization::Action_make_not_entrant);
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7147
diff changeset
854 set_int("deoptActionMakeNotCompilable", Deoptimization::Action_make_not_compilable);
9013
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 9011
diff changeset
855
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 9011
diff changeset
856 set_int("vmIntrinsicInvokeBasic", vmIntrinsics::_invokeBasic);
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 9011
diff changeset
857 set_int("vmIntrinsicLinkToVirtual", vmIntrinsics::_linkToVirtual);
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 9011
diff changeset
858 set_int("vmIntrinsicLinkToStatic", vmIntrinsics::_linkToStatic);
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 9011
diff changeset
859 set_int("vmIntrinsicLinkToSpecial", vmIntrinsics::_linkToSpecial);
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 9011
diff changeset
860 set_int("vmIntrinsicLinkToInterface", vmIntrinsics::_linkToInterface);
3b0ec709827c added macro substitutions for the @PolymorphicSignature methods in MethodHandle
Doug Simon <doug.simon@oracle.com>
parents: 9011
diff changeset
861
9883
477fb9a9a06d Delegate compressed oop arguments from HotSpot to Graal
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9820
diff changeset
862 set_boolean("useCompressedOops", UseCompressedOops);
477fb9a9a06d Delegate compressed oop arguments from HotSpot to Graal
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9820
diff changeset
863 set_boolean("useCompressedKlassPointers", UseCompressedKlassPointers);
477fb9a9a06d Delegate compressed oop arguments from HotSpot to Graal
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9820
diff changeset
864 set_address("narrowOopBase", Universe::narrow_oop_base());
477fb9a9a06d Delegate compressed oop arguments from HotSpot to Graal
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9820
diff changeset
865 set_int("narrowOopShift", Universe::narrow_oop_shift());
477fb9a9a06d Delegate compressed oop arguments from HotSpot to Graal
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9820
diff changeset
866 set_int("logMinObjAlignment", LogMinObjAlignmentInBytes);
477fb9a9a06d Delegate compressed oop arguments from HotSpot to Graal
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9820
diff changeset
867
8490
1567c6cc6561 Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8489
diff changeset
868 set_int("g1CardQueueIndexOffset", in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_index()));
1567c6cc6561 Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8489
diff changeset
869 set_int("g1CardQueueBufferOffset", in_bytes(JavaThread::dirty_card_queue_offset() + PtrQueue::byte_offset_of_buf()));
1567c6cc6561 Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8489
diff changeset
870 set_int("logOfHRGrainBytes", HeapRegion::LogOfHRGrainBytes);
1567c6cc6561 Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8489
diff changeset
871 set_int("g1SATBQueueMarkingOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_active()));
1567c6cc6561 Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8489
diff changeset
872 set_int("g1SATBQueueIndexOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_index()));
1567c6cc6561 Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8489
diff changeset
873 set_int("g1SATBQueueBufferOffset", in_bytes(JavaThread::satb_mark_queue_offset() + PtrQueue::byte_offset_of_buf()));
10434
8b22524df53b Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10408
diff changeset
874 set_address("writeBarrierPreAddress", GraalRuntime::write_barrier_pre);
8b22524df53b Add G1 Barriers' foreign calls
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 10408
diff changeset
875 set_address("writeBarrierPostAddress", GraalRuntime::write_barrier_post);
3683
345c3bbf9c3c store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents: 3632
diff changeset
876
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
877 BarrierSet* bs = Universe::heap()->barrier_set();
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
878 switch (bs->kind()) {
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
879 case BarrierSet::CardTableModRef:
8493
9412b1915547 -More G1 WB Integration-Addition of GenerateLEANode for G1 previous value equalities
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8490
diff changeset
880 case BarrierSet::CardTableExtension:
9412b1915547 -More G1 WB Integration-Addition of GenerateLEANode for G1 previous value equalities
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8490
diff changeset
881 case BarrierSet::G1SATBCT:
9412b1915547 -More G1 WB Integration-Addition of GenerateLEANode for G1 previous value equalities
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8490
diff changeset
882 case BarrierSet::G1SATBCTLogging:{
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
883 jlong base = (jlong)((CardTableModRefBS*)bs)->byte_map_base;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
884 assert(base != 0, "unexpected byte_map_base");
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
885 set_long("cardtableStartAddress", base);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
886 set_int("cardtableShift", CardTableModRefBS::card_shift);
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
887 break;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
888 }
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
889 case BarrierSet::ModRef:
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
890 case BarrierSet::Other:
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
891 set_long("cardtableStartAddress", 0);
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
892 set_int("cardtableShift", 0);
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
893 // No post barriers
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
894 break;
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
895 default:
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
896 ShouldNotReachHere();
2926
0e3ec0a4eda4 RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
897 break;
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
898 }
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
899
7143
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
900 set_int("arrayClassElementOffset", in_bytes(ObjArrayKlass::element_klass_offset()));
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
901
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
902 #undef set_boolean
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
903 #undef set_int
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
904 #undef set_long
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
905 #undef set_object
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
906 #undef set_int_array
445193cc2a7d added support for writing stubs in Java and wrote the TLAB fast refill stub
Doug Simon <doug.simon@oracle.com>
parents: 7126
diff changeset
907
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
908 C2V_END
1412
9195b99c841b Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1410
diff changeset
909
9669
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9668
diff changeset
910 C2V_VMENTRY(jint, installCode0, (JNIEnv *jniEnv, jobject, jobject compiled_code, jobject installed_code, jobject triggered_deoptimizations))
3669
53636e2c9d03 No longer use shared ciFactory. Remove make_global usage in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3667
diff changeset
911 ResourceMark rm;
3670
f198b24093f3 put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3669
diff changeset
912 HandleMark hm;
9669
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9668
diff changeset
913 Handle compiled_code_handle = JNIHandles::resolve(compiled_code);
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
914 CodeBlob* cb = NULL;
7000
bf2ea3ed3bce Fixed nmethod not being unloaded after their classloader has been unloaded by initializing _graal_installed_code in an nmethod's constructor
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 6990
diff changeset
915 Handle installed_code_handle = JNIHandles::resolve(installed_code);
8215
b89a97928e72 Implement weak reference semantics for HotSpotInstalledCode in the default method installation case. Add new boolean[] array as parameter to the code installation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8151
diff changeset
916 Handle triggered_deoptimizations_handle = JNIHandles::resolve(triggered_deoptimizations);
7089
af30115c9d0e added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
917 GraalEnv::CodeInstallResult result;
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
918
9669
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9668
diff changeset
919 CodeInstaller installer(compiled_code_handle, result, cb, installed_code_handle, triggered_deoptimizations_handle);
7019
6838696d54ac cleanly handle a failure to install Graal compiled code due to failed dependency (re)checking
Doug Simon <doug.simon@oracle.com>
parents: 7002
diff changeset
920
8526
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
921 if (PrintCodeCacheOnCompilation) {
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
922 stringStream s;
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
923 // Dump code cache into a buffer before locking the tty,
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
924 {
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
925 MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
926 CodeCache::print_summary(&s, false);
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
927 }
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
928 ttyLocker ttyl;
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
929 tty->print_cr(s.as_string());
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
930 }
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
931
7089
af30115c9d0e added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
932 if (result != GraalEnv::ok) {
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
933 assert(cb == NULL, "should be");
7089
af30115c9d0e added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
934 } else {
af30115c9d0e added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
935 if (!installed_code_handle.is_null()) {
af30115c9d0e added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
936 assert(installed_code_handle->is_a(HotSpotInstalledCode::klass()), "wrong type");
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
937 HotSpotInstalledCode::set_codeBlob(installed_code_handle, (jlong) cb);
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
938 HotSpotInstalledCode::set_start(installed_code_handle, (jlong) cb->code_begin());
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
939 nmethod* nm = cb->as_nmethod_or_null();
7089
af30115c9d0e added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
940 assert(nm == NULL || !installed_code_handle->is_scavengable() || nm->on_scavenge_root_list(), "nm should be scavengable if installed_code is scavengable");
af30115c9d0e added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
941 }
3683
345c3bbf9c3c store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents: 3632
diff changeset
942 }
7089
af30115c9d0e added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
943 return result;
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
944 C2V_END
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
945
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
946 C2V_VMENTRY(jobject, getCode, (JNIEnv *jniEnv, jobject, jlong codeBlob))
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
947 ResourceMark rm;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
948 HandleMark hm;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
949
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
950 CodeBlob* cb = (CodeBlob*) (address) codeBlob;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
951 if (cb == NULL) {
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
952 return NULL;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
953 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
954 if (cb->is_nmethod()) {
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
955 nmethod* nm = (nmethod*) cb;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
956 if (!nm->is_alive()) {
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
957 return NULL;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
958 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
959 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
960 int length = cb->code_size();
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
961 arrayOop codeCopy = oopFactory::new_byteArray(length, CHECK_0);
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
962 memcpy(codeCopy->base(T_BYTE), cb->code_begin(), length);
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
963 return JNIHandles::make_local(codeCopy);
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
964 C2V_END
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
965
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
966 C2V_VMENTRY(jobject, disassembleCodeBlob, (JNIEnv *jniEnv, jobject, jlong codeBlob))
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8348
diff changeset
967 ResourceMark rm;
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8348
diff changeset
968 HandleMark hm;
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8348
diff changeset
969
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
970 CodeBlob* cb = (CodeBlob*) (address) codeBlob;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
971 if (cb == NULL) {
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8348
diff changeset
972 return NULL;
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8348
diff changeset
973 }
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8348
diff changeset
974
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
975 // We don't want the stringStream buffer to resize during disassembly as it
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
976 // uses scoped resource memory. If a nested function called during disassembly uses
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
977 // a ResourceMark and the buffer expands within the scope of the mark,
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
978 // the buffer becomes garbage when that scope is exited. Experience shows that
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
979 // the disassembled code is typically about 10x the code size so a fixed buffer
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
980 // sized to 20x code size should be sufficient.
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
981 int bufferSize = cb->code_size() * 20;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
982 char* buffer = NEW_RESOURCE_ARRAY(char, bufferSize);
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
983 stringStream st(buffer, bufferSize);
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
984 if (cb->is_nmethod()) {
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
985 nmethod* nm = (nmethod*) cb;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
986 if (!nm->is_alive()) {
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
987 return NULL;
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
988 }
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
989 Disassembler::decode(nm, &st);
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
990 } else {
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
991 Disassembler::decode(cb, &st);
7784
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7760
diff changeset
992 }
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7760
diff changeset
993
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7760
diff changeset
994 Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL);
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7760
diff changeset
995 return JNIHandles::make_local(result());
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7760
diff changeset
996 C2V_END
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7760
diff changeset
997
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
998 C2V_VMENTRY(jobject, getStackTraceElement, (JNIEnv *env, jobject, jlong metaspace_method, int bci))
5238
cce31bc56c00 made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents: 5154
diff changeset
999 ResourceMark rm;
cce31bc56c00 made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents: 5154
diff changeset
1000 HandleMark hm;
cce31bc56c00 made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents: 5154
diff changeset
1001
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1002 methodHandle method = asMethod(metaspace_method);
5238
cce31bc56c00 made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents: 5154
diff changeset
1003 oop element = java_lang_StackTraceElement::create(method, bci, CHECK_NULL);
cce31bc56c00 made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents: 5154
diff changeset
1004 return JNIHandles::make_local(element);
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
1005 C2V_END
5238
cce31bc56c00 made HotSpotResolvedMethodImpl.toStackTraceElement() call into native code to get an object containing source file info
Doug Simon <doug.simon@oracle.com>
parents: 5154
diff changeset
1006
10475
3489047ffea2 Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10434
diff changeset
1007 C2V_VMENTRY(jobject, executeCompiledMethodVarargs, (JNIEnv *env, jobject, jobject args, jobject hotspotInstalledCode))
5246
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1008 ResourceMark rm;
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1009 HandleMark hm;
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1010
10475
3489047ffea2 Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10434
diff changeset
1011 jlong nmethodValue = HotSpotInstalledCode::codeBlob(hotspotInstalledCode);
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
1012 nmethod* nm = (nmethod*) (address) nmethodValue;
9024
2b840ae76df1 Move nmethod parameter to the last position to keep passed on arguments in the correct registers.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9023
diff changeset
1013 methodHandle mh = nm->method();
5246
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1014 Symbol* signature = mh->signature();
7281
e960cda050d7 fixed bug in executing InstalledCode with more than 8 arguments
Doug Simon <doug.simon@oracle.com>
parents: 7232
diff changeset
1015 JavaCallArguments jca(mh->size_of_parameters());
5246
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1016
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5624
diff changeset
1017 JavaArgumentUnboxer jap(signature, &jca, (arrayOop) JNIHandles::resolve(args), mh->is_static());
5246
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1018 JavaValue result(jap.get_ret_type());
8151
b8f261ba79c6 Minimize diff to plain HotSpot version.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8127
diff changeset
1019 jca.set_alternative_target(nm);
b8f261ba79c6 Minimize diff to plain HotSpot version.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8127
diff changeset
1020 JavaCalls::call(&result, mh, &jca, CHECK_NULL);
5246
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1021
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1022 if (jap.get_ret_type() == T_VOID) {
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1023 return NULL;
5395
fc1943f18fef fixed bug in returning array values from CompilerToVMImpl.executeCompiledMethodVarargs
Doug Simon <doug.simon@oracle.com>
parents: 5318
diff changeset
1024 } else if (jap.get_ret_type() == T_OBJECT || jap.get_ret_type() == T_ARRAY) {
5246
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1025 return JNIHandles::make_local((oop) result.get_jobject());
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1026 } else {
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1027 oop o = java_lang_boxing_object::create(jap.get_ret_type(), (jvalue *) result.get_value_addr(), CHECK_NULL);
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1028 return JNIHandles::make_local(o);
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1029 }
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
1030 C2V_END
5246
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1031
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1032 C2V_VMENTRY(jint, getVtableEntryOffset, (JNIEnv *, jobject, jlong metaspace_method))
5003
5e6f1026a63e fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents: 5000
diff changeset
1033
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1034 Method* method = asMethod(metaspace_method);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1035 assert(!InstanceKlass::cast(method->method_holder())->is_interface(), "vtableEntryOffset cannot be called for interface methods");
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1036 assert(InstanceKlass::cast(method->method_holder())->is_linked(), "vtableEntryOffset cannot be called is holder is not linked");
9610
ae17e540c5d2 More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9599
diff changeset
1037 assert(method->vtable_index() >= 0, "vtable entry offset should not be used");
5003
5e6f1026a63e fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents: 5000
diff changeset
1038
5e6f1026a63e fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents: 5000
diff changeset
1039 // get entry offset in words
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1040 int vtable_entry_offset = InstanceKlass::vtable_start_offset() + method->vtable_index() * vtableEntry::size();
5003
5e6f1026a63e fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents: 5000
diff changeset
1041 // convert to bytes
5e6f1026a63e fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents: 5000
diff changeset
1042 vtable_entry_offset = vtable_entry_offset * wordSize + vtableEntry::method_offset_in_bytes();
5e6f1026a63e fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents: 5000
diff changeset
1043
5e6f1026a63e fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents: 5000
diff changeset
1044 return vtable_entry_offset;
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
1045 C2V_END
5003
5e6f1026a63e fixes to vtable stub inlining: compute offset on demand, look out for interface methods
Lukas Stadler <lukas.stadler@jku.at>
parents: 5000
diff changeset
1046
9610
ae17e540c5d2 More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9599
diff changeset
1047 C2V_VMENTRY(jboolean, hasVtableEntry, (JNIEnv *, jobject, jlong metaspace_method))
ae17e540c5d2 More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9599
diff changeset
1048 Method* method = asMethod(metaspace_method);
ae17e540c5d2 More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9599
diff changeset
1049 return method->vtable_index() >= 0;
ae17e540c5d2 More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9599
diff changeset
1050 C2V_END
ae17e540c5d2 More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9599
diff changeset
1051
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
1052 C2V_VMENTRY(jobject, getDeoptedLeafGraphIds, (JNIEnv *, jobject))
5129
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
1053
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
1054 // the contract for this method is as follows:
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
1055 // returning null: no deopted leaf graphs
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
1056 // returning array (size > 0): the ids of the deopted leaf graphs
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
1057 // returning array (size == 0): there was an overflow, the compiler needs to clear its cache completely
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
1058
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
1059 oop array = GraalCompiler::instance()->dump_deopted_leaf_graphs(CHECK_NULL);
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
1060 return JNIHandles::make_local(array);
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
1061 C2V_END
5129
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5062
diff changeset
1062
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1063 C2V_ENTRY(jlongArray, getLineNumberTable, (JNIEnv *env, jobject, jobject hotspot_method))
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1064 Method* method = getMethodFromHotSpotMethod(JNIHandles::resolve(hotspot_method));
8269
985a97ba083c Fix spacing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8215
diff changeset
1065 if (!method->has_linenumber_table()) {
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1066 return NULL;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1067 }
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1068 u2 num_entries = 0;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1069 CompressedLineNumberReadStream streamForSize(method->compressed_linenumber_table());
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1070 while (streamForSize.read_pair()) {
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1071 num_entries++;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1072 }
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1073
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1074 CompressedLineNumberReadStream stream(method->compressed_linenumber_table());
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1075 jlongArray result = env->NewLongArray(2 * num_entries);
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1076
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1077 int i = 0;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1078 jlong value;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1079 while (stream.read_pair()) {
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1080 value = ((long) stream.bci());
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1081 env->SetLongArrayRegion(result,i,1,&value);
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1082 value = ((long) stream.line());
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1083 env->SetLongArrayRegion(result,i + 1,1,&value);
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1084 i += 2;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1085 }
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1086
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1087 return result;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1088 C2V_END
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1089
7786
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1090 C2V_VMENTRY(jobject, getLocalVariableTable, (JNIEnv *, jobject, jobject hotspot_method))
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1091 ResourceMark rm;
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1092
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1093 Method* method = getMethodFromHotSpotMethod(JNIHandles::resolve(hotspot_method));
8269
985a97ba083c Fix spacing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8215
diff changeset
1094 if (!method->has_localvariable_table()) {
7786
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1095 return NULL;
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1096 }
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1097 int localvariable_table_length = method->localvariable_table_length();
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1098
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1099 objArrayHandle local_array = oopFactory::new_objArray(SystemDictionary::LocalImpl_klass(), localvariable_table_length, CHECK_NULL);
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1100 LocalVariableTableElement* table = method->localvariable_table_start();
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1101 for (int i = 0; i < localvariable_table_length; i++) {
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1102 u2 start_bci = table[i].start_bci;
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1103 u4 end_bci = (u4)(start_bci + table[i].length);
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1104 u2 nameCPIdx = table[i].name_cp_index;
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1105 u2 typeCPIdx = table[i].descriptor_cp_index;
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1106 u2 slot = table[i].slot;
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1107
9020
627dc359e918 Use correct method to access constant pool
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9011
diff changeset
1108 char* name = method->constants()->symbol_at(nameCPIdx)->as_C_string();
7786
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1109 Handle nameHandle = java_lang_String::create_from_str(name, CHECK_NULL);
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1110
9020
627dc359e918 Use correct method to access constant pool
Christian Wimmer <christian.wimmer@oracle.com>
parents: 9011
diff changeset
1111 char* typeInfo = method->constants()->symbol_at(typeCPIdx)->as_C_string();
7786
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1112 Handle typeHandle = java_lang_String::create_from_str(typeInfo, CHECK_NULL);
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1113
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1114 Handle holderHandle = GraalCompiler::createHotSpotResolvedObjectType(method, CHECK_0);
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1115 Handle local = VMToCompiler::createLocal(nameHandle, typeHandle, (int) start_bci, (int) end_bci, (int) slot, holderHandle, Thread::current());
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1116 local_array->obj_at_put(i, local());
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1117 }
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1118
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1119 return JNIHandles::make_local(local_array());
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1120 C2V_END
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1121
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1122
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1123 C2V_VMENTRY(jobject, getFileName, (JNIEnv *, jobject, jobject klass))
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1124 ResourceMark rm;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1125 InstanceKlass* k = (InstanceKlass*) asKlass(HotSpotResolvedObjectType::metaspaceKlass(klass));
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1126 Symbol *s = k->source_file_name();
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1127 int length;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1128 jchar *name = s->as_unicode(length);
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1129
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1130 Handle result = java_lang_String::create_from_unicode(name, length, CHECK_NULL);
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1131 return JNIHandles::make_local(result());
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1132
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1133 C2V_END
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
1134
8611
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1135
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1136 C2V_VMENTRY(void, reprofile, (JNIEnv *env, jobject, jlong metaspace_method))
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1137 Method* method = asMethod(metaspace_method);
10408
836a62f43af9 Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 10072
diff changeset
1138 MethodCounters* mcs = method->method_counters();
836a62f43af9 Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 10072
diff changeset
1139 if (mcs != NULL) {
836a62f43af9 Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 10072
diff changeset
1140 mcs->clear_counters();
836a62f43af9 Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 10072
diff changeset
1141 }
836a62f43af9 Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 10072
diff changeset
1142 NOT_PRODUCT(method->set_compiled_invocation_count(0));
8611
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1143
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1144 nmethod* code = method->code();
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1145 if (code != NULL) {
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1146 code->make_not_entrant();
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1147 }
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1148
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1149 MethodData* method_data = method->method_data();
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1150 if (method_data == NULL) {
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1151 ClassLoaderData* loader_data = method->method_holder()->class_loader_data();
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1152 method_data = MethodData::allocate(loader_data, method, CHECK);
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1153 method->set_method_data(method_data);
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1154 } else {
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1155 method_data->initialize();
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1156 }
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1157 C2V_END
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1158
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1159
10476
cd68d6902328 Fix invalidateInstalledCode and delete isInstalledCodeValid.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10475
diff changeset
1160 C2V_VMENTRY(void, invalidateInstalledCode, (JNIEnv *env, jobject, jobject hotspotInstalledCode))
cd68d6902328 Fix invalidateInstalledCode and delete isInstalledCodeValid.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10475
diff changeset
1161 jlong nativeMethod = HotSpotInstalledCode::codeBlob(hotspotInstalledCode);
9023
f94bb5d20e5d Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8996
diff changeset
1162 nmethod* m = (nmethod*)nativeMethod;
10477
7943479d36f3 Fix for invalidateInstalledCode.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10476
diff changeset
1163 if (m != NULL && !m->is_not_entrant()) {
9025
ff5a32117e02 Implement fast invocation of installed code (direct tail call to the target machine code address).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9024
diff changeset
1164 m->mark_for_deoptimization();
ff5a32117e02 Implement fast invocation of installed code (direct tail call to the target machine code address).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9024
diff changeset
1165 VM_Deoptimize op;
ff5a32117e02 Implement fast invocation of installed code (direct tail call to the target machine code address).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9024
diff changeset
1166 VMThread::execute(&op);
ff5a32117e02 Implement fast invocation of installed code (direct tail call to the target machine code address).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 9024
diff changeset
1167 }
9023
f94bb5d20e5d Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8996
diff changeset
1168 C2V_END
f94bb5d20e5d Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8996
diff changeset
1169
f94bb5d20e5d Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8996
diff changeset
1170
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
1171 #define CC (char*) /*cast a literal from (const char*)*/
6588
b89b5038ad7e removed _'s from method names in CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 6559
diff changeset
1172 #define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(c2v_ ## f))
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
1173
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1174 #define RESOLVED_TYPE "Lcom/oracle/graal/api/meta/ResolvedJavaType;"
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1175 #define TYPE "Lcom/oracle/graal/api/meta/JavaType;"
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1176 #define METHOD "Lcom/oracle/graal/api/meta/JavaMethod;"
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1177 #define FIELD "Lcom/oracle/graal/api/meta/JavaField;"
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1178 #define SIGNATURE "Lcom/oracle/graal/api/meta/Signature;"
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1179 #define CONSTANT_POOL "Lcom/oracle/graal/api/meta/ConstantPool;"
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1180 #define CONSTANT "Lcom/oracle/graal/api/meta/Constant;"
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1181 #define KIND "Lcom/oracle/graal/api/meta/Kind;"
7786
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1182 #define LOCAL "Lcom/oracle/graal/api/meta/Local;"
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1183 #define RUNTIME_CALL "Lcom/oracle/graal/api/code/RuntimeCall;"
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1184 #define EXCEPTION_HANDLERS "[Lcom/oracle/graal/api/meta/ExceptionHandler;"
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1185 #define REFLECT_METHOD "Ljava/lang/reflect/Method;"
7044
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
1186 #define REFLECT_CONSTRUCTOR "Ljava/lang/reflect/Constructor;"
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1187 #define REFLECT_FIELD "Ljava/lang/reflect/Field;"
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1188 #define STRING "Ljava/lang/String;"
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1189 #define OBJECT "Ljava/lang/Object;"
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1190 #define CLASS "Ljava/lang/Class;"
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1191 #define STACK_TRACE_ELEMENT "Ljava/lang/StackTraceElement;"
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7044
diff changeset
1192 #define HS_RESOLVED_TYPE "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedObjectType;"
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1193 #define HS_RESOLVED_JAVA_TYPE "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaType;"
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1194 #define HS_RESOLVED_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod;"
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1195 #define HS_RESOLVED_FIELD "Lcom/oracle/graal/hotspot/meta/HotSpotResolvedJavaField;"
9669
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9668
diff changeset
1196 #define HS_COMPILED_CODE "Lcom/oracle/graal/hotspot/HotSpotCompiledCode;"
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1197 #define HS_CONFIG "Lcom/oracle/graal/hotspot/HotSpotVMConfig;"
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1198 #define HS_METHOD "Lcom/oracle/graal/hotspot/meta/HotSpotMethod;"
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1199 #define HS_INSTALLED_CODE "Lcom/oracle/graal/hotspot/meta/HotSpotInstalledCode;"
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1200 #define METHOD_DATA "Lcom/oracle/graal/hotspot/meta/HotSpotMethodData;"
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1201 #define METASPACE_METHOD "J"
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
1202 #define METASPACE_METHOD_DATA "J"
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
1203
4220
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4199
diff changeset
1204 JNINativeMethod CompilerToVM_methods[] = {
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1205 {CC"initializeBytecode", CC"("METASPACE_METHOD"[B)[B", FN_PTR(initializeBytecode)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1206 {CC"getSignature", CC"("METASPACE_METHOD")"STRING, FN_PTR(getSignature)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1207 {CC"initializeExceptionHandlers", CC"("METASPACE_METHOD EXCEPTION_HANDLERS")"EXCEPTION_HANDLERS, FN_PTR(initializeExceptionHandlers)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1208 {CC"hasBalancedMonitors", CC"("METASPACE_METHOD")Z", FN_PTR(hasBalancedMonitors)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1209 {CC"getUniqueConcreteMethod", CC"("METASPACE_METHOD"["HS_RESOLVED_TYPE")"METASPACE_METHOD, FN_PTR(getUniqueConcreteMethod)},
7226
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
1210 {CC"getUniqueImplementor", CC"("HS_RESOLVED_TYPE")"RESOLVED_TYPE, FN_PTR(getUniqueImplementor)},
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1211 {CC"getStackTraceElement", CC"("METASPACE_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(getStackTraceElement)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1212 {CC"initializeMethod", CC"("METASPACE_METHOD HS_RESOLVED_METHOD")V", FN_PTR(initializeMethod)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1213 {CC"initializeMethodData", CC"("METASPACE_METHOD_DATA METHOD_DATA")V", FN_PTR(initializeMethodData)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1214 {CC"isMethodCompilable", CC"("METASPACE_METHOD")Z", FN_PTR(isMethodCompilable)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1215 {CC"getInvocationCount", CC"("METASPACE_METHOD")I", FN_PTR(getInvocationCount)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1216 {CC"getCompiledCodeSize", CC"("METASPACE_METHOD")I", FN_PTR(getCompiledCodeSize)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1217 {CC"getVtableEntryOffset", CC"("METASPACE_METHOD")I", FN_PTR(getVtableEntryOffset)},
9610
ae17e540c5d2 More asserts while getting vtable offsets
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 9599
diff changeset
1218 {CC"hasVtableEntry", CC"("METASPACE_METHOD")Z", FN_PTR(hasVtableEntry)},
9108
b78686983a75 GRAAL-218: add CompileTheWorld functionality
twisti
parents: 9027
diff changeset
1219 {CC"constantPoolLength", CC"("HS_RESOLVED_TYPE")I", FN_PTR(constantPoolLength)},
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1220 {CC"lookupType", CC"("STRING HS_RESOLVED_TYPE"Z)"TYPE, FN_PTR(lookupType)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1221 {CC"lookupConstantInPool", CC"("HS_RESOLVED_TYPE"I)"OBJECT, FN_PTR(lookupConstantInPool)},
9011
23762f2438b6 support for compiling LambdaForm invocations (invokevirtual instructions that were rewritten to invokehandle instructions)
Doug Simon <doug.simon@oracle.com>
parents: 8996
diff changeset
1222 {CC"lookupAppendixInPool", CC"("HS_RESOLVED_TYPE"IB)"OBJECT, FN_PTR(lookupAppendixInPool)},
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1223 {CC"lookupMethodInPool", CC"("HS_RESOLVED_TYPE"IB)"METHOD, FN_PTR(lookupMethodInPool)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1224 {CC"lookupTypeInPool", CC"("HS_RESOLVED_TYPE"I)"TYPE, FN_PTR(lookupTypeInPool)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1225 {CC"lookupReferencedTypeInPool", CC"("HS_RESOLVED_TYPE"IB)V", FN_PTR(lookupReferencedTypeInPool)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1226 {CC"lookupFieldInPool", CC"("HS_RESOLVED_TYPE"IB)"FIELD, FN_PTR(lookupFieldInPool)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1227 {CC"resolveMethod", CC"("HS_RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(resolveMethod)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1228 {CC"getInstanceFields", CC"("HS_RESOLVED_TYPE")["HS_RESOLVED_FIELD, FN_PTR(getInstanceFields)},
9985
e6bd1004082a added HotSpotResolvedObjectType.getMethods() to get all methods of a class including those (such as <clinit>) not normally exposed by Java reflection
Doug Simon <doug.simon@oracle.com>
parents: 9934
diff changeset
1229 {CC"getMethods", CC"("HS_RESOLVED_TYPE")["HS_RESOLVED_METHOD, FN_PTR(getMethods)},
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1230 {CC"isTypeInitialized", CC"("HS_RESOLVED_TYPE")Z", FN_PTR(isTypeInitialized)},
9126
bc26f978b0ce HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
Bernhard Urban <bernhard.urban@jku.at>
parents: 9108
diff changeset
1231 {CC"hasFinalizableSubclass", CC"("HS_RESOLVED_TYPE")Z", FN_PTR(hasFinalizableSubclass)},
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1232 {CC"initializeType", CC"("HS_RESOLVED_TYPE")V", FN_PTR(initializeType)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1233 {CC"getMaxCallTargetOffset", CC"(J)J", FN_PTR(getMaxCallTargetOffset)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1234 {CC"getResolvedType", CC"("CLASS")"RESOLVED_TYPE, FN_PTR(getResolvedType)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1235 {CC"getMetaspaceMethod", CC"("REFLECT_METHOD"["HS_RESOLVED_TYPE")"METASPACE_METHOD, FN_PTR(getMetaspaceMethod)},
7044
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
1236 {CC"getMetaspaceConstructor", CC"("REFLECT_CONSTRUCTOR"["HS_RESOLVED_TYPE")"METASPACE_METHOD, FN_PTR(getMetaspaceConstructor)},
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1237 {CC"getJavaField", CC"("REFLECT_FIELD")"HS_RESOLVED_FIELD, FN_PTR(getJavaField)},
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1238 {CC"initializeConfiguration", CC"("HS_CONFIG")V", FN_PTR(initializeConfiguration)},
9669
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9668
diff changeset
1239 {CC"installCode0", CC"("HS_COMPILED_CODE HS_INSTALLED_CODE"[Z)I", FN_PTR(installCode0)},
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8348
diff changeset
1240 {CC"getCode", CC"(J)[B", FN_PTR(getCode)},
9338
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9232
diff changeset
1241 {CC"disassembleCodeBlob", CC"(J)"STRING, FN_PTR(disassembleCodeBlob)},
10475
3489047ffea2 Restructure the handling of HotSpotInstalledCode and their link to nmethods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10434
diff changeset
1242 {CC"executeCompiledMethodVarargs", CC"(["OBJECT HS_INSTALLED_CODE")"OBJECT, FN_PTR(executeCompiledMethodVarargs)},
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1243 {CC"getDeoptedLeafGraphIds", CC"()[J", FN_PTR(getDeoptedLeafGraphIds)},
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1244 {CC"getLineNumberTable", CC"("HS_RESOLVED_METHOD")[J", FN_PTR(getLineNumberTable)},
7786
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1245 {CC"getLocalVariableTable", CC"("HS_RESOLVED_METHOD")["LOCAL, FN_PTR(getLocalVariableTable)},
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1246 {CC"getFileName", CC"("HS_RESOLVED_JAVA_TYPE")"STRING, FN_PTR(getFileName)},
8611
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1247 {CC"reprofile", CC"("METASPACE_METHOD")V", FN_PTR(reprofile)},
10476
cd68d6902328 Fix invalidateInstalledCode and delete isInstalledCodeValid.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10475
diff changeset
1248 {CC"invalidateInstalledCode", CC"("HS_INSTALLED_CODE")V", FN_PTR(invalidateInstalledCode)},
1412
9195b99c841b Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1410
diff changeset
1249 };
9195b99c841b Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1410
diff changeset
1250
4220
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4199
diff changeset
1251 int CompilerToVM_methods_count() {
5c80ccb80036 Renaming of VMExits and VMEntries part 1.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4199
diff changeset
1252 return sizeof(CompilerToVM_methods) / sizeof(JNINativeMethod);
1421
6223633ce7dd changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1419
diff changeset
1253 }
3703
50a1d38cd7ac Add newlines at the end of files, otherwise my version of gcc complains
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3701
diff changeset
1254