annotate src/share/vm/jvmci/jvmciCompilerToVM.cpp @ 24159:830c3424c0e5

check for and forward exceptions in getNextStackFrame and materializeVirtualObjects
author Lukas Stadler <lukas.stadler@oracle.com>
date Thu, 03 Aug 2017 12:01:05 +0200
parents 26a414946c56
children f98ea2d742a2
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 /*
23989
115d4e0d7b87 removed HotSpotResolvedJavaFieldImpl.name field
Doug Simon <doug.simon@oracle.com>
parents: 23986
diff changeset
2 * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
2516
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"
22650
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
25 #include "code/codeCache.hpp"
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
26 #include "code/scopeDesc.hpp"
22650
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
27 #include "interpreter/linkResolver.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
28 #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
29 #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
30 #include "oops/fieldStreams.hpp"
22650
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
31 #include "oops/oop.inline.hpp"
12356
359f7e70ae7f Reduce HotSpot diff and fix previous merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11852
diff changeset
32 #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
33 #include "runtime/javaCalls.hpp"
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
34 #include "jvmci/jvmciRuntime.hpp"
22650
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
35 #include "compiler/abstractCompiler.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
36 #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
37 #include "compiler/compilerOracle.hpp"
7735
a7a93887b4c4 fix Solaris build and initial SPARC support
twisti
parents: 7569
diff changeset
38 #include "compiler/disassembler.hpp"
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
39 #include "jvmci/jvmciCompilerToVM.hpp"
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
40 #include "jvmci/jvmciCompiler.hpp"
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
41 #include "jvmci/jvmciEnv.hpp"
22548
02fc27dc1da7 Rename jvmciJavaAccess.* to jvmciJavaClasses.*
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22547
diff changeset
42 #include "jvmci/jvmciJavaClasses.hpp"
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
43 #include "jvmci/jvmciCodeInstaller.hpp"
8490
1567c6cc6561 Towards porting G1 WBs
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 8489
diff changeset
44 #include "gc_implementation/g1/heapRegion.hpp"
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
45 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
12559
ae412befde21 read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents: 12535
diff changeset
46 #include "runtime/javaCalls.hpp"
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
47 #include "runtime/deoptimization.hpp"
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
48 #include "runtime/vframe.hpp"
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
49 #include "runtime/vframe_hp.hpp"
12559
ae412befde21 read HotSpotVMConfig fields from HotSpot's vmStructs via annotations
twisti
parents: 12535
diff changeset
50 #include "runtime/vmStructs.hpp"
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
51 #include "utilities/resourceHash.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
52
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
53
6376
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 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
55 #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
56 JNIEXPORT result_type JNICALL c2v_ ## name signature { \
22482
da68ca58b271 Adjust meaning of TraceJVMCI levels
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22455
diff changeset
57 TRACE_jvmci_1("CompilerToVM::" #name); \
22545
e96cf3780359 added use of TRACE_CALL macro to JVMCI runtime calls (GRAAL-1255)
Doug Simon <doug.simon@oracle.com>
parents: 22513
diff changeset
58 TRACE_CALL(result_type, jvmci_ ## name signature) \
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
59 JVMCI_VM_ENTRY_MARK; \
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
60
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
61 #define C2V_END }
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
62
22730
24fd08e99b35 Backport Handle fixes from jvmci-9.
Roland Schatz <roland.schatz@oracle.com>
parents: 22718
diff changeset
63 oop CompilerToVM::get_jvmci_method(const methodHandle& method, TRAPS) {
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
64 if (method() != NULL) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
65 JavaValue result(T_OBJECT);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
66 JavaCallArguments args;
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
67 args.push_long((jlong) (address) method());
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
68 JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, CHECK_NULL);
14106
ca37cb080dad reorganized graalCompilerToVM.cpp
twisti
parents: 14105
diff changeset
69
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
70 return (oop)result.get_jobject();
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
71 }
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
72 return NULL;
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
73 }
14106
ca37cb080dad reorganized graalCompilerToVM.cpp
twisti
parents: 14105
diff changeset
74
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
75 oop CompilerToVM::get_jvmci_type(KlassHandle klass, TRAPS) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
76 if (klass() != NULL) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
77 JavaValue result(T_OBJECT);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
78 JavaCallArguments args;
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
79 args.push_oop(klass->java_mirror());
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
80 JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedObjectTypeImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::klass_fromMetaspace_signature(), &args, CHECK_NULL);
14106
ca37cb080dad reorganized graalCompilerToVM.cpp
twisti
parents: 14105
diff changeset
81
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
82 return (oop)result.get_jobject();
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
83 }
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
84 return NULL;
14106
ca37cb080dad reorganized graalCompilerToVM.cpp
twisti
parents: 14105
diff changeset
85 }
ca37cb080dad reorganized graalCompilerToVM.cpp
twisti
parents: 14105
diff changeset
86
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
87 int CompilerToVM::Data::Klass_vtable_start_offset;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
88 int CompilerToVM::Data::Klass_vtable_length_offset;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
89
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
90 int CompilerToVM::Data::Method_extra_stack_entries;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
91
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
92 address CompilerToVM::Data::SharedRuntime_ic_miss_stub;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
93 address CompilerToVM::Data::SharedRuntime_handle_wrong_method_stub;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
94 address CompilerToVM::Data::SharedRuntime_deopt_blob_unpack;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
95 address CompilerToVM::Data::SharedRuntime_deopt_blob_uncommon_trap;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
96
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
97 size_t CompilerToVM::Data::ThreadLocalAllocBuffer_alignment_reserve;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
98
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
99 CollectedHeap* CompilerToVM::Data::Universe_collectedHeap;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
100 int CompilerToVM::Data::Universe_base_vtable_size;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
101 address CompilerToVM::Data::Universe_narrow_oop_base;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
102 int CompilerToVM::Data::Universe_narrow_oop_shift;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
103 address CompilerToVM::Data::Universe_narrow_klass_base;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
104 int CompilerToVM::Data::Universe_narrow_klass_shift;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
105 void* CompilerToVM::Data::Universe_non_oop_bits;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
106 uintptr_t CompilerToVM::Data::Universe_verify_oop_mask;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
107 uintptr_t CompilerToVM::Data::Universe_verify_oop_bits;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
108
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
109 bool CompilerToVM::Data::_supports_inline_contig_alloc;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
110 HeapWord** CompilerToVM::Data::_heap_end_addr;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
111 HeapWord** CompilerToVM::Data::_heap_top_addr;
23709
1b939a613788 Rename JVMCIRuntime::max_oop_map_stack_offset to CompilerToVM::Data::_max_oop_map_stack_offset
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23679
diff changeset
112 int CompilerToVM::Data::_max_oop_map_stack_offset;
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
113
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
114 jbyte* CompilerToVM::Data::cardtable_start_address;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
115 int CompilerToVM::Data::cardtable_shift;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
116 int CompilerToVM::Data::g1_young_card;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
117 int CompilerToVM::Data::dirty_card;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
118
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
119 int CompilerToVM::Data::vm_page_size;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
120
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
121 int CompilerToVM::Data::sizeof_vtableEntry = sizeof(vtableEntry);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
122 int CompilerToVM::Data::sizeof_ExceptionTableElement = sizeof(ExceptionTableElement);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
123 int CompilerToVM::Data::sizeof_LocalVariableTableElement = sizeof(LocalVariableTableElement);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
124 int CompilerToVM::Data::sizeof_ConstantPool = sizeof(ConstantPool);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
125 int CompilerToVM::Data::sizeof_SymbolPointer = sizeof(Symbol*);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
126 int CompilerToVM::Data::sizeof_narrowKlass = sizeof(narrowKlass);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
127 int CompilerToVM::Data::sizeof_arrayOopDesc = sizeof(arrayOopDesc);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
128 int CompilerToVM::Data::sizeof_BasicLock = sizeof(BasicLock);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
129
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
130 address CompilerToVM::Data::CodeCache_low_bound;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
131 address CompilerToVM::Data::CodeCache_high_bound;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
132
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
133 address CompilerToVM::Data::dsin;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
134 address CompilerToVM::Data::dcos;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
135 address CompilerToVM::Data::dtan;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
136 address CompilerToVM::Data::dexp;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
137 address CompilerToVM::Data::dlog;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
138 address CompilerToVM::Data::dlog10;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
139 address CompilerToVM::Data::dpow;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
140
23997
9a740aa0d87b use raw method name symbol for isConstructor and isClassInitializer
Doug Simon <doug.simon@oracle.com>
parents: 23996
diff changeset
141 address CompilerToVM::Data::symbol_init;
9a740aa0d87b use raw method name symbol for isConstructor and isClassInitializer
Doug Simon <doug.simon@oracle.com>
parents: 23996
diff changeset
142 address CompilerToVM::Data::symbol_clinit;
9a740aa0d87b use raw method name symbol for isConstructor and isClassInitializer
Doug Simon <doug.simon@oracle.com>
parents: 23996
diff changeset
143
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
144 void CompilerToVM::Data::initialize(TRAPS) {
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
145 Klass_vtable_start_offset = InstanceKlass::vtable_start_offset() * HeapWordSize;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
146 Klass_vtable_length_offset = InstanceKlass::vtable_length_offset() * HeapWordSize;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
147 Method_extra_stack_entries = Method::extra_stack_entries();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
148
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
149 SharedRuntime_ic_miss_stub = SharedRuntime::get_ic_miss_stub();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
150 SharedRuntime_handle_wrong_method_stub = SharedRuntime::get_handle_wrong_method_stub();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
151 SharedRuntime_deopt_blob_unpack = SharedRuntime::deopt_blob()->unpack();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
152 SharedRuntime_deopt_blob_uncommon_trap = SharedRuntime::deopt_blob()->uncommon_trap();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
153
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
154 ThreadLocalAllocBuffer_alignment_reserve = ThreadLocalAllocBuffer::alignment_reserve();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
155
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
156 Universe_collectedHeap = Universe::heap();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
157 Universe_base_vtable_size = Universe::base_vtable_size();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
158 Universe_narrow_oop_base = Universe::narrow_oop_base();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
159 Universe_narrow_oop_shift = Universe::narrow_oop_shift();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
160 Universe_narrow_klass_base = Universe::narrow_klass_base();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
161 Universe_narrow_klass_shift = Universe::narrow_klass_shift();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
162 Universe_non_oop_bits = Universe::non_oop_word();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
163 Universe_verify_oop_mask = Universe::verify_oop_mask();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
164 Universe_verify_oop_bits = Universe::verify_oop_bits();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
165
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
166 _supports_inline_contig_alloc = Universe::heap()->supports_inline_contig_alloc();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
167 _heap_end_addr = _supports_inline_contig_alloc ? Universe::heap()->end_addr() : (HeapWord**) -1;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
168 _heap_top_addr = _supports_inline_contig_alloc ? Universe::heap()->top_addr() : (HeapWord**) -1;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
169
23709
1b939a613788 Rename JVMCIRuntime::max_oop_map_stack_offset to CompilerToVM::Data::_max_oop_map_stack_offset
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23679
diff changeset
170 _max_oop_map_stack_offset = (OopMapValue::register_mask - VMRegImpl::stack2reg(0)->value()) * VMRegImpl::stack_slot_size;
1b939a613788 Rename JVMCIRuntime::max_oop_map_stack_offset to CompilerToVM::Data::_max_oop_map_stack_offset
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23679
diff changeset
171 int max_oop_map_stack_index = _max_oop_map_stack_offset / VMRegImpl::stack_slot_size;
1b939a613788 Rename JVMCIRuntime::max_oop_map_stack_offset to CompilerToVM::Data::_max_oop_map_stack_offset
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23679
diff changeset
172 assert(OopMapValue::legal_vm_reg_name(VMRegImpl::stack2reg(max_oop_map_stack_index)), "should be valid");
1b939a613788 Rename JVMCIRuntime::max_oop_map_stack_offset to CompilerToVM::Data::_max_oop_map_stack_offset
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23679
diff changeset
173 assert(!OopMapValue::legal_vm_reg_name(VMRegImpl::stack2reg(max_oop_map_stack_index + 1)), "should be invalid");
1b939a613788 Rename JVMCIRuntime::max_oop_map_stack_offset to CompilerToVM::Data::_max_oop_map_stack_offset
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23679
diff changeset
174
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
175 g1_young_card = G1SATBCardTableModRefBS::g1_young_card_val();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
176 dirty_card = CardTableModRefBS::dirty_card_val();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
177
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
178 CodeCache_low_bound = CodeCache::low_bound();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
179 CodeCache_high_bound = CodeCache::high_bound();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
180
23997
9a740aa0d87b use raw method name symbol for isConstructor and isClassInitializer
Doug Simon <doug.simon@oracle.com>
parents: 23996
diff changeset
181 symbol_init = (address) vmSymbols::object_initializer_name();
9a740aa0d87b use raw method name symbol for isConstructor and isClassInitializer
Doug Simon <doug.simon@oracle.com>
parents: 23996
diff changeset
182 symbol_clinit = (address) vmSymbols::class_initializer_name();
9a740aa0d87b use raw method name symbol for isConstructor and isClassInitializer
Doug Simon <doug.simon@oracle.com>
parents: 23996
diff changeset
183
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
184 BarrierSet* bs = Universe::heap()->barrier_set();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
185 switch (bs->kind()) {
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
186 case BarrierSet::CardTableModRef:
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
187 case BarrierSet::CardTableExtension:
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
188 case BarrierSet::G1SATBCT:
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
189 case BarrierSet::G1SATBCTLogging: {
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
190 jbyte* base = ((CardTableModRefBS*) bs)->byte_map_base;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
191 assert(base != 0, "unexpected byte_map_base");
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
192 cardtable_start_address = base;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
193 cardtable_shift = CardTableModRefBS::card_shift;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
194 break;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
195 }
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
196 case BarrierSet::ModRef:
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
197 cardtable_start_address = 0;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
198 cardtable_shift = 0;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
199 // No post barriers
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
200 break;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
201 default:
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
202 JVMCI_ERROR("Unsupported BarrierSet kind %d", bs->kind());
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
203 break;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
204 }
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
205
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
206 vm_page_size = os::vm_page_size();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
207
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
208 #define SET_TRIGFUNC(name) \
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
209 name = CAST_FROM_FN_PTR(address, SharedRuntime::name); \
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
210
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
211 SET_TRIGFUNC(dsin);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
212 SET_TRIGFUNC(dcos);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
213 SET_TRIGFUNC(dtan);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
214 SET_TRIGFUNC(dexp);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
215 SET_TRIGFUNC(dlog10);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
216 SET_TRIGFUNC(dlog);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
217 SET_TRIGFUNC(dpow);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
218
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
219 #undef SET_TRIGFUNC
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
220 }
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
221
23743
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
222 objArrayHandle CompilerToVM::initialize_intrinsics(TRAPS) {
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
223 objArrayHandle vmIntrinsics = oopFactory::new_objArray(VMIntrinsicMethod::klass(), (vmIntrinsics::ID_LIMIT - 1), CHECK_(objArrayHandle()));
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
224 int index = 0;
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
225 // The intrinsics for a class are usually adjacent to each other.
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
226 // When they are, the string for the class name can be reused.
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
227 vmSymbols::SID kls_sid = vmSymbols::NO_SID;
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
228 Handle kls_str;
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
229 #define SID_ENUM(n) vmSymbols::VM_SYMBOL_ENUM_NAME(n)
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
230 #define VM_SYMBOL_TO_STRING(s) \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
231 java_lang_String::create_from_symbol(vmSymbols::symbol_at(SID_ENUM(s)), CHECK_(objArrayHandle()))
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
232 #define VM_INTRINSIC_INFO(id, kls, name, sig, ignore_fcode) { \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
233 instanceHandle vmIntrinsicMethod = InstanceKlass::cast(VMIntrinsicMethod::klass())->allocate_instance_handle(CHECK_(objArrayHandle())); \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
234 if (kls_sid != SID_ENUM(kls)) { \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
235 kls_str = VM_SYMBOL_TO_STRING(kls); \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
236 kls_sid = SID_ENUM(kls); \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
237 } \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
238 Handle name_str = VM_SYMBOL_TO_STRING(name); \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
239 Handle sig_str = VM_SYMBOL_TO_STRING(sig); \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
240 VMIntrinsicMethod::set_declaringClass(vmIntrinsicMethod, kls_str()); \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
241 VMIntrinsicMethod::set_name(vmIntrinsicMethod, name_str()); \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
242 VMIntrinsicMethod::set_descriptor(vmIntrinsicMethod, sig_str()); \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
243 VMIntrinsicMethod::set_id(vmIntrinsicMethod, vmIntrinsics::id); \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
244 vmIntrinsics->obj_at_put(index++, vmIntrinsicMethod()); \
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
245 }
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
246
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
247 VM_INTRINSICS_DO(VM_INTRINSIC_INFO, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_SYMBOL_IGNORE, VM_ALIAS_IGNORE)
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
248 #undef SID_ENUM
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
249 #undef VM_SYMBOL_TO_STRING
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
250 #undef VM_INTRINSIC_INFO
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
251 assert(index == vmIntrinsics::ID_LIMIT - 1, "must be");
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
252
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
253 return vmIntrinsics;
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
254 }
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
255
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
256 /**
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
257 * The set of VM flags known to be used.
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
258 */
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
259 #define PREDEFINED_CONFIG_FLAGS(do_bool_flag, do_intx_flag, do_uintx_flag) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
260 do_intx_flag(AllocateInstancePrefetchLines) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
261 do_intx_flag(AllocatePrefetchDistance) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
262 do_intx_flag(AllocatePrefetchInstr) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
263 do_intx_flag(AllocatePrefetchLines) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
264 do_intx_flag(AllocatePrefetchStepSize) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
265 do_intx_flag(AllocatePrefetchStyle) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
266 do_intx_flag(BciProfileWidth) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
267 do_bool_flag(BootstrapJVMCI) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
268 do_bool_flag(CITime) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
269 do_bool_flag(CITimeEach) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
270 do_uintx_flag(CodeCacheSegmentSize) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
271 do_intx_flag(CodeEntryAlignment) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
272 do_bool_flag(CompactFields) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
273 NOT_PRODUCT(do_intx_flag(CompileTheWorldStartAt)) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
274 NOT_PRODUCT(do_intx_flag(CompileTheWorldStopAt)) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
275 do_intx_flag(ContendedPaddingWidth) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
276 do_bool_flag(DontCompileHugeMethods) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
277 do_bool_flag(EnableContended) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
278 do_intx_flag(FieldsAllocationStyle) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
279 do_bool_flag(FoldStableValues) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
280 do_bool_flag(ForceUnreachable) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
281 do_intx_flag(HugeMethodLimit) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
282 do_bool_flag(Inline) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
283 do_intx_flag(JVMCICounterSize) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
284 do_bool_flag(JVMCIPrintProperties) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
285 do_bool_flag(JVMCIUseFastLocking) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
286 do_intx_flag(MethodProfileWidth) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
287 do_intx_flag(ObjectAlignmentInBytes) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
288 do_bool_flag(PrintInlining) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
289 do_bool_flag(ReduceInitialCardMarks) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
290 do_bool_flag(RestrictContended) \
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
291 /* do_intx_flag(StackReservedPages) JDK 9 */ \
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
292 do_intx_flag(StackShadowPages) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
293 do_bool_flag(TLABStats) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
294 do_uintx_flag(TLABWasteIncrement) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
295 do_intx_flag(TypeProfileWidth) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
296 do_bool_flag(UseAESIntrinsics) \
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
297 X86_ONLY(do_intx_flag(UseAVX)) \
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
298 do_bool_flag(UseBiasedLocking) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
299 do_bool_flag(UseCRC32Intrinsics) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
300 do_bool_flag(UseCompressedClassPointers) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
301 do_bool_flag(UseCompressedOops) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
302 do_bool_flag(UseConcMarkSweepGC) \
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
303 X86_ONLY(do_bool_flag(UseCountLeadingZerosInstruction)) \
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
304 X86_ONLY(do_bool_flag(UseCountTrailingZerosInstruction)) \
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
305 do_bool_flag(UseG1GC) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
306 COMPILER2_PRESENT(do_bool_flag(UseMontgomeryMultiplyIntrinsic)) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
307 COMPILER2_PRESENT(do_bool_flag(UseMontgomerySquareIntrinsic)) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
308 COMPILER2_PRESENT(do_bool_flag(UseMulAddIntrinsic)) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
309 COMPILER2_PRESENT(do_bool_flag(UseMultiplyToLenIntrinsic)) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
310 do_bool_flag(UsePopCountInstruction) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
311 do_bool_flag(UseSHA1Intrinsics) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
312 do_bool_flag(UseSHA256Intrinsics) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
313 do_bool_flag(UseSHA512Intrinsics) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
314 do_intx_flag(UseSSE) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
315 COMPILER2_PRESENT(do_bool_flag(UseSquareToLenIntrinsic)) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
316 do_bool_flag(UseStackBanging) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
317 do_bool_flag(UseTLAB) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
318 do_bool_flag(VerifyOops) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
319
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
320 #define BOXED_BOOLEAN(name, value) oop name = ((jboolean)(value) ? boxedTrue() : boxedFalse())
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
321 #define BOXED_DOUBLE(name, value) oop name; do { jvalue p; p.d = (jdouble) (value); name = java_lang_boxing_object::create(T_DOUBLE, &p, CHECK_NULL);} while(0)
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
322 #define BOXED_LONG(name, value) \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
323 oop name; \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
324 do { \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
325 jvalue p; p.j = (jlong) (value); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
326 Handle* e = longs.get(p.j); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
327 if (e == NULL) { \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
328 Handle h = java_lang_boxing_object::create(T_LONG, &p, CHECK_NULL); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
329 longs.put(p.j, h); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
330 name = h(); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
331 } else { \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
332 name = (*e)(); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
333 } \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
334 } while (0)
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
335
23998
f161917eed57 sync with JDK9 changes
Doug Simon <doug.simon@oracle.com>
parents: 23997
diff changeset
336 #define CSTRING_TO_JSTRING(name, value) \
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
337 Handle name; \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
338 do { \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
339 if (value != NULL) { \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
340 Handle* e = strings.get(value); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
341 if (e == NULL) { \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
342 Handle h = java_lang_String::create_from_str(value, CHECK_NULL); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
343 strings.put(value, h); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
344 name = h(); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
345 } else { \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
346 name = (*e)(); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
347 } \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
348 } \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
349 } while (0)
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
350
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
351 C2V_VMENTRY(jobjectArray, readConfiguration, (JNIEnv *env))
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
352 ResourceMark rm;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
353 HandleMark hm;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
354
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
355 // Used to canonicalize Long and String values.
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
356 ResourceHashtable<jlong, Handle> longs;
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
357 ResourceHashtable<const char*, Handle, &CompilerToVM::cstring_hash, &CompilerToVM::cstring_equals> strings;
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
358
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
359 jvalue prim;
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
360 prim.z = true; Handle boxedTrue = java_lang_boxing_object::create(T_BOOLEAN, &prim, CHECK_NULL);
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
361 prim.z = false; Handle boxedFalse = java_lang_boxing_object::create(T_BOOLEAN, &prim, CHECK_NULL);
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
362
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
363 CompilerToVM::Data::initialize(CHECK_NULL);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
364
23740
724fbad94ee3 expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23734
diff changeset
365 VMField::klass()->initialize(CHECK_NULL);
724fbad94ee3 expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23734
diff changeset
366 VMFlag::klass()->initialize(CHECK_NULL);
724fbad94ee3 expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23734
diff changeset
367 VMIntrinsicMethod::klass()->initialize(CHECK_NULL);
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
368
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
369 int len = VMStructs::localHotSpotVMStructs_count();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
370 objArrayHandle vmFields = oopFactory::new_objArray(VMField::klass(), len, CHECK_NULL);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
371 for (int i = 0; i < len ; i++) {
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
372 VMStructEntry vmField = VMStructs::localHotSpotVMStructs[i];
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
373 instanceHandle vmFieldObj = InstanceKlass::cast(VMField::klass())->allocate_instance_handle(CHECK_NULL);
23740
724fbad94ee3 expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23734
diff changeset
374 size_t name_buf_len = strlen(vmField.typeName) + strlen(vmField.fieldName) + 2 /* "::" */;
724fbad94ee3 expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23734
diff changeset
375 char* name_buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, name_buf_len + 1);
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
376 sprintf(name_buf, "%s::%s", vmField.typeName, vmField.fieldName);
23998
f161917eed57 sync with JDK9 changes
Doug Simon <doug.simon@oracle.com>
parents: 23997
diff changeset
377 CSTRING_TO_JSTRING(name, name_buf);
f161917eed57 sync with JDK9 changes
Doug Simon <doug.simon@oracle.com>
parents: 23997
diff changeset
378 CSTRING_TO_JSTRING(type, vmField.typeString);
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
379 VMField::set_name(vmFieldObj, name());
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
380 VMField::set_type(vmFieldObj, type());
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
381 VMField::set_offset(vmFieldObj, vmField.offset);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
382 VMField::set_address(vmFieldObj, (jlong) vmField.address);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
383 if (vmField.isStatic && vmField.typeString != NULL) {
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
384 if (strcmp(vmField.typeString, "bool") == 0) {
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
385 BOXED_BOOLEAN(box, *(jbyte*) vmField.address);
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
386 VMField::set_value(vmFieldObj, box);
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
387 } else if (strcmp(vmField.typeString, "int") == 0 ||
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
388 strcmp(vmField.typeString, "jint") == 0) {
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
389 BOXED_LONG(box, *(jint*) vmField.address);
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
390 VMField::set_value(vmFieldObj, box);
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
391 } else if (strcmp(vmField.typeString, "uint64_t") == 0) {
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
392 BOXED_LONG(box, *(uint64_t*) vmField.address);
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
393 VMField::set_value(vmFieldObj, box);
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
394 } else if (strcmp(vmField.typeString, "address") == 0 ||
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
395 strcmp(vmField.typeString, "intptr_t") == 0 ||
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
396 strcmp(vmField.typeString, "uintptr_t") == 0 ||
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
397 strcmp(vmField.typeString, "size_t") == 0 ||
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
398 // All foo* types are addresses.
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
399 vmField.typeString[strlen(vmField.typeString) - 1] == '*') {
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
400 BOXED_LONG(box, *((address*) vmField.address));
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
401 VMField::set_value(vmFieldObj, box);
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
402 }
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
403 }
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
404 vmFields->obj_at_put(i, vmFieldObj());
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
405 }
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
406
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
407 int ints_len = VMStructs::localHotSpotVMIntConstants_count();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
408 int longs_len = VMStructs::localHotSpotVMLongConstants_count();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
409 len = ints_len + longs_len;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
410 objArrayHandle vmConstants = oopFactory::new_objArray(SystemDictionary::Object_klass(), len * 2, CHECK_NULL);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
411 int insert = 0;
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
412 for (int i = 0; i < ints_len ; i++) {
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
413 VMIntConstantEntry c = VMStructs::localHotSpotVMIntConstants[i];
23998
f161917eed57 sync with JDK9 changes
Doug Simon <doug.simon@oracle.com>
parents: 23997
diff changeset
414 CSTRING_TO_JSTRING(name, c.name);
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
415 BOXED_LONG(value, c.value);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
416 vmConstants->obj_at_put(insert++, name());
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
417 vmConstants->obj_at_put(insert++, value);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
418 }
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
419 for (int i = 0; i < longs_len ; i++) {
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
420 VMLongConstantEntry c = VMStructs::localHotSpotVMLongConstants[i];
23998
f161917eed57 sync with JDK9 changes
Doug Simon <doug.simon@oracle.com>
parents: 23997
diff changeset
421 CSTRING_TO_JSTRING(name, c.name);
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
422 BOXED_LONG(value, c.value);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
423 vmConstants->obj_at_put(insert++, name());
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
424 vmConstants->obj_at_put(insert++, value);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
425 }
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
426 assert(insert == len * 2, "must be");
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
427
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
428 len = VMStructs::localHotSpotVMAddresses_count();
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
429 objArrayHandle vmAddresses = oopFactory::new_objArray(SystemDictionary::Object_klass(), len * 2, CHECK_NULL);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
430 for (int i = 0; i < len ; i++) {
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
431 VMAddressEntry a = VMStructs::localHotSpotVMAddresses[i];
23998
f161917eed57 sync with JDK9 changes
Doug Simon <doug.simon@oracle.com>
parents: 23997
diff changeset
432 CSTRING_TO_JSTRING(name, a.name);
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
433 BOXED_LONG(value, a.value);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
434 vmAddresses->obj_at_put(i * 2, name());
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
435 vmAddresses->obj_at_put(i * 2 + 1, value);
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
436 }
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
437
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
438 #define COUNT_FLAG(ignore) +1
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
439 #ifdef ASSERT
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
440 #define CHECK_FLAG(type, name) { \
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
441 Flag* flag = Flag::find_flag(#name, strlen(#name), /*allow_locked*/ true, /* return_flag */ true); \
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
442 assert(flag != NULL, "No such flag named " #name); \
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
443 assert(flag->is_##type(), "Flag " #name " is not of type " #type); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
444 }
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
445 #else
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
446 #define CHECK_FLAG(type, name)
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
447 #endif
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
448
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
449 #define ADD_FLAG(type, name, convert) { \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
450 CHECK_FLAG(type, name) \
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
451 instanceHandle vmFlagObj = InstanceKlass::cast(VMFlag::klass())->allocate_instance_handle(CHECK_NULL); \
23998
f161917eed57 sync with JDK9 changes
Doug Simon <doug.simon@oracle.com>
parents: 23997
diff changeset
452 CSTRING_TO_JSTRING(fname, #name); \
f161917eed57 sync with JDK9 changes
Doug Simon <doug.simon@oracle.com>
parents: 23997
diff changeset
453 CSTRING_TO_JSTRING(ftype, #type); \
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
454 VMFlag::set_name(vmFlagObj, fname()); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
455 VMFlag::set_type(vmFlagObj, ftype()); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
456 convert(value, name); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
457 VMFlag::set_value(vmFlagObj, value); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
458 vmFlags->obj_at_put(i++, vmFlagObj()); \
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
459 }
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
460 #define ADD_BOOL_FLAG(name) ADD_FLAG(bool, name, BOXED_BOOLEAN)
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
461 #define ADD_INTX_FLAG(name) ADD_FLAG(intx, name, BOXED_LONG)
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
462 #define ADD_UINTX_FLAG(name) ADD_FLAG(uintx, name, BOXED_LONG)
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
463
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
464 len = 0 + PREDEFINED_CONFIG_FLAGS(COUNT_FLAG, COUNT_FLAG, COUNT_FLAG);
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
465 objArrayHandle vmFlags = oopFactory::new_objArray(VMFlag::klass(), len, CHECK_NULL);
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
466 int i = 0;
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
467 PREDEFINED_CONFIG_FLAGS(ADD_BOOL_FLAG, ADD_INTX_FLAG, ADD_UINTX_FLAG)
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
468
23743
a67f4d28935f expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers - part 2 (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23741
diff changeset
469 objArrayHandle vmIntrinsics = CompilerToVM::initialize_intrinsics(CHECK_NULL);
23740
724fbad94ee3 expose Hotspot intrinsics and HotSpotIntrinsicCandidate info to JVMCI compilers (JDK-8164358)
Doug Simon <doug.simon@oracle.com>
parents: 23734
diff changeset
470
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
471 objArrayOop data = oopFactory::new_objArray(SystemDictionary::Object_klass(), 5, CHECK_NULL);
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
472 data->obj_at_put(0, vmFields());
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
473 data->obj_at_put(1, vmConstants());
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
474 data->obj_at_put(2, vmAddresses());
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
475 data->obj_at_put(3, vmFlags());
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
476 data->obj_at_put(4, vmIntrinsics());
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
477
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
478 return (jobjectArray) JNIHandles::make_local(THREAD, data);
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
479 #undef COUNT_FLAG
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
480 #undef ADD_FLAG
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
481 #undef ADD_BOOL_FLAG
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
482 #undef ADD_INTX_FLAG
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
483 #undef ADD_UINTX_FLAG
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
484 #undef CHECK_FLAG
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
485 C2V_END
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
486
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
487 C2V_VMENTRY(jobject, getFlagValue, (JNIEnv *, jobject c2vm, jobject name_handle))
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
488 #define RETURN_BOXED_LONG(value) oop box; jvalue p; p.j = (jlong) (value); box = java_lang_boxing_object::create(T_LONG, &p, CHECK_NULL); return JNIHandles::make_local(THREAD, box);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
489 #define RETURN_BOXED_DOUBLE(value) oop box; jvalue p; p.d = (jdouble) (value); box = java_lang_boxing_object::create(T_DOUBLE, &p, CHECK_NULL); return JNIHandles::make_local(THREAD, box);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
490 Handle name = JNIHandles::resolve(name_handle);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
491 if (name.is_null()) {
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
492 THROW_0(vmSymbols::java_lang_NullPointerException());
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
493 }
23998
f161917eed57 sync with JDK9 changes
Doug Simon <doug.simon@oracle.com>
parents: 23997
diff changeset
494 ResourceMark rm;
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
495 const char* cstring = java_lang_String::as_utf8_string(name());
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
496 Flag* flag = Flag::find_flag(cstring, strlen(cstring), /* allow_locked */ true, /* return_flag */ true);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
497 if (flag == NULL) {
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
498 return c2vm;
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
499 }
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
500 if (flag->is_bool()) {
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
501 jvalue prim;
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
502 prim.z = flag->get_bool();
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
503 oop box = java_lang_boxing_object::create(T_BOOLEAN, &prim, CHECK_NULL);
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
504 return JNIHandles::make_local(THREAD, box);
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
505 } else if (flag->is_ccstr()) {
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
506 Handle value = java_lang_String::create_from_str(flag->get_ccstr(), CHECK_NULL);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
507 return JNIHandles::make_local(THREAD, value());
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
508 } else if (flag->is_intx()) {
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
509 RETURN_BOXED_LONG(flag->get_intx());
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
510 /*} else if (flag->is_int()) {
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
511 RETURN_BOXED_LONG(flag->get_int());
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
512 } else if (flag->is_uint()) {
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
513 RETURN_BOXED_LONG(flag->get_uint());*/
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
514 } else if (flag->is_uint64_t()) {
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
515 RETURN_BOXED_LONG(flag->get_uint64_t());
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
516 /*} else if (flag->is_size_t()) {
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
517 RETURN_BOXED_LONG(flag->get_size_t());*/
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
518 } else if (flag->is_uintx()) {
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
519 RETURN_BOXED_LONG(flag->get_uintx());
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
520 } else if (flag->is_double()) {
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
521 RETURN_BOXED_DOUBLE(flag->get_double());
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
522 } else {
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
523 JVMCI_ERROR_NULL("VM flag %s has unsupported type %s", flag->_name, flag->_type);
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
524 }
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
525 C2V_END
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
526
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
527 #undef BOXED_LONG
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
528 #undef BOXED_DOUBLE
23998
f161917eed57 sync with JDK9 changes
Doug Simon <doug.simon@oracle.com>
parents: 23997
diff changeset
529 #undef CSTRING_TO_JSTRING
14106
ca37cb080dad reorganized graalCompilerToVM.cpp
twisti
parents: 14105
diff changeset
530
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
531 C2V_VMENTRY(jbyteArray, getBytecode, (JNIEnv *, jobject, jobject jvmci_method))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
532 methodHandle method = CompilerToVM::asMethod(jvmci_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
533 ResourceMark rm;
8945
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
534
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
535 int code_size = method->code_size();
15843
747bc4099ad8 rename initializeBytecode to getBytecode and eliminate extra copy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15806
diff changeset
536 typeArrayOop reconstituted_code = oopFactory::new_byteArray(code_size, CHECK_NULL);
11513
8d4e5e08d83f Fix graalCompilerToVM::initializeBytecode regarding bytecode rewritting for methods that are not rewritten.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11381
diff changeset
537
11519
a3b39ab7c453 Make is_rewritten a guarantee in initializeBytecode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11513
diff changeset
538 guarantee(method->method_holder()->is_rewritten(), "Method's holder should be rewritten");
11513
8d4e5e08d83f Fix graalCompilerToVM::initializeBytecode regarding bytecode rewritting for methods that are not rewritten.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11381
diff changeset
539 // 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
540
11513
8d4e5e08d83f Fix graalCompilerToVM::initializeBytecode regarding bytecode rewritting for methods that are not rewritten.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11381
diff changeset
541 for (BytecodeStream s(method); s.next() != Bytecodes::_illegal; ) {
8d4e5e08d83f Fix graalCompilerToVM::initializeBytecode regarding bytecode rewritting for methods that are not rewritten.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11381
diff changeset
542 Bytecodes::Code code = s.code();
8d4e5e08d83f Fix graalCompilerToVM::initializeBytecode regarding bytecode rewritting for methods that are not rewritten.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11381
diff changeset
543 Bytecodes::Code raw_code = s.raw_code();
8d4e5e08d83f Fix graalCompilerToVM::initializeBytecode regarding bytecode rewritting for methods that are not rewritten.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11381
diff changeset
544 int bci = s.bci();
8d4e5e08d83f Fix graalCompilerToVM::initializeBytecode regarding bytecode rewritting for methods that are not rewritten.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11381
diff changeset
545 int len = s.instruction_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
546
11513
8d4e5e08d83f Fix graalCompilerToVM::initializeBytecode regarding bytecode rewritting for methods that are not rewritten.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11381
diff changeset
547 // Restore original byte code.
15843
747bc4099ad8 rename initializeBytecode to getBytecode and eliminate extra copy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15806
diff changeset
548 reconstituted_code->byte_at_put(bci, (jbyte) (s.is_wide()? Bytecodes::_wide : code));
11513
8d4e5e08d83f Fix graalCompilerToVM::initializeBytecode regarding bytecode rewritting for methods that are not rewritten.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11381
diff changeset
549 if (len > 1) {
15843
747bc4099ad8 rename initializeBytecode to getBytecode and eliminate extra copy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15806
diff changeset
550 memcpy(reconstituted_code->byte_at_addr(bci + 1), s.bcp()+1, len-1);
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
551 }
10567
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
552
11519
a3b39ab7c453 Make is_rewritten a guarantee in initializeBytecode
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 11513
diff changeset
553 if (len > 1) {
10567
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
554 // Restore the big-endian constant pool indexes.
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
555 // Cf. Rewriter::scan_method
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
556 switch (code) {
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
557 case Bytecodes::_getstatic:
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
558 case Bytecodes::_putstatic:
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
559 case Bytecodes::_getfield:
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
560 case Bytecodes::_putfield:
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
561 case Bytecodes::_invokevirtual:
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
562 case Bytecodes::_invokespecial:
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
563 case Bytecodes::_invokestatic:
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
564 case Bytecodes::_invokeinterface:
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
565 case Bytecodes::_invokehandle: {
15843
747bc4099ad8 rename initializeBytecode to getBytecode and eliminate extra copy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15806
diff changeset
566 int cp_index = Bytes::get_native_u2((address) reconstituted_code->byte_at_addr(bci + 1));
747bc4099ad8 rename initializeBytecode to getBytecode and eliminate extra copy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15806
diff changeset
567 Bytes::put_Java_u2((address) reconstituted_code->byte_at_addr(bci + 1), (u2) cp_index);
10567
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
568 break;
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
569 }
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
570
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
571 case Bytecodes::_invokedynamic:
15843
747bc4099ad8 rename initializeBytecode to getBytecode and eliminate extra copy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15806
diff changeset
572 int cp_index = Bytes::get_native_u4((address) reconstituted_code->byte_at_addr(bci + 1));
747bc4099ad8 rename initializeBytecode to getBytecode and eliminate extra copy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15806
diff changeset
573 Bytes::put_Java_u4((address) reconstituted_code->byte_at_addr(bci + 1), (u4) cp_index);
10567
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
574 break;
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
575 }
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
576
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
577 // Not all ldc byte code are rewritten.
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
578 switch (raw_code) {
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
579 case Bytecodes::_fast_aldc: {
15843
747bc4099ad8 rename initializeBytecode to getBytecode and eliminate extra copy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15806
diff changeset
580 int cpc_index = reconstituted_code->byte_at(bci + 1) & 0xff;
10567
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
581 int cp_index = method->constants()->object_to_cp_index(cpc_index);
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
582 assert(cp_index < method->constants()->length(), "sanity check");
15843
747bc4099ad8 rename initializeBytecode to getBytecode and eliminate extra copy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15806
diff changeset
583 reconstituted_code->byte_at_put(bci + 1, (jbyte) cp_index);
10567
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
584 break;
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
585 }
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
586
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
587 case Bytecodes::_fast_aldc_w: {
15843
747bc4099ad8 rename initializeBytecode to getBytecode and eliminate extra copy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15806
diff changeset
588 int cpc_index = Bytes::get_native_u2((address) reconstituted_code->byte_at_addr(bci + 1));
10567
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
589 int cp_index = method->constants()->object_to_cp_index(cpc_index);
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
590 assert(cp_index < method->constants()->length(), "sanity check");
15843
747bc4099ad8 rename initializeBytecode to getBytecode and eliminate extra copy
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15806
diff changeset
591 Bytes::put_Java_u2((address) reconstituted_code->byte_at_addr(bci + 1), (u2) cp_index);
10567
7cd21876c116 Revert bytecode indexes back to Java endianess.
twisti
parents: 10542
diff changeset
592 break;
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
593 }
5154
ae72dd38eeb1 bugfix, parallel GC seems stable
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5150
diff changeset
594 }
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5130
diff changeset
595 }
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
596 }
5150
fdd9dd4508fa some GC fixes
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5130
diff changeset
597
20898
23433619a7cd Consistently use JNIHandles::make_local with THREAD parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents: 20807
diff changeset
598 return (jbyteArray) JNIHandles::make_local(THREAD, reconstituted_code);
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
599 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
600
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
601 C2V_VMENTRY(jint, getExceptionTableLength, (JNIEnv *, jobject, jobject jvmci_method))
14105
f62c770c22be make HotSpotResolvedJavaMethod leaner
twisti
parents: 14104
diff changeset
602 ResourceMark rm;
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
603 methodHandle method = CompilerToVM::asMethod(jvmci_method);
14105
f62c770c22be make HotSpotResolvedJavaMethod leaner
twisti
parents: 14104
diff changeset
604 return method->exception_table_length();
f62c770c22be make HotSpotResolvedJavaMethod leaner
twisti
parents: 14104
diff changeset
605 C2V_END
f62c770c22be make HotSpotResolvedJavaMethod leaner
twisti
parents: 14104
diff changeset
606
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
607 C2V_VMENTRY(jlong, getExceptionTableStart, (JNIEnv *, jobject, jobject jvmci_method))
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
608 ResourceMark rm;
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
609 methodHandle method = CompilerToVM::asMethod(jvmci_method);
22420
e3d9e0f9b50c cleaned up and added more javadoc to CompilerToVM (JDK-8133194)
Doug Simon <doug.simon@oracle.com>
parents: 22414
diff changeset
610 if (method->exception_table_length() == 0) {
e3d9e0f9b50c cleaned up and added more javadoc to CompilerToVM (JDK-8133194)
Doug Simon <doug.simon@oracle.com>
parents: 22414
diff changeset
611 return 0L;
e3d9e0f9b50c cleaned up and added more javadoc to CompilerToVM (JDK-8133194)
Doug Simon <doug.simon@oracle.com>
parents: 22414
diff changeset
612 }
13305
a63d65b682a8 moved most HotSpotResolvedJavaMethod.getExceptionHandlers logic to Java
twisti
parents: 13295
diff changeset
613 return (jlong) (address) method->exception_table_start();
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
614 C2V_END
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
615
23749
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
616 C2V_VMENTRY(jobject, asResolvedJavaMethod, (JNIEnv *, jobject, jobject executable_handle))
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
617 oop executable = JNIHandles::resolve(executable_handle);
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
618 oop mirror = NULL;
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
619 int slot = 0;
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
620
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
621 if (executable->klass() == SystemDictionary::reflect_Constructor_klass()) {
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
622 mirror = java_lang_reflect_Constructor::clazz(executable);
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
623 slot = java_lang_reflect_Constructor::slot(executable);
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
624 } else {
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
625 assert(executable->klass() == SystemDictionary::reflect_Method_klass(), "wrong type");
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
626 mirror = java_lang_reflect_Method::clazz(executable);
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
627 slot = java_lang_reflect_Method::slot(executable);
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
628 }
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
629 Klass* holder = java_lang_Class::as_Klass(mirror);
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
630 methodHandle method = InstanceKlass::cast(holder)->method_with_idnum(slot);
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
631 oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
632 return JNIHandles::make_local(THREAD, result);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
633 }
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
634
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
635 C2V_VMENTRY(jobject, getResolvedJavaMethod, (JNIEnv *, jobject, jobject base, jlong offset))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
636 methodHandle method;
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
637 oop base_object = JNIHandles::resolve(base);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
638 if (base_object == NULL) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
639 method = *((Method**)(offset));
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
640 } else if (base_object->is_a(SystemDictionary::MemberName_klass())) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
641 method = (Method*) (intptr_t) base_object->long_field(offset);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
642 } else if (base_object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
643 method = *((Method**)(HotSpotResolvedJavaMethodImpl::metaspaceMethod(base_object) + offset));
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
644 } else {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
645 THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
646 err_msg("Unexpected type: %s", base_object->klass()->external_name()));
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
647 }
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
648 assert (method.is_null() || method->is_method(), "invalid read");
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
649 oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
650 return JNIHandles::make_local(THREAD, result);
7044
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
651 }
34753b057324 added unit tests for JavaType, JavaMethod and ResolvedJavaMethod
Doug Simon <doug.simon@oracle.com>
parents: 7037
diff changeset
652
23734
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
653 C2V_VMENTRY(jobject, getConstantPool, (JNIEnv *, jobject, jobject object_handle))
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
654 constantPoolHandle cp;
23734
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
655 oop object = JNIHandles::resolve(object_handle);
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
656 if (object == NULL) {
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
657 THROW_0(vmSymbols::java_lang_NullPointerException());
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
658 }
23734
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
659 if (object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) {
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
660 cp = CompilerToVM::asMethod(object)->constMethod()->constants();
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
661 } else if (object->is_a(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass())) {
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
662 cp = InstanceKlass::cast(CompilerToVM::asKlass(object))->constants();
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
663 } else {
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
664 THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
665 err_msg("Unexpected type: %s", object->klass()->external_name()));
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
666 }
23734
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
667 assert(!cp.is_null(), "npe");
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
668 JavaValue method_result(T_OBJECT);
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
669 JavaCallArguments args;
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
670 args.push_long((jlong) (address) cp());
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
671 JavaCalls::call_static(&method_result, SystemDictionary::HotSpotConstantPool_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::constantPool_fromMetaspace_signature(), &args, CHECK_NULL);
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
672 return JNIHandles::make_local(THREAD, (oop)method_result.get_jobject());
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
673 }
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
674
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
675 C2V_VMENTRY(jobject, getResolvedJavaType, (JNIEnv *, jobject, jobject base, jlong offset, jboolean compressed))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
676 KlassHandle klass;
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
677 oop base_object = JNIHandles::resolve(base);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
678 jlong base_address = 0;
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
679 if (base_object != NULL && offset == oopDesc::klass_offset_in_bytes()) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
680 klass = base_object->klass();
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
681 } else if (!compressed) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
682 if (base_object != NULL) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
683 if (base_object->is_a(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass())) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
684 base_address = HotSpotResolvedJavaMethodImpl::metaspaceMethod(base_object);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
685 } else if (base_object->is_a(SystemDictionary::HotSpotConstantPool_klass())) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
686 base_address = HotSpotConstantPool::metaspaceConstantPool(base_object);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
687 } else if (base_object->is_a(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass())) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
688 base_address = (jlong) CompilerToVM::asKlass(base_object);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
689 } else if (base_object->is_a(SystemDictionary::Class_klass())) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
690 base_address = (jlong) (address) base_object;
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
691 } else {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
692 THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
693 err_msg("Unexpected arguments: %s " JLONG_FORMAT " %s", base_object->klass()->external_name(), offset, compressed ? "true" : "false"));
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
694 }
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
695 }
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
696 klass = *((Klass**) (intptr_t) (base_address + offset));
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
697 } else {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
698 THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(),
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
699 err_msg("Unexpected arguments: %s " JLONG_FORMAT " %s", base_object->klass()->external_name(), offset, compressed ? "true" : "false"));
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
700 }
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
701 assert (klass.is_null() || klass->is_klass(), "invalid read");
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
702 oop result = CompilerToVM::get_jvmci_type(klass, CHECK_NULL);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
703 return JNIHandles::make_local(THREAD, result);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
704 }
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
705
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
706 C2V_VMENTRY(jobject, findUniqueConcreteMethod, (JNIEnv *, jobject, jobject jvmci_type, jobject jvmci_method))
22558
09813b6555ae Fixed bug in assert in lookupType plus some exception throwing improvements.
twisti
parents: 22548
diff changeset
707 ResourceMark rm;
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
708 methodHandle method = CompilerToVM::asMethod(jvmci_method);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
709 KlassHandle holder = CompilerToVM::asKlass(jvmci_type);
22558
09813b6555ae Fixed bug in assert in lookupType plus some exception throwing improvements.
twisti
parents: 22548
diff changeset
710 if (holder->is_interface()) {
09813b6555ae Fixed bug in assert in lookupType plus some exception throwing improvements.
twisti
parents: 22548
diff changeset
711 THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Interface %s should be handled in Java code", holder->external_name()));
09813b6555ae Fixed bug in assert in lookupType plus some exception throwing improvements.
twisti
parents: 22548
diff changeset
712 }
09813b6555ae Fixed bug in assert in lookupType plus some exception throwing improvements.
twisti
parents: 22548
diff changeset
713
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
714 methodHandle ucm;
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
715 {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
716 MutexLocker locker(Compile_lock);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
717 ucm = Dependencies::find_unique_concrete_method(holder(), method());
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
718 }
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
719 oop result = CompilerToVM::get_jvmci_method(ucm, CHECK_NULL);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
720 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
721 C2V_END
2049
7e09ea4a8f36 Added leaf method assumptions.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2048
diff changeset
722
22455
7ad03bf3d4a9 renames related to using metaspace wrappers instead of raw metaspace values
Doug Simon <doug.simon@oracle.com>
parents: 22454
diff changeset
723 C2V_VMENTRY(jobject, getImplementor, (JNIEnv *, jobject, jobject jvmci_type))
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
724 InstanceKlass* klass = (InstanceKlass*) CompilerToVM::asKlass(jvmci_type);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
725 oop implementor = CompilerToVM::get_jvmci_type(klass->implementor(), CHECK_NULL);
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23390
diff changeset
726 return JNIHandles::make_local(THREAD, implementor);
7226
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
727 C2V_END
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7225 7154
diff changeset
728
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
729 C2V_VMENTRY(jboolean, methodIsIgnoredBySecurityStackWalk,(JNIEnv *, jobject, jobject jvmci_method))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
730 methodHandle method = CompilerToVM::asMethod(jvmci_method);
14717
aa1a43bfdf4e make HotSpotResolvedJavaMethod leaner
twisti
parents: 14545
diff changeset
731 return 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
732 C2V_END
2926
0e3ec0a4eda4 RiTypeProfile information and invocation counters for RiMethods
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
733
23986
6d2c72b822b0 add ResolvedJavaMethod.hasNeverInlineDirective (JDK-8172733)
Doug Simon <doug.simon@oracle.com>
parents: 23749
diff changeset
734 C2V_VMENTRY(jboolean, isCompilable,(JNIEnv *, jobject, jobject jvmci_method))
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
735 methodHandle method = CompilerToVM::asMethod(jvmci_method);
24103
b48ccfe53101 8174961: [JVMCI] incorrect implementation of isCompilable
Doug Simon <doug.simon@oracle.com>
parents: 24100
diff changeset
736 return !method->is_not_compilable(CompLevel_full_optimization);
23986
6d2c72b822b0 add ResolvedJavaMethod.hasNeverInlineDirective (JDK-8172733)
Doug Simon <doug.simon@oracle.com>
parents: 23749
diff changeset
737 C2V_END
6d2c72b822b0 add ResolvedJavaMethod.hasNeverInlineDirective (JDK-8172733)
Doug Simon <doug.simon@oracle.com>
parents: 23749
diff changeset
738
6d2c72b822b0 add ResolvedJavaMethod.hasNeverInlineDirective (JDK-8172733)
Doug Simon <doug.simon@oracle.com>
parents: 23749
diff changeset
739 C2V_VMENTRY(jboolean, hasNeverInlineDirective,(JNIEnv *, jobject, jobject jvmci_method))
6d2c72b822b0 add ResolvedJavaMethod.hasNeverInlineDirective (JDK-8172733)
Doug Simon <doug.simon@oracle.com>
parents: 23749
diff changeset
740 methodHandle method = CompilerToVM::asMethod(jvmci_method);
6d2c72b822b0 add ResolvedJavaMethod.hasNeverInlineDirective (JDK-8172733)
Doug Simon <doug.simon@oracle.com>
parents: 23749
diff changeset
741 return CompilerOracle::should_not_inline(method) || method->dont_inline();
13953
d587baa55dd7 Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13895
diff changeset
742 C2V_END
d587baa55dd7 Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13895
diff changeset
743
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
744 C2V_VMENTRY(jboolean, shouldInlineMethod,(JNIEnv *, jobject, jobject jvmci_method))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
745 methodHandle method = CompilerToVM::asMethod(jvmci_method);
13953
d587baa55dd7 Add shouldBeInlined method to ResolvedJavaMethod, implement it for HotSpot and use it in the inlining phase
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13895
diff changeset
746 return CompilerOracle::should_inline(method) || method->force_inline();
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
747 C2V_END
4441
4e3aaf14cbc6 fixed graal to hotspot
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4439
diff changeset
748
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
749 C2V_VMENTRY(jobject, lookupType, (JNIEnv*, jobject, jstring jname, jclass accessing_class, jboolean resolve))
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
750 ResourceMark rm;
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
751 Handle name = JNIHandles::resolve(jname);
22558
09813b6555ae Fixed bug in assert in lookupType plus some exception throwing improvements.
twisti
parents: 22548
diff changeset
752 Symbol* class_name = java_lang_String::as_symbol(name, CHECK_0);
09813b6555ae Fixed bug in assert in lookupType plus some exception throwing improvements.
twisti
parents: 22548
diff changeset
753 if (java_lang_String::length(name()) <= 1) {
09813b6555ae Fixed bug in assert in lookupType plus some exception throwing improvements.
twisti
parents: 22548
diff changeset
754 THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Primitive type %s should be handled in Java code", class_name->as_C_string()));
09813b6555ae Fixed bug in assert in lookupType plus some exception throwing improvements.
twisti
parents: 22548
diff changeset
755 }
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
756
13483
37ec2cabf397 moved JavaType creation in CompilerToVM.lookupType into Java
twisti
parents: 13479
diff changeset
757 Klass* resolved_klass = NULL;
37ec2cabf397 moved JavaType creation in CompilerToVM.lookupType into Java
twisti
parents: 13479
diff changeset
758 Handle class_loader;
37ec2cabf397 moved JavaType creation in CompilerToVM.lookupType into Java
twisti
parents: 13479
diff changeset
759 Handle protection_domain;
16492
8853b9304083 made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents: 16405
diff changeset
760 if (JNIHandles::resolve(accessing_class) == NULL) {
22558
09813b6555ae Fixed bug in assert in lookupType plus some exception throwing improvements.
twisti
parents: 22548
diff changeset
761 THROW_0(vmSymbols::java_lang_NullPointerException());
13258
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13254
diff changeset
762 }
16492
8853b9304083 made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents: 16405
diff changeset
763 Klass* accessing_klass = java_lang_Class::as_Klass(JNIHandles::resolve(accessing_class));
8853b9304083 made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents: 16405
diff changeset
764 class_loader = accessing_klass->class_loader();
8853b9304083 made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents: 16405
diff changeset
765 protection_domain = accessing_klass->protection_domain();
8853b9304083 made type resolution require an accessing class context
Doug Simon <doug.simon@oracle.com>
parents: 16405
diff changeset
766
14117
2b2f0022900f removed unnecessary lookupKlassByName method
Doug Simon <doug.simon@oracle.com>
parents: 14107
diff changeset
767 if (resolve) {
19453
398988a77716 Fix cpp code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19451
diff changeset
768 resolved_klass = SystemDictionary::resolve_or_null(class_name, class_loader, protection_domain, CHECK_0);
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
769 } else {
19451
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
770 if (class_name->byte_at(0) == 'L' &&
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
771 class_name->byte_at(class_name->utf8_length()-1) == ';') {
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
772 // This is a name from a signature. Strip off the trimmings.
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
773 // Call recursive to keep scope of strippedsym.
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
774 TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1,
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
775 class_name->utf8_length()-2,
19454
67337afcb69e Another fix in the cpp part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19453
diff changeset
776 CHECK_0);
19453
398988a77716 Fix cpp code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19451
diff changeset
777 resolved_klass = SystemDictionary::find(strippedsym, class_loader, protection_domain, CHECK_0);
19451
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
778 } else if (FieldType::is_array(class_name)) {
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
779 FieldArrayInfo fd;
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
780 // dimension and object_key in FieldArrayInfo are assigned as a side-effect
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
781 // of this call
19453
398988a77716 Fix cpp code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19451
diff changeset
782 BasicType t = FieldType::get_array_info(class_name, fd, CHECK_0);
19451
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
783 if (t == T_OBJECT) {
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
784 TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1+fd.dimension(),
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
785 class_name->utf8_length()-2-fd.dimension(),
19453
398988a77716 Fix cpp code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19451
diff changeset
786 CHECK_0);
19451
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
787 // naked oop "k" is OK here -- we assign back into it
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
788 resolved_klass = SystemDictionary::find(strippedsym,
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
789 class_loader,
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
790 protection_domain,
19453
398988a77716 Fix cpp code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19451
diff changeset
791 CHECK_0);
19451
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
792 if (resolved_klass != NULL) {
19453
398988a77716 Fix cpp code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19451
diff changeset
793 resolved_klass = resolved_klass->array_klass(fd.dimension(), CHECK_0);
19451
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
794 }
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
795 } else {
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
796 resolved_klass = Universe::typeArrayKlassObj(t);
19453
398988a77716 Fix cpp code.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19451
diff changeset
797 resolved_klass = TypeArrayKlass::cast(resolved_klass)->array_klass(fd.dimension(), CHECK_0);
19451
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
798 }
2452e881fad5 Do not eagerly resolve types in lookupType.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18929
diff changeset
799 }
13258
fdd6ef90d66d move HotSpotResolvedPrimitiveType's from VMToCompilerImpl to HotSpotGraalRuntime
twisti
parents: 13254
diff changeset
800 }
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
801 Handle result = CompilerToVM::get_jvmci_type(resolved_klass, CHECK_NULL);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
802 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
803 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
804
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
805 C2V_VMENTRY(jobject, resolveConstantInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
806 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
14529
82c3b54d1f08 added HotSpotConstantPool.JVM_CONSTANT enum
twisti
parents: 14172
diff changeset
807 oop result = cp->resolve_constant_at(index, CHECK_NULL);
82c3b54d1f08 added HotSpotConstantPool.JVM_CONSTANT enum
twisti
parents: 14172
diff changeset
808 return JNIHandles::make_local(THREAD, result);
82c3b54d1f08 added HotSpotConstantPool.JVM_CONSTANT enum
twisti
parents: 14172
diff changeset
809 C2V_END
82c3b54d1f08 added HotSpotConstantPool.JVM_CONSTANT enum
twisti
parents: 14172
diff changeset
810
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
811 C2V_VMENTRY(jobject, resolvePossiblyCachedConstantInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
812 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
14529
82c3b54d1f08 added HotSpotConstantPool.JVM_CONSTANT enum
twisti
parents: 14172
diff changeset
813 oop result = cp->resolve_possibly_cached_constant_at(index, CHECK_NULL);
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
814 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
815 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
816
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
817 C2V_VMENTRY(jint, lookupNameAndTypeRefIndexInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
818 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
14093
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
819 return cp->name_and_type_ref_index_at(index);
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
820 C2V_END
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
821
22605
f0ec628cb987 fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents: 22599
diff changeset
822 C2V_VMENTRY(jobject, lookupNameInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint which))
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
823 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
22605
f0ec628cb987 fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents: 22599
diff changeset
824 Handle sym = java_lang_String::create_from_symbol(cp->name_ref_at(which), CHECK_NULL);
15968
42eaa579e134 more improvements to runtime initialization:
Doug Simon <doug.simon@oracle.com>
parents: 15843
diff changeset
825 return JNIHandles::make_local(THREAD, sym());
14093
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
826 C2V_END
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
827
22605
f0ec628cb987 fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents: 22599
diff changeset
828 C2V_VMENTRY(jobject, lookupSignatureInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint which))
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
829 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
22605
f0ec628cb987 fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents: 22599
diff changeset
830 Handle sym = java_lang_String::create_from_symbol(cp->signature_ref_at(which), CHECK_NULL);
15968
42eaa579e134 more improvements to runtime initialization:
Doug Simon <doug.simon@oracle.com>
parents: 15843
diff changeset
831 return JNIHandles::make_local(THREAD, sym());
14093
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
832 C2V_END
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
833
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
834 C2V_VMENTRY(jint, lookupKlassRefIndexInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
835 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
14093
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
836 return cp->klass_ref_index_at(index);
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
837 C2V_END
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
838
22455
7ad03bf3d4a9 renames related to using metaspace wrappers instead of raw metaspace values
Doug Simon <doug.simon@oracle.com>
parents: 22454
diff changeset
839 C2V_VMENTRY(jobject, resolveTypeInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index))
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
840 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
841 Klass* resolved_klass = cp->klass_at(index, CHECK_NULL);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
842 Handle klass = CompilerToVM::get_jvmci_type(resolved_klass, CHECK_NULL);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
843 return JNIHandles::make_local(THREAD, klass());
14530
d87b84dade7d moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents: 14529
diff changeset
844 C2V_END
d87b84dade7d moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents: 14529
diff changeset
845
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
846 C2V_VMENTRY(jobject, lookupKlassInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
847 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
14093
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
848 KlassHandle loading_klass(cp->pool_holder());
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
849 bool is_accessible = false;
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
850 KlassHandle klass = JVMCIEnv::get_klass_by_index(cp, index, is_accessible, loading_klass);
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
851 Symbol* symbol = NULL;
14093
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
852 if (klass.is_null()) {
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
853 // We have to lock the cpool to keep the oop from being resolved
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
854 // while we are accessing it.
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
855 MonitorLockerEx ml(cp->lock());
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
856 constantTag tag = cp->tag_at(index);
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
857 if (tag.is_klass()) {
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
858 // The klass has been inserted into the constant pool
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
859 // very recently.
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
860 klass = cp->resolved_klass_at(index);
14093
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
861 } else if (tag.is_symbol()) {
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
862 symbol = cp->symbol_at(index);
14093
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
863 } else {
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
864 assert(cp->tag_at(index).is_unresolved_klass(), "wrong tag");
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
865 symbol = cp->unresolved_klass_at(index);
14093
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
866 }
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
867 }
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
868 Handle result;
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
869 if (!klass.is_null()) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
870 result = CompilerToVM::get_jvmci_type(klass, CHECK_NULL);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
871 } else {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
872 result = java_lang_String::create_from_symbol(symbol, CHECK_NULL);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
873 }
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
874 return JNIHandles::make_local(THREAD, result());
14093
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
875 C2V_END
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
876
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
877 C2V_VMENTRY(jobject, lookupAppendixInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
878 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
13259
b16fb0b7479b every HotSpotResolvedJavaMethod needs its own constant pool
twisti
parents: 13258
diff changeset
879 oop appendix_oop = ConstantPool::appendix_at_if_loaded(cp, index);
8945
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
880 return JNIHandles::make_local(THREAD, appendix_oop);
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
881 C2V_END
7ef66078d837 add basic invokedynamic support
Andreas Woess <andreas.woess@jku.at>
parents: 8613
diff changeset
882
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
883 C2V_VMENTRY(jobject, lookupMethodInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
884 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
3670
f198b24093f3 put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3669
diff changeset
885 instanceKlassHandle pool_holder(cp->pool_holder());
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
886 Bytecodes::Code bc = (Bytecodes::Code) (((int) opcode) & 0xFF);
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
887 methodHandle method = JVMCIEnv::get_method_by_index(cp, index, bc, pool_holder);
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
888 oop result = CompilerToVM::get_jvmci_method(method, CHECK_NULL);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
889 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
890 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
891
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
892 C2V_VMENTRY(jint, constantPoolRemapInstructionOperandFromCache, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
893 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
14530
d87b84dade7d moved CompilerToVM.loadReferencedTypeInPool logic into Java
twisti
parents: 14529
diff changeset
894 return cp->remap_instruction_operand_from_cache(index);
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
895 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
896
23989
115d4e0d7b87 removed HotSpotResolvedJavaFieldImpl.name field
Doug Simon <doug.simon@oracle.com>
parents: 23986
diff changeset
897 C2V_VMENTRY(jobject, resolveFieldInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index, jbyte opcode, jintArray info_handle))
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
898 ResourceMark rm;
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
899 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
14093
dd783f0ecf17 refactor CompilerToVM interface
twisti
parents: 14069
diff changeset
900 Bytecodes::Code code = (Bytecodes::Code)(((int) opcode) & 0xFF);
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
901 fieldDescriptor fd;
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
902 LinkResolver::resolve_field_access(fd, cp, index, Bytecodes::java_code(code), true, false, CHECK_0);
14069
2f37b0e442fe removed remaining VMToCompiler calls for allocating Graal API objects
Doug Simon <doug.simon@oracle.com>
parents: 14052
diff changeset
903 typeArrayOop info = (typeArrayOop) JNIHandles::resolve(info_handle);
23996
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
904 if (info == NULL || info->length() != 3) {
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
905 JVMCI_ERROR_NULL("info must not be null and have a length of 3");
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
906 }
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
907 info->int_at_put(0, fd.access_flags().as_int());
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
908 info->int_at_put(1, fd.offset());
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
909 info->int_at_put(2, fd.index());
11f0412408cd 8173912: [JVMCI] fix memory overhead of JVMCI
Doug Simon <doug.simon@oracle.com>
parents: 23994
diff changeset
910 oop field_holder = CompilerToVM::get_jvmci_type(fd.field_holder(), CHECK_NULL);
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
911 return JNIHandles::make_local(THREAD, field_holder);
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
912 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
913
22583
c9f8eec77163 CompilerToVm.getVtableIndexForInterfaceMethod must not allow non-interface methods (JDK-8136659)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22576
diff changeset
914 C2V_VMENTRY(jint, getVtableIndexForInterfaceMethod, (JNIEnv *, jobject, jobject jvmci_type, jobject jvmci_method))
22587
c016f4fc2bd7 Use separate throws
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22584
diff changeset
915 ResourceMark rm;
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
916 Klass* klass = CompilerToVM::asKlass(jvmci_type);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
917 Method* method = CompilerToVM::asMethod(jvmci_method);
22558
09813b6555ae Fixed bug in assert in lookupType plus some exception throwing improvements.
twisti
parents: 22548
diff changeset
918 if (klass->is_interface()) {
22587
c016f4fc2bd7 Use separate throws
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22584
diff changeset
919 THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Interface %s should be handled in Java code", klass->external_name()));
22558
09813b6555ae Fixed bug in assert in lookupType plus some exception throwing improvements.
twisti
parents: 22548
diff changeset
920 }
22583
c9f8eec77163 CompilerToVm.getVtableIndexForInterfaceMethod must not allow non-interface methods (JDK-8136659)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22576
diff changeset
921 if (!method->method_holder()->is_interface()) {
22587
c016f4fc2bd7 Use separate throws
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22584
diff changeset
922 THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Method %s is not held by an interface, this case should be handled in Java code", method->name_and_sig_as_C_string()));
22584
f94fd2b4f794 CompilerToVM.getVtableIndexForInterfaceMethod check if receiver class is initialized (JDK-8136655)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22583
diff changeset
923 }
22701
6b1cd334f300 Use is_linked to guard getVtableIndexForInterfaceMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22699
diff changeset
924 if (!InstanceKlass::cast(klass)->is_linked()) {
6b1cd334f300 Use is_linked to guard getVtableIndexForInterfaceMethod
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22699
diff changeset
925 THROW_MSG_0(vmSymbols::java_lang_InternalError(), err_msg("Class %s must be linked", klass->external_name()));
22583
c9f8eec77163 CompilerToVm.getVtableIndexForInterfaceMethod must not allow non-interface methods (JDK-8136659)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22576
diff changeset
926 }
15725
ef6b8d1898e6 Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15722
diff changeset
927 return LinkResolver::vtable_index_of_interface_method(klass, method);
ef6b8d1898e6 Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15722
diff changeset
928 C2V_END
ef6b8d1898e6 Add resolved receiver type to ResolvedJavaMethod.isInVirtualMethodTable in order to be able to do vtable-calls for miranda and default methods
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15722
diff changeset
929
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
930 C2V_VMENTRY(jobject, resolveMethod, (JNIEnv *, jobject, jobject receiver_jvmci_type, jobject jvmci_method, jobject caller_jvmci_type))
23347
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
931 KlassHandle recv_klass = CompilerToVM::asKlass(receiver_jvmci_type);
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
932 KlassHandle caller_klass = CompilerToVM::asKlass(caller_jvmci_type);
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
933 methodHandle method = CompilerToVM::asMethod(jvmci_method);
15722
c583759bbcfd ResolvedJavaType.resolveMethod now takes a callerType that is used to check access rules. Make it work for default methods.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15456
diff changeset
934
23347
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
935 KlassHandle h_resolved (THREAD, method->method_holder());
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
936 Symbol* h_name = method->name();
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
937 Symbol* h_signature = method->signature();
15722
c583759bbcfd ResolvedJavaType.resolveMethod now takes a callerType that is used to check access rules. Make it work for default methods.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15456
diff changeset
938
24100
839dcc4f2cf6 handle signature polymorphic methods correctly (JDK-8161550)
Doug Simon <doug.simon@oracle.com>
parents: 23998
diff changeset
939 vmIntrinsics::ID iid = method()->intrinsic_id();
839dcc4f2cf6 handle signature polymorphic methods correctly (JDK-8161550)
Doug Simon <doug.simon@oracle.com>
parents: 23998
diff changeset
940 if (MethodHandles::is_signature_polymorphic(iid) && MethodHandles::is_signature_polymorphic_intrinsic(iid)) {
839dcc4f2cf6 handle signature polymorphic methods correctly (JDK-8161550)
Doug Simon <doug.simon@oracle.com>
parents: 23998
diff changeset
941 // Signature polymorphic methods are already resolved, JVMCI just returns NULL in this case.
839dcc4f2cf6 handle signature polymorphic methods correctly (JDK-8161550)
Doug Simon <doug.simon@oracle.com>
parents: 23998
diff changeset
942 return NULL;
839dcc4f2cf6 handle signature polymorphic methods correctly (JDK-8161550)
Doug Simon <doug.simon@oracle.com>
parents: 23998
diff changeset
943 }
23347
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
944 methodHandle m;
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
945 // Only do exact lookup if receiver klass has been linked. Otherwise,
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
946 // the vtable has not been setup, and the LinkResolver will fail.
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
947 if (recv_klass->oop_is_array() ||
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
948 InstanceKlass::cast(recv_klass())->is_linked() && !recv_klass->is_interface()) {
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
949 bool check_access = true;
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
950 if (h_resolved->is_interface()) {
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
951 m = LinkResolver::resolve_interface_call_or_null(recv_klass, h_resolved, h_name, h_signature, caller_klass, check_access);
15722
c583759bbcfd ResolvedJavaType.resolveMethod now takes a callerType that is used to check access rules. Make it work for default methods.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15456
diff changeset
952 } else {
23347
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
953 m = LinkResolver::resolve_virtual_call_or_null(recv_klass, h_resolved, h_name, h_signature, caller_klass, check_access);
15722
c583759bbcfd ResolvedJavaType.resolveMethod now takes a callerType that is used to check access rules. Make it work for default methods.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15456
diff changeset
954 }
c583759bbcfd ResolvedJavaType.resolveMethod now takes a callerType that is used to check access rules. Make it work for default methods.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15456
diff changeset
955 }
23347
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
956
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
957 if (m.is_null()) {
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
958 // Return NULL only if there was a problem with lookup (uninitialized class, etc.)
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
959 return NULL;
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
960 }
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
961
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
962 oop result = CompilerToVM::get_jvmci_method(m, CHECK_NULL);
7ae6a635fad0 8152903: [JVMCI] CompilerToVM::resolveMethod should correctly handle private methods in interfaces
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23322
diff changeset
963 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
964 C2V_END
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
965
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
966 C2V_VMENTRY(jboolean, hasFinalizableSubclass,(JNIEnv *, jobject, jobject jvmci_type))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
967 Klass* klass = CompilerToVM::asKlass(jvmci_type);
9126
bc26f978b0ce HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
Bernhard Urban <bernhard.urban@jku.at>
parents: 9108
diff changeset
968 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
969 return Dependencies::find_finalizable_subclass(klass) != NULL;
bc26f978b0ce HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
Bernhard Urban <bernhard.urban@jku.at>
parents: 9108
diff changeset
970 C2V_END
bc26f978b0ce HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
Bernhard Urban <bernhard.urban@jku.at>
parents: 9108
diff changeset
971
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
972 C2V_VMENTRY(jobject, getClassInitializer, (JNIEnv *, jobject, jobject jvmci_type))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
973 InstanceKlass* klass = (InstanceKlass*) CompilerToVM::asKlass(jvmci_type);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
974 oop result = CompilerToVM::get_jvmci_method(klass->class_initializer(), CHECK_NULL);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
975 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
976 C2V_END
3090
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3055
diff changeset
977
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
978 C2V_VMENTRY(jlong, getMaxCallTargetOffset, (JNIEnv*, jobject, jlong addr))
9649
dd62ccda1849 rename parameter
Doug Simon <doug.simon@oracle.com>
parents: 9610
diff changeset
979 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
980 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
981 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
982 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
983 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
984 }
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
985 return -1;
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
986 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
987
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
988 C2V_VMENTRY(void, doNotInlineOrCompile,(JNIEnv *, jobject, jobject jvmci_method))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
989 methodHandle method = CompilerToVM::asMethod(jvmci_method);
12532
9b1cc2628961 Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 12409
diff changeset
990 method->set_not_c1_compilable();
9b1cc2628961 Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 12409
diff changeset
991 method->set_not_c2_compilable();
9b1cc2628961 Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 12409
diff changeset
992 method->set_dont_inline(true);
9b1cc2628961 Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 12409
diff changeset
993 C2V_END
9b1cc2628961 Extend the CompilerToVM interface to explicitly avoid compilation and inlining of methods
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 12409
diff changeset
994
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
995 C2V_VMENTRY(jint, installCode, (JNIEnv *jniEnv, jobject, jobject target, jobject compiled_code, jobject installed_code, jobject speculation_log))
3669
53636e2c9d03 No longer use shared ciFactory. Remove make_global usage in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3667
diff changeset
996 ResourceMark rm;
3670
f198b24093f3 put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3669
diff changeset
997 HandleMark hm;
22496
90c4254dc25a Pass TargetDescription argument to CompilerToVM.installCode.
Roland Schatz <roland.schatz@oracle.com>
parents: 22487
diff changeset
998 Handle target_handle = JNIHandles::resolve(target);
9669
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9668
diff changeset
999 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
1000 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
1001 Handle installed_code_handle = JNIHandles::resolve(installed_code);
13641
5a9afbf72714 Add a speculation oop for uncommon trap deoptimization. Save it in the SpeculationLog during deoptimization.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13630
diff changeset
1002 Handle speculation_log_handle = JNIHandles::resolve(speculation_log);
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
1003
22650
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1004 JVMCICompiler* compiler = JVMCICompiler::instance(CHECK_(JNI_ERR));
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1005
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
1006 TraceTime install_time("installCode", JVMCICompiler::codeInstallTimer());
13493
03bb0ee05409 made CodeInstaller subclassable and virtualized the methods for creating ScopeValues
Doug Simon <doug.simon@oracle.com>
parents: 13483
diff changeset
1007 CodeInstaller installer;
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22701
diff changeset
1008 JVMCIEnv::CodeInstallResult result = installer.install(compiler, target_handle, compiled_code_handle, cb, installed_code_handle, speculation_log_handle, CHECK_0);
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
1009
8526
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
1010 if (PrintCodeCacheOnCompilation) {
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
1011 stringStream s;
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
1012 // 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
1013 {
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
1014 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
1015 CodeCache::print_summary(&s, false);
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
1016 }
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
1017 ttyLocker ttyl;
18043
f55f2d400797 Fix some format strings
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 17374
diff changeset
1018 tty->print_raw_cr(s.as_string());
8526
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
1019 }
3a105dec912f Respect the PrintCodeCacheOnCompilation flag in the graal compiler
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 8513
diff changeset
1020
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
1021 if (result != JVMCIEnv::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
1022 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
1023 } 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
1024 if (!installed_code_handle.is_null()) {
15161
2c940b1a48d8 Convert InstalledCode from an interface into an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15104
diff changeset
1025 assert(installed_code_handle->is_a(InstalledCode::klass()), "wrong type");
22736
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1026 nmethod::invalidate_installed_code(installed_code_handle, CHECK_0);
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1027 {
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1028 // Ensure that all updates to the InstalledCode fields are consistent.
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1029 MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1030 InstalledCode::set_address(installed_code_handle, (jlong) cb);
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1031 InstalledCode::set_version(installed_code_handle, InstalledCode::version(installed_code_handle) + 1);
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1032 if (cb->is_nmethod()) {
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1033 InstalledCode::set_entryPoint(installed_code_handle, (jlong) cb->as_nmethod_or_null()->verified_entry_point());
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1034 } else {
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1035 InstalledCode::set_entryPoint(installed_code_handle, (jlong) cb->code_begin());
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1036 }
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1037 if (installed_code_handle->is_a(HotSpotInstalledCode::klass())) {
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1038 HotSpotInstalledCode::set_size(installed_code_handle, cb->size());
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1039 HotSpotInstalledCode::set_codeStart(installed_code_handle, (jlong) cb->code_begin());
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1040 HotSpotInstalledCode::set_codeSize(installed_code_handle, cb->code_size());
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1041 }
10577
9c7d9e2c8326 PTX kernel execution - no args or return value
Morris Meyer <morris.meyer@oracle.com>
parents: 10567
diff changeset
1042 }
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
1043 nmethod* nm = cb->as_nmethod_or_null();
21144
b7f05f4ca66e Fix code install assertions to work with G1
iveresov
parents: 21119
diff changeset
1044 if (nm != NULL && installed_code_handle->is_scavengable()) {
b7f05f4ca66e Fix code install assertions to work with G1
iveresov
parents: 21119
diff changeset
1045 assert(nm->detect_scavenge_root_oops(), "nm should be scavengable if installed_code is scavengable");
b7f05f4ca66e Fix code install assertions to work with G1
iveresov
parents: 21119
diff changeset
1046 if (!UseG1GC) {
b7f05f4ca66e Fix code install assertions to work with G1
iveresov
parents: 21119
diff changeset
1047 assert(nm->on_scavenge_root_list(), "nm should be on scavengable list");
b7f05f4ca66e Fix code install assertions to work with G1
iveresov
parents: 21119
diff changeset
1048 }
b7f05f4ca66e Fix code install assertions to work with G1
iveresov
parents: 21119
diff changeset
1049 }
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
1050 }
3683
345c3bbf9c3c store RiCompiledMethod in nmethod and:
Lukas Stadler <lukas.stadler@jku.at>
parents: 3632
diff changeset
1051 }
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
1052 return result;
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
1053 C2V_END
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
1054
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1055 C2V_VMENTRY(void, resetCompilationStatistics, (JNIEnv *jniEnv, jobject))
22650
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1056 JVMCICompiler* compiler = JVMCICompiler::instance(CHECK);
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1057 CompilerStatistics* stats = compiler->stats();
16006
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15968
diff changeset
1058 stats->_standard.reset();
66a9286203a2 decoupled Graal runtime initialization and Graal compilation queue initialization
Doug Simon <doug.simon@oracle.com>
parents: 15968
diff changeset
1059 stats->_osr.reset();
13103
c0b0974dd509 moved notification of Graal compilation statistics from VMToCompiler to CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 12779
diff changeset
1060 C2V_END
c0b0974dd509 moved notification of Graal compilation statistics from VMToCompiler to CompilerToVM
Doug Simon <doug.simon@oracle.com>
parents: 12779
diff changeset
1061
22643
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22642
diff changeset
1062 C2V_VMENTRY(jobject, disassembleCodeBlob, (JNIEnv *jniEnv, jobject, jobject installedCode))
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8348
diff changeset
1063 ResourceMark rm;
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8348
diff changeset
1064 HandleMark hm;
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8348
diff changeset
1065
22643
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22642
diff changeset
1066 if (installedCode == NULL) {
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22642
diff changeset
1067 THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), "installedCode is null");
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22642
diff changeset
1068 }
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22642
diff changeset
1069
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22642
diff changeset
1070 jlong codeBlob = InstalledCode::address(installedCode);
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22642
diff changeset
1071 if (codeBlob == 0L) {
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22642
diff changeset
1072 return NULL;
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22642
diff changeset
1073 }
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22642
diff changeset
1074
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
1075 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
1076 if (cb == NULL) {
8349
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8348
diff changeset
1077 return NULL;
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8348
diff changeset
1078 }
8d6ea1915d42 merged CodeInfo into InstalledCode (GRAAL-156)
Doug Simon <doug.simon@oracle.com>
parents: 8348
diff changeset
1079
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
1080 // 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
1081 // 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
1082 // 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
1083 // 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
1084 // the disassembled code is typically about 10x the code size so a fixed buffer
13236
25da0f4e5c77 added extra space to disassembler buffer to account for disassembly header
Doug Simon <doug.simon@oracle.com>
parents: 13181
diff changeset
1085 // sized to 20x code size plus a fixed amount for header info should be sufficient.
25da0f4e5c77 added extra space to disassembler buffer to account for disassembly header
Doug Simon <doug.simon@oracle.com>
parents: 13181
diff changeset
1086 int bufferSize = cb->code_size() * 20 + 1024;
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
1087 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
1088 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
1089 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
1090 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
1091 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
1092 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
1093 }
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
1094 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
1095 } 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
1096 Disassembler::decode(cb, &st);
7784
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7760
diff changeset
1097 }
13772
284aea4028ca Fix: HotSpotDisassemblerProvider should return null when the code could not be disassembled.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13769
diff changeset
1098 if (st.size() <= 0) {
284aea4028ca Fix: HotSpotDisassemblerProvider should return null when the code could not be disassembled.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13769
diff changeset
1099 return NULL;
284aea4028ca Fix: HotSpotDisassemblerProvider should return null when the code could not be disassembled.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 13769
diff changeset
1100 }
7784
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7760
diff changeset
1101
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7760
diff changeset
1102 Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL);
20898
23433619a7cd Consistently use JNIHandles::make_local with THREAD parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents: 20807
diff changeset
1103 return JNIHandles::make_local(THREAD, result());
7784
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7760
diff changeset
1104 C2V_END
016e23829147 added HotSpot implementation of disassembling APIs
Doug Simon <doug.simon@oracle.com>
parents: 7760
diff changeset
1105
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1106 C2V_VMENTRY(jobject, getStackTraceElement, (JNIEnv*, jobject, jobject jvmci_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
1107 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
1108 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
1109
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1110 methodHandle method = CompilerToVM::asMethod(jvmci_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
1111 oop element = java_lang_StackTraceElement::create(method, bci, CHECK_NULL);
20898
23433619a7cd Consistently use JNIHandles::make_local with THREAD parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents: 20807
diff changeset
1112 return JNIHandles::make_local(THREAD, element);
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
1113 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
1114
22420
e3d9e0f9b50c cleaned up and added more javadoc to CompilerToVM (JDK-8133194)
Doug Simon <doug.simon@oracle.com>
parents: 22414
diff changeset
1115 C2V_VMENTRY(jobject, executeInstalledCode, (JNIEnv*, 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
1116 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
1117 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
1118
15161
2c940b1a48d8 Convert InstalledCode from an interface into an abstract class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 15104
diff changeset
1119 jlong nmethodValue = InstalledCode::address(hotspotInstalledCode);
13698
c3370b2e1cbc added check for invalidated code in executeCompiledMethodVarargs
Doug Simon <doug.simon@oracle.com>
parents: 13641
diff changeset
1120 if (nmethodValue == 0L) {
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22651
diff changeset
1121 THROW_NULL(vmSymbols::jdk_vm_ci_code_InvalidInstalledCodeException());
13698
c3370b2e1cbc added check for invalidated code in executeCompiledMethodVarargs
Doug Simon <doug.simon@oracle.com>
parents: 13641
diff changeset
1122 }
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
1123 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
1124 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
1125 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
1126 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
1127
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5624
diff changeset
1128 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
1129 JavaValue result(jap.get_ret_type());
8151
b8f261ba79c6 Minimize diff to plain HotSpot version.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8127
diff changeset
1130 jca.set_alternative_target(nm);
b8f261ba79c6 Minimize diff to plain HotSpot version.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8127
diff changeset
1131 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
1132
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1133 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
1134 return NULL;
5395
fc1943f18fef fixed bug in returning array values from CompilerToVMImpl.executeCompiledMethodVarargs
Doug Simon <doug.simon@oracle.com>
parents: 5318
diff changeset
1135 } else if (jap.get_ret_type() == T_OBJECT || jap.get_ret_type() == T_ARRAY) {
20898
23433619a7cd Consistently use JNIHandles::make_local with THREAD parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents: 20807
diff changeset
1136 return JNIHandles::make_local(THREAD, (oop) result.get_jobject());
5246
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1137 } else {
16308
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1138 jvalue *value = (jvalue *) result.get_value_addr();
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1139 // Narrow the value down if required (Important on big endian machines)
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1140 switch (jap.get_ret_type()) {
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1141 case T_BOOLEAN:
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1142 value->z = (jboolean) value->i;
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1143 break;
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1144 case T_BYTE:
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1145 value->b = (jbyte) value->i;
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1146 break;
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1147 case T_CHAR:
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1148 value->c = (jchar) value->i;
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1149 break;
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1150 case T_SHORT:
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1151 value->s = (jshort) value->i;
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1152 break;
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1153 }
e5a8608f7d63 Narrowing down the return value (short, char and bool) of called method on Big Endian architectures.
Stefan Anzinger <stefan.anzinger@gmail.com>
parents: 15205
diff changeset
1154 oop o = java_lang_boxing_object::create(jap.get_ret_type(), value, CHECK_NULL);
20898
23433619a7cd Consistently use JNIHandles::make_local with THREAD parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents: 20807
diff changeset
1155 return JNIHandles::make_local(THREAD, o);
5246
8bf2c37c46c4 added RiCompiledMethod.executeVarargs(Object...) to support compiling and calling arbitrary Java methods
Doug Simon <doug.simon@oracle.com>
parents: 5238
diff changeset
1156 }
6376
e957c9ff0bda put boiler plate for CompilerToVM native methods in macros
Doug Simon <doug.simon@oracle.com>
parents: 6367
diff changeset
1157 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
1158
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1159 C2V_VMENTRY(jlongArray, getLineNumberTable, (JNIEnv *, jobject, jobject jvmci_method))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1160 Method* method = CompilerToVM::asMethod(jvmci_method);
8269
985a97ba083c Fix spacing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8215
diff changeset
1161 if (!method->has_linenumber_table()) {
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1162 return NULL;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1163 }
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1164 u2 num_entries = 0;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1165 CompressedLineNumberReadStream streamForSize(method->compressed_linenumber_table());
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1166 while (streamForSize.read_pair()) {
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1167 num_entries++;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1168 }
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1169
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1170 CompressedLineNumberReadStream stream(method->compressed_linenumber_table());
15806
240cc9a901fb don't use JNI natives to interact with VM metadata
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15805
diff changeset
1171 typeArrayOop result = oopFactory::new_longArray(2 * num_entries, CHECK_NULL);
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1172
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1173 int i = 0;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1174 jlong value;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1175 while (stream.read_pair()) {
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1176 value = ((long) stream.bci());
15806
240cc9a901fb don't use JNI natives to interact with VM metadata
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15805
diff changeset
1177 result->long_at_put(i, value);
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1178 value = ((long) stream.line());
15806
240cc9a901fb don't use JNI natives to interact with VM metadata
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15805
diff changeset
1179 result->long_at_put(i + 1, value);
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1180 i += 2;
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1181 }
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1182
20898
23433619a7cd Consistently use JNIHandles::make_local with THREAD parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents: 20807
diff changeset
1183 return (jlongArray) JNIHandles::make_local(THREAD, result);
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1184 C2V_END
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1185
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1186 C2V_VMENTRY(jlong, getLocalVariableTableStart, (JNIEnv *, jobject, jobject jvmci_method))
7786
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1187 ResourceMark rm;
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1188 Method* method = CompilerToVM::asMethod(jvmci_method);
8269
985a97ba083c Fix spacing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 8215
diff changeset
1189 if (!method->has_localvariable_table()) {
13306
dfb780080923 moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents: 13305
diff changeset
1190 return 0;
7786
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1191 }
13306
dfb780080923 moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents: 13305
diff changeset
1192 return (jlong) (address) method->localvariable_table_start();
7786
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1193 C2V_END
8bbbde9d0a52 extended ResolvedJavaMethod API by getLocalVariableTable
Matthias Grimmer <grimmer@ssw.jku.at>
parents: 7784
diff changeset
1194
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1195 C2V_VMENTRY(jint, getLocalVariableTableLength, (JNIEnv *, jobject, jobject jvmci_method))
13306
dfb780080923 moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents: 13305
diff changeset
1196 ResourceMark rm;
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1197 Method* method = CompilerToVM::asMethod(jvmci_method);
13306
dfb780080923 moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents: 13305
diff changeset
1198 return method->localvariable_table_length();
dfb780080923 moved most CompilerToVM.getLocalVariableTable to Java
twisti
parents: 13305
diff changeset
1199 C2V_END
7310
79a7b761755c Added getLineNumberTable and getFileName capabilities.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7232
diff changeset
1200
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1201 C2V_VMENTRY(void, reprofile, (JNIEnv*, jobject, jobject jvmci_method))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1202 Method* method = CompilerToVM::asMethod(jvmci_method);
10408
836a62f43af9 Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 10072
diff changeset
1203 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
1204 if (mcs != NULL) {
836a62f43af9 Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 10072
diff changeset
1205 mcs->clear_counters();
836a62f43af9 Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 10072
diff changeset
1206 }
836a62f43af9 Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
Doug Simon <doug.simon@oracle.com>
parents: 10072
diff changeset
1207 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
1208
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1209 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
1210 if (code != NULL) {
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1211 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
1212 }
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1213
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1214 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
1215 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
1216 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
1217 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
1218 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
1219 } else {
18137
94faadc823ea MethodData::initialize: remove unused argument
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 18043
diff changeset
1220 method_data->initialize();
8611
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1221 }
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1222 C2V_END
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1223
6c4db417385a added API to reset the profiling information for a method
Christian Haeubl <haeubl@ssw.jku.at>
parents: 8451
diff changeset
1224
22643
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22642
diff changeset
1225 C2V_VMENTRY(void, invalidateInstalledCode, (JNIEnv*, jobject, jobject installed_code))
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22642
diff changeset
1226 Handle installed_code_handle = JNIHandles::resolve(installed_code);
22736
2dea101cdfe9 Fix assertion failures with G1 barrier logic and guard InstalledCode updates
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22730
diff changeset
1227 nmethod::invalidate_installed_code(installed_code_handle, CHECK);
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
1228 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
1229
20176
03b4fa99eff8 rename CompilerToVM.readUnsafeOop to readUncompressedOop and only use it for reading oops in VM data structures since Unsafe.getObject() can be used for other cases
Doug Simon <doug.simon@oracle.com>
parents: 19454
diff changeset
1230 C2V_VMENTRY(jobject, readUncompressedOop, (JNIEnv*, jobject, jlong addr))
03b4fa99eff8 rename CompilerToVM.readUnsafeOop to readUncompressedOop and only use it for reading oops in VM data structures since Unsafe.getObject() can be used for other cases
Doug Simon <doug.simon@oracle.com>
parents: 19454
diff changeset
1231 oop ret = oopDesc::load_decode_heap_oop((oop*)(address)addr);
20898
23433619a7cd Consistently use JNIHandles::make_local with THREAD parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents: 20807
diff changeset
1232 return JNIHandles::make_local(THREAD, ret);
18719
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18222
diff changeset
1233 C2V_END
6484e5c068c7 Generalize object reading in HotSpotMemoryAccessProvider.
Roland Schatz <roland.schatz@oracle.com>
parents: 18222
diff changeset
1234
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1235 C2V_VMENTRY(jlongArray, collectCounters, (JNIEnv*, jobject))
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21556
diff changeset
1236 typeArrayOop arrayOop = oopFactory::new_longArray(JVMCICounterSize, CHECK_NULL);
11852
d7964e96b0b0 move benchmark counters into separate class and make them correct for multithreaded applications
Lukas Stadler <lukas.stadler@jku.at>
parents: 11520
diff changeset
1237 JavaThread::collect_counters(arrayOop);
20898
23433619a7cd Consistently use JNIHandles::make_local with THREAD parameter
Christian Wimmer <christian.wimmer@oracle.com>
parents: 20807
diff changeset
1238 return (jlongArray) JNIHandles::make_local(THREAD, arrayOop);
11852
d7964e96b0b0 move benchmark counters into separate class and make them correct for multithreaded applications
Lukas Stadler <lukas.stadler@jku.at>
parents: 11520
diff changeset
1239 C2V_END
d7964e96b0b0 move benchmark counters into separate class and make them correct for multithreaded applications
Lukas Stadler <lukas.stadler@jku.at>
parents: 11520
diff changeset
1240
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1241 C2V_VMENTRY(int, allocateCompileId, (JNIEnv*, jobject, jobject jvmci_method, int entry_bci))
13630
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13578
diff changeset
1242 HandleMark hm;
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13578
diff changeset
1243 ResourceMark rm;
22642
6b444ec119b8 Sanity check arguments to allocateCompileId
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22636
diff changeset
1244 if (JNIHandles::resolve(jvmci_method) == NULL) {
6b444ec119b8 Sanity check arguments to allocateCompileId
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22636
diff changeset
1245 THROW_0(vmSymbols::java_lang_NullPointerException());
6b444ec119b8 Sanity check arguments to allocateCompileId
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22636
diff changeset
1246 }
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1247 Method* method = CompilerToVM::asMethod(jvmci_method);
22642
6b444ec119b8 Sanity check arguments to allocateCompileId
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22636
diff changeset
1248 if (entry_bci >= method->code_size() || entry_bci < -1) {
6b444ec119b8 Sanity check arguments to allocateCompileId
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22636
diff changeset
1249 THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), err_msg("Unexpected bci %d", entry_bci));
6b444ec119b8 Sanity check arguments to allocateCompileId
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22636
diff changeset
1250 }
13969
fe034af88233 Acquire proper locks before calling assign_compile_id
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13953
diff changeset
1251 return CompileBroker::assign_compile_id_unlocked(THREAD, method, entry_bci);
13630
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13578
diff changeset
1252 C2V_END
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13578
diff changeset
1253
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13578
diff changeset
1254
15806
240cc9a901fb don't use JNI natives to interact with VM metadata
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15805
diff changeset
1255 C2V_VMENTRY(jboolean, isMature, (JNIEnv*, jobject, jlong metaspace_method_data))
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1256 MethodData* mdo = CompilerToVM::asMethodData(metaspace_method_data);
13769
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13698
diff changeset
1257 return mdo != NULL && mdo->is_mature();
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13698
diff changeset
1258 C2V_END
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13698
diff changeset
1259
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1260 C2V_VMENTRY(jboolean, hasCompiledCodeForOSR, (JNIEnv*, jobject, jobject jvmci_method, int entry_bci, int comp_level))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1261 Method* method = CompilerToVM::asMethod(jvmci_method);
14107
800057208a2c enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14106
diff changeset
1262 return method->lookup_osr_nmethod_for(entry_bci, comp_level, true) != NULL;
800057208a2c enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14106
diff changeset
1263 C2V_END
800057208a2c enable C1 + Graal tiered
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 14106
diff changeset
1264
22455
7ad03bf3d4a9 renames related to using metaspace wrappers instead of raw metaspace values
Doug Simon <doug.simon@oracle.com>
parents: 22454
diff changeset
1265 C2V_VMENTRY(jobject, getSymbol, (JNIEnv*, jobject, jlong symbol))
7ad03bf3d4a9 renames related to using metaspace wrappers instead of raw metaspace values
Doug Simon <doug.simon@oracle.com>
parents: 22454
diff changeset
1266 Handle sym = java_lang_String::create_from_symbol((Symbol*)(address)symbol, CHECK_NULL);
15968
42eaa579e134 more improvements to runtime initialization:
Doug Simon <doug.simon@oracle.com>
parents: 15843
diff changeset
1267 return JNIHandles::make_local(THREAD, sym());
42eaa579e134 more improvements to runtime initialization:
Doug Simon <doug.simon@oracle.com>
parents: 15843
diff changeset
1268 C2V_END
42eaa579e134 more improvements to runtime initialization:
Doug Simon <doug.simon@oracle.com>
parents: 15843
diff changeset
1269
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1270 bool matches(jobjectArray methods, Method* method) {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1271 objArrayOop methods_oop = (objArrayOop) JNIHandles::resolve(methods);
15088
d3add9b82b71 change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15063
diff changeset
1272
d3add9b82b71 change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15063
diff changeset
1273 for (int i = 0; i < methods_oop->length(); i++) {
22597
99b7154e88c7 Avoid public native methods in CompilerToVM class.
Roland Schatz <roland.schatz@oracle.com>
parents: 22587
diff changeset
1274 oop resolved = methods_oop->obj_at(i);
99b7154e88c7 Avoid public native methods in CompilerToVM class.
Roland Schatz <roland.schatz@oracle.com>
parents: 22587
diff changeset
1275 if (resolved->is_a(HotSpotResolvedJavaMethodImpl::klass()) && CompilerToVM::asMethod(resolved) == method) {
15088
d3add9b82b71 change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15063
diff changeset
1276 return true;
d3add9b82b71 change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15063
diff changeset
1277 }
d3add9b82b71 change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15063
diff changeset
1278 }
d3add9b82b71 change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15063
diff changeset
1279 return false;
d3add9b82b71 change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15063
diff changeset
1280 }
d3add9b82b71 change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15063
diff changeset
1281
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1282 C2V_VMENTRY(jobject, getNextStackFrame, (JNIEnv*, jobject compilerToVM, jobject hs_frame, jobjectArray methods, jint initialSkip))
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1283 ResourceMark rm;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1284
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1285 if (!thread->has_last_Java_frame()) return NULL;
24159
830c3424c0e5 check for and forward exceptions in getNextStackFrame and materializeVirtualObjects
Lukas Stadler <lukas.stadler@oracle.com>
parents: 24151
diff changeset
1286 Handle result = HotSpotStackFrameReference::klass()->allocate_instance(CHECK_NULL);
830c3424c0e5 check for and forward exceptions in getNextStackFrame and materializeVirtualObjects
Lukas Stadler <lukas.stadler@oracle.com>
parents: 24151
diff changeset
1287 HotSpotStackFrameReference::klass()->initialize(CHECK_NULL);
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1288
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1289 StackFrameStream fst(thread);
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1290 if (hs_frame != NULL) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1291 // look for the correct stack frame if one is given
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1292 intptr_t* stack_pointer = (intptr_t*) HotSpotStackFrameReference::stackPointer(hs_frame);
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1293 while (fst.current()->sp() != stack_pointer && !fst.is_done()) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1294 fst.next();
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1295 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1296 if (fst.current()->sp() != stack_pointer) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1297 THROW_MSG_NULL(vmSymbols::java_lang_IllegalStateException(), "stack frame not found")
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1298 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1299 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1300
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1301 int frame_number = 0;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1302 vframe* vf = vframe::new_vframe(fst.current(), fst.register_map(), thread);
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1303 if (hs_frame != NULL) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1304 // look for the correct vframe within the stack frame if one is given
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1305 int last_frame_number = HotSpotStackFrameReference::frameNumber(hs_frame);
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1306 while (frame_number < last_frame_number) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1307 if (vf->is_top()) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1308 THROW_MSG_NULL(vmSymbols::java_lang_IllegalStateException(), "invalid frame number")
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1309 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1310 vf = vf->sender();
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1311 frame_number ++;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1312 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1313 // move one frame forward
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1314 if (vf->is_top()) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1315 if (fst.is_done()) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1316 return NULL;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1317 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1318 fst.next();
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1319 vf = vframe::new_vframe(fst.current(), fst.register_map(), thread);
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1320 frame_number = 0;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1321 } else {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1322 vf = vf->sender();
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1323 frame_number++;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1324 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1325 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1326
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1327 while (true) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1328 // look for the given method
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1329 while (true) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1330 StackValueCollection* locals = NULL;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1331 if (vf->is_compiled_frame()) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1332 // compiled method frame
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1333 compiledVFrame* cvf = compiledVFrame::cast(vf);
15088
d3add9b82b71 change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15063
diff changeset
1334 if (methods == NULL || matches(methods, cvf->method())) {
15092
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1335 if (initialSkip > 0) {
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1336 initialSkip --;
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1337 } else {
22651
d06159da32c7 8137192: [JVMCI] GetNextStackFrameTest SIGSEGV @ ScopeDesc::objects()+0x1
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22650
diff changeset
1338 ScopeDesc* scope = cvf->scope();
d06159da32c7 8137192: [JVMCI] GetNextStackFrameTest SIGSEGV @ ScopeDesc::objects()+0x1
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22650
diff changeset
1339 // native wrapper do not have a scope
d06159da32c7 8137192: [JVMCI] GetNextStackFrameTest SIGSEGV @ ScopeDesc::objects()+0x1
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22650
diff changeset
1340 if (scope != NULL && scope->objects() != NULL) {
24159
830c3424c0e5 check for and forward exceptions in getNextStackFrame and materializeVirtualObjects
Lukas Stadler <lukas.stadler@oracle.com>
parents: 24151
diff changeset
1341 bool realloc_failures = Deoptimization::realloc_objects(thread, fst.current(), scope->objects(), CHECK_NULL);
22651
d06159da32c7 8137192: [JVMCI] GetNextStackFrameTest SIGSEGV @ ScopeDesc::objects()+0x1
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22650
diff changeset
1342 Deoptimization::reassign_fields(fst.current(), fst.register_map(), scope->objects(), realloc_failures, false);
15092
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1343
22651
d06159da32c7 8137192: [JVMCI] GetNextStackFrameTest SIGSEGV @ ScopeDesc::objects()+0x1
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22650
diff changeset
1344 GrowableArray<ScopeValue*>* local_values = scope->locals();
24159
830c3424c0e5 check for and forward exceptions in getNextStackFrame and materializeVirtualObjects
Lukas Stadler <lukas.stadler@oracle.com>
parents: 24151
diff changeset
1345 typeArrayHandle array = oopFactory::new_boolArray(local_values->length(), CHECK_NULL);
15092
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1346 for (int i = 0; i < local_values->length(); i++) {
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1347 ScopeValue* value = local_values->at(i);
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1348 if (value->is_object()) {
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1349 array->bool_at_put(i, true);
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1350 }
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1351 }
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1352 HotSpotStackFrameReference::set_localIsVirtual(result, array());
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1353 } else {
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1354 HotSpotStackFrameReference::set_localIsVirtual(result, NULL);
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1355 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1356
15092
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1357 locals = cvf->locals();
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1358 HotSpotStackFrameReference::set_bci(result, cvf->bci());
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1359 oop method = CompilerToVM::get_jvmci_method(cvf->method(), CHECK_NULL);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1360 HotSpotStackFrameReference::set_method(result, method);
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1361 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1362 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1363 } else if (vf->is_interpreted_frame()) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1364 // interpreted method frame
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1365 interpretedVFrame* ivf = interpretedVFrame::cast(vf);
15088
d3add9b82b71 change to StackIntrospection and Truffle getStackTrace implementation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15063
diff changeset
1366 if (methods == NULL || matches(methods, ivf->method())) {
15092
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1367 if (initialSkip > 0) {
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1368 initialSkip --;
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1369 } else {
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1370 locals = ivf->locals();
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1371 HotSpotStackFrameReference::set_bci(result, ivf->bci());
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1372 oop method = CompilerToVM::get_jvmci_method(ivf->method(), CHECK_NULL);
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1373 HotSpotStackFrameReference::set_method(result, method);
15092
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1374 HotSpotStackFrameReference::set_localIsVirtual(result, NULL);
c73ce0dd3583 add support for skipping stack frames in StackIntrospection.getStackTrace
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15088
diff changeset
1375 }
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1376 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1377 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1378
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1379 // locals != NULL means that we found a matching frame and result is already partially initialized
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1380 if (locals != NULL) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1381 HotSpotStackFrameReference::set_compilerToVM(result, JNIHandles::resolve(compilerToVM));
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1382 HotSpotStackFrameReference::set_stackPointer(result, (jlong) fst.current()->sp());
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1383 HotSpotStackFrameReference::set_frameNumber(result, frame_number);
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1384
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1385 // initialize the locals array
24159
830c3424c0e5 check for and forward exceptions in getNextStackFrame and materializeVirtualObjects
Lukas Stadler <lukas.stadler@oracle.com>
parents: 24151
diff changeset
1386 objArrayHandle array = oopFactory::new_objectArray(locals->size(), CHECK_NULL);
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1387 for (int i = 0; i < locals->size(); i++) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1388 StackValue* var = locals->at(i);
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1389 if (var->type() == T_OBJECT) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1390 array->obj_at_put(i, locals->at(i)->get_obj()());
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1391 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1392 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1393 HotSpotStackFrameReference::set_locals(result, array());
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1394
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1395 return JNIHandles::make_local(thread, result());
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1396 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1397
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1398 if (vf->is_top()) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1399 break;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1400 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1401 frame_number++;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1402 vf = vf->sender();
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1403 } // end of vframe loop
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1404
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1405 if (fst.is_done()) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1406 break;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1407 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1408 fst.next();
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1409 vf = vframe::new_vframe(fst.current(), fst.register_map(), thread);
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1410 frame_number = 0;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1411 } // end of frame loop
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1412
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1413 // the end was reached without finding a matching method
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1414 return NULL;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1415 C2V_END
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1416
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1417 C2V_VMENTRY(void, resolveInvokeDynamicInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1418 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
15205
affef8631cf4 Add eager resolving for indy call sites
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15177
diff changeset
1419 CallInfo callInfo;
affef8631cf4 Add eager resolving for indy call sites
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15177
diff changeset
1420 LinkResolver::resolve_invokedynamic(callInfo, cp, index, CHECK);
affef8631cf4 Add eager resolving for indy call sites
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15177
diff changeset
1421 ConstantPoolCacheEntry* cp_cache_entry = cp->invokedynamic_cp_cache_entry_at(index);
affef8631cf4 Add eager resolving for indy call sites
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15177
diff changeset
1422 cp_cache_entry->set_dynamic_call(cp, callInfo);
affef8631cf4 Add eager resolving for indy call sites
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15177
diff changeset
1423 C2V_END
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1424
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1425 C2V_VMENTRY(void, resolveInvokeHandleInPool, (JNIEnv*, jobject, jobject jvmci_constant_pool, jint index))
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1426 constantPoolHandle cp = CompilerToVM::asConstantPool(jvmci_constant_pool);
23741
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1427 KlassHandle holder = cp->klass_ref_at(index, CHECK);
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1428 Symbol* name = cp->name_ref_at(index);
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1429 if (MethodHandles::is_signature_polymorphic_name(holder(), name)) {
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1430 CallInfo callInfo;
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1431 LinkResolver::resolve_invokehandle(callInfo, cp, index, CHECK);
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1432 ConstantPoolCacheEntry* cp_cache_entry = cp_cache_entry = cp->cache()->entry_at(cp->decode_cpcache_index(index));
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1433 cp_cache_entry->set_method_handle(cp, callInfo);
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1434 }
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1435 C2V_END
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1436
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1437 C2V_VMENTRY(jobject, getSignaturePolymorphicHolders, (JNIEnv*, jobject))
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1438 objArrayHandle holders = oopFactory::new_objArray(SystemDictionary::String_klass(), 2, CHECK_NULL);
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1439 Handle mh = java_lang_String::create_from_str("Ljava/lang/invoke/MethodHandle;", CHECK_NULL);
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1440 Handle vh = java_lang_String::create_from_str("Ljava/lang/invoke/VarHandle;", CHECK_NULL);
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1441 holders->obj_at_put(0, mh());
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1442 holders->obj_at_put(1, vh());
6542cd8da2da include VarHandle in signature polymorphic method test (JDK-8164214)
Doug Simon <doug.simon@oracle.com>
parents: 23740
diff changeset
1443 return JNIHandles::make_local(THREAD, holders());
22013
3904e33db5b3 Make sure HotSpotConstantPool.loadReferencedType resolves invokehandle call sites properly. Fixes eager resolution problems at those call sites.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 21629
diff changeset
1444 C2V_END
3904e33db5b3 Make sure HotSpotConstantPool.loadReferencedType resolves invokehandle call sites properly. Fixes eager resolution problems at those call sites.
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 21629
diff changeset
1445
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1446 C2V_VMENTRY(jboolean, shouldDebugNonSafepoints, (JNIEnv*, jobject))
16243
fb77eab05bd3 Respect the VM's wish to record non-safepoint debug info
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16184
diff changeset
1447 //see compute_recording_non_safepoints in debugInfroRec.cpp
fb77eab05bd3 Respect the VM's wish to record non-safepoint debug info
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16184
diff changeset
1448 if (JvmtiExport::should_post_compiled_method_load() && FLAG_IS_DEFAULT(DebugNonSafepoints)) {
fb77eab05bd3 Respect the VM's wish to record non-safepoint debug info
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16184
diff changeset
1449 return true;
fb77eab05bd3 Respect the VM's wish to record non-safepoint debug info
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16184
diff changeset
1450 }
fb77eab05bd3 Respect the VM's wish to record non-safepoint debug info
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16184
diff changeset
1451 return DebugNonSafepoints;
fb77eab05bd3 Respect the VM's wish to record non-safepoint debug info
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16184
diff changeset
1452 C2V_END
fb77eab05bd3 Respect the VM's wish to record non-safepoint debug info
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16184
diff changeset
1453
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1454 // public native void materializeVirtualObjects(HotSpotStackFrameReference stackFrame, boolean invalidate);
15806
240cc9a901fb don't use JNI natives to interact with VM metadata
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15805
diff changeset
1455 C2V_VMENTRY(void, materializeVirtualObjects, (JNIEnv*, jobject, jobject hs_frame, bool invalidate))
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1456 ResourceMark rm;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1457
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1458 if (hs_frame == NULL) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1459 THROW_MSG(vmSymbols::java_lang_NullPointerException(), "stack frame is null")
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1460 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1461
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1462 HotSpotStackFrameReference::klass()->initialize(thread);
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1463
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1464 // look for the given stack frame
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1465 StackFrameStream fst(thread);
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1466 intptr_t* stack_pointer = (intptr_t*) HotSpotStackFrameReference::stackPointer(hs_frame);
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1467 while (fst.current()->sp() != stack_pointer && !fst.is_done()) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1468 fst.next();
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1469 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1470 if (fst.current()->sp() != stack_pointer) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1471 THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "stack frame not found")
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1472 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1473
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1474 if (invalidate) {
22620
c86a5e4c8725 JDK-8135277: [JVMCI] assert(fr().is_deoptimized_frame()) failed: frame must be scheduled for deoptimization
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22605
diff changeset
1475 if (!fst.current()->is_compiled_frame()) {
c86a5e4c8725 JDK-8135277: [JVMCI] assert(fr().is_deoptimized_frame()) failed: frame must be scheduled for deoptimization
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22605
diff changeset
1476 THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "compiled stack frame expected")
c86a5e4c8725 JDK-8135277: [JVMCI] assert(fr().is_deoptimized_frame()) failed: frame must be scheduled for deoptimization
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22605
diff changeset
1477 }
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1478 assert(fst.current()->cb()->is_nmethod(), "nmethod expected");
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1479 ((nmethod*) fst.current()->cb())->make_not_entrant();
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1480 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1481 Deoptimization::deoptimize(thread, *fst.current(), fst.register_map(), Deoptimization::Reason_none);
22620
c86a5e4c8725 JDK-8135277: [JVMCI] assert(fr().is_deoptimized_frame()) failed: frame must be scheduled for deoptimization
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22605
diff changeset
1482 // look for the frame again as it has been updated by deopt (pc, deopt state...)
c86a5e4c8725 JDK-8135277: [JVMCI] assert(fr().is_deoptimized_frame()) failed: frame must be scheduled for deoptimization
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22605
diff changeset
1483 StackFrameStream fstAfterDeopt(thread);
c86a5e4c8725 JDK-8135277: [JVMCI] assert(fr().is_deoptimized_frame()) failed: frame must be scheduled for deoptimization
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22605
diff changeset
1484 while (fstAfterDeopt.current()->sp() != stack_pointer && !fstAfterDeopt.is_done()) {
c86a5e4c8725 JDK-8135277: [JVMCI] assert(fr().is_deoptimized_frame()) failed: frame must be scheduled for deoptimization
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22605
diff changeset
1485 fstAfterDeopt.next();
c86a5e4c8725 JDK-8135277: [JVMCI] assert(fr().is_deoptimized_frame()) failed: frame must be scheduled for deoptimization
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22605
diff changeset
1486 }
c86a5e4c8725 JDK-8135277: [JVMCI] assert(fr().is_deoptimized_frame()) failed: frame must be scheduled for deoptimization
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22605
diff changeset
1487 if (fstAfterDeopt.current()->sp() != stack_pointer) {
c86a5e4c8725 JDK-8135277: [JVMCI] assert(fr().is_deoptimized_frame()) failed: frame must be scheduled for deoptimization
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22605
diff changeset
1488 THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "stack frame not found after deopt")
c86a5e4c8725 JDK-8135277: [JVMCI] assert(fr().is_deoptimized_frame()) failed: frame must be scheduled for deoptimization
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22605
diff changeset
1489 }
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1490
22620
c86a5e4c8725 JDK-8135277: [JVMCI] assert(fr().is_deoptimized_frame()) failed: frame must be scheduled for deoptimization
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 22605
diff changeset
1491 vframe* vf = vframe::new_vframe(fstAfterDeopt.current(), fstAfterDeopt.register_map(), thread);
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1492 if (!vf->is_compiled_frame()) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1493 THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "compiled stack frame expected")
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1494 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1495
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1496 GrowableArray<compiledVFrame*>* virtualFrames = new GrowableArray<compiledVFrame*>(10);
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1497 while (true) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1498 assert(vf->is_compiled_frame(), "Wrong frame type");
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1499 virtualFrames->push(compiledVFrame::cast(vf));
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1500 if (vf->is_top()) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1501 break;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1502 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1503 vf = vf->sender();
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1504 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1505
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1506 int last_frame_number = HotSpotStackFrameReference::frameNumber(hs_frame);
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1507 if (last_frame_number >= virtualFrames->length()) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1508 THROW_MSG(vmSymbols::java_lang_IllegalStateException(), "invalid frame number")
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1509 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1510
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1511 // Reallocate the non-escaping objects and restore their fields.
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1512 assert (virtualFrames->at(last_frame_number)->scope() != NULL,"invalid scope");
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1513 GrowableArray<ScopeValue*>* objects = virtualFrames->at(last_frame_number)->scope()->objects();
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1514
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1515 if (objects == NULL) {
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1516 // no objects to materialize
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1517 return;
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1518 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1519
24159
830c3424c0e5 check for and forward exceptions in getNextStackFrame and materializeVirtualObjects
Lukas Stadler <lukas.stadler@oracle.com>
parents: 24151
diff changeset
1520 bool realloc_failures = Deoptimization::realloc_objects(thread, fstAfterDeopt.current(), objects, CHECK);
22650
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1521 Deoptimization::reassign_fields(fstAfterDeopt.current(), fstAfterDeopt.register_map(), objects, realloc_failures, false);
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1522
20807
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1523 for (int frame_index = 0; frame_index < virtualFrames->length(); frame_index++) {
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1524 compiledVFrame* cvf = virtualFrames->at(frame_index);
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1525
20807
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1526 GrowableArray<ScopeValue*>* scopeLocals = cvf->scope()->locals();
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1527 StackValueCollection* locals = cvf->locals();
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1528
20807
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1529 if (locals != NULL) {
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1530 for (int i2 = 0; i2 < locals->size(); i2++) {
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1531 StackValue* var = locals->at(i2);
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1532 if (var->type() == T_OBJECT && scopeLocals->at(i2)->is_object()) {
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1533 jvalue val;
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1534 val.l = (jobject) locals->at(i2)->get_obj()();
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1535 cvf->update_local(T_OBJECT, i2, val);
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1536 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1537 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1538 }
20807
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1539 }
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1540
20807
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1541 // all locals are materialized by now
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1542 HotSpotStackFrameReference::set_localIsVirtual(hs_frame, NULL);
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1543
20807
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1544 // update the locals array
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1545 objArrayHandle array = HotSpotStackFrameReference::locals(hs_frame);
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1546 StackValueCollection* locals = virtualFrames->at(last_frame_number)->locals();
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1547 for (int i = 0; i < locals->size(); i++) {
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1548 StackValue* var = locals->at(i);
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1549 if (var->type() == T_OBJECT) {
8d4496e10a51 Fix merge
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20176
diff changeset
1550 array->obj_at_put(i, locals->at(i)->get_obj()());
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1551 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1552 }
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1553 C2V_END
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1554
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1555 C2V_VMENTRY(void, writeDebugOutput, (JNIEnv*, jobject, jbyteArray bytes, jint offset, jint length))
22650
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1556 if (bytes == NULL) {
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1557 THROW(vmSymbols::java_lang_NullPointerException());
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1558 }
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1559 typeArrayOop array = (typeArrayOop) JNIHandles::resolve(bytes);
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1560
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1561 // Check if offset and length are non negative.
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1562 if (offset < 0 || length < 0) {
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1563 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1564 }
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1565 // Check if the range is valid.
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1566 if ((((unsigned int) length + (unsigned int) offset) > (unsigned int) array->length())) {
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1567 THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1568 }
16405
9bfc4247262f send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16327
diff changeset
1569 while (length > 0) {
22650
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22648
diff changeset
1570 jbyte* start = array->byte_at_addr(offset);
16405
9bfc4247262f send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16327
diff changeset
1571 tty->write((char*) start, MIN2(length, O_BUFLEN));
9bfc4247262f send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16327
diff changeset
1572 length -= O_BUFLEN;
9bfc4247262f send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16327
diff changeset
1573 offset += O_BUFLEN;
9bfc4247262f send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16327
diff changeset
1574 }
9bfc4247262f send log output to native tty
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16327
diff changeset
1575 C2V_END
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1576
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1577 C2V_VMENTRY(void, flushDebugOutput, (JNIEnv*, jobject))
21119
294ed4ce1fa0 PrintStreamOption: also forward flushes to the VM
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20898
diff changeset
1578 tty->flush();
294ed4ce1fa0 PrintStreamOption: also forward flushes to the VM
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20898
diff changeset
1579 C2V_END
294ed4ce1fa0 PrintStreamOption: also forward flushes to the VM
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 20898
diff changeset
1580
22573
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1581 C2V_VMENTRY(int, methodDataProfileDataSize, (JNIEnv*, jobject, jlong metaspace_method_data, jint position))
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1582 ResourceMark rm;
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1583 MethodData* mdo = CompilerToVM::asMethodData(metaspace_method_data);
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1584 ProfileData* profile_data = mdo->data_at(position);
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1585 if (mdo->is_valid(profile_data)) {
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1586 return profile_data->size_in_bytes();
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1587 }
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1588 DataLayout* data = mdo->extra_data_base();
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1589 DataLayout* end = mdo->extra_data_limit();
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1590 for (;; data = mdo->next_extra(data)) {
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1591 assert(data < end, "moved past end of extra data");
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1592 profile_data = data->data_in();
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1593 if (mdo->dp_to_di(profile_data->dp()) == position) {
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1594 return profile_data->size_in_bytes();
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1595 }
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1596 }
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1597 THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), err_msg("Invalid profile data position %d", position));
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1598 C2V_END
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1599
24151
26a414946c56 Get host class of VM anonymous class (JDK-8182310)
Doug Simon <doug.simon@oracle.com>
parents: 24103
diff changeset
1600 C2V_VMENTRY(jobject, getHostClass, (JNIEnv*, jobject, jobject jvmci_type))
26a414946c56 Get host class of VM anonymous class (JDK-8182310)
Doug Simon <doug.simon@oracle.com>
parents: 24103
diff changeset
1601 InstanceKlass* k = InstanceKlass::cast(CompilerToVM::asKlass(jvmci_type));
26a414946c56 Get host class of VM anonymous class (JDK-8182310)
Doug Simon <doug.simon@oracle.com>
parents: 24103
diff changeset
1602 Klass* host = k->host_klass();
26a414946c56 Get host class of VM anonymous class (JDK-8182310)
Doug Simon <doug.simon@oracle.com>
parents: 24103
diff changeset
1603 oop result = CompilerToVM::get_jvmci_type(host, CHECK_NULL);
26a414946c56 Get host class of VM anonymous class (JDK-8182310)
Doug Simon <doug.simon@oracle.com>
parents: 24103
diff changeset
1604 return JNIHandles::make_local(THREAD, result);
26a414946c56 Get host class of VM anonymous class (JDK-8182310)
Doug Simon <doug.simon@oracle.com>
parents: 24103
diff changeset
1605 C2V_END
26a414946c56 Get host class of VM anonymous class (JDK-8182310)
Doug Simon <doug.simon@oracle.com>
parents: 24103
diff changeset
1606
22782
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1607 C2V_VMENTRY(int, interpreterFrameSize, (JNIEnv*, jobject, jobject bytecode_frame_handle))
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1608 if (bytecode_frame_handle == NULL) {
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1609 THROW_0(vmSymbols::java_lang_NullPointerException());
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1610 }
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1611
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1612 oop top_bytecode_frame = JNIHandles::resolve_non_null(bytecode_frame_handle);
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1613 oop bytecode_frame = top_bytecode_frame;
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1614 int size = 0;
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1615 int callee_parameters = 0;
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1616 int callee_locals = 0;
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1617 Method* method = getMethodFromHotSpotMethod(BytecodePosition::method(bytecode_frame));
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1618 int extra_args = method->max_stack() - BytecodeFrame::numStack(bytecode_frame);
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1619
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1620 while (bytecode_frame != NULL) {
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1621 int locks = BytecodeFrame::numLocks(bytecode_frame);
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1622 int temps = BytecodeFrame::numStack(bytecode_frame);
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1623 bool is_top_frame = (bytecode_frame == top_bytecode_frame);
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1624 Method* method = getMethodFromHotSpotMethod(BytecodePosition::method(bytecode_frame));
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1625
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1626 int frame_size = BytesPerWord * Interpreter::size_activation(method->max_stack(),
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1627 temps + callee_parameters,
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1628 extra_args,
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1629 locks,
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1630 callee_parameters,
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1631 callee_locals,
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1632 is_top_frame);
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1633 size += frame_size;
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1634
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1635 callee_parameters = method->size_of_parameters();
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1636 callee_locals = method->max_locals();
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1637 extra_args = 0;
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1638 bytecode_frame = BytecodePosition::caller(bytecode_frame);
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1639 }
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1640 return size + Deoptimization::last_frame_adjust(0, callee_locals) * BytesPerWord;
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1641 C2V_END
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1642
23749
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
1643 C2V_VMENTRY(void, compileToBytecode, (JNIEnv*, jobject, jobject lambda_form_handle))
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
1644 Handle lambda_form = JNIHandles::resolve_non_null(lambda_form_handle);
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
1645 if (lambda_form->is_a(SystemDictionary::LambdaForm_klass())) {
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
1646 TempNewSymbol compileToBytecode = SymbolTable::new_symbol("compileToBytecode", CHECK);
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
1647 JavaValue result(T_VOID);
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
1648 JavaCalls::call_special(&result, lambda_form, SystemDictionary::LambdaForm_klass(), compileToBytecode, vmSymbols::void_method_signature(), CHECK);
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
1649 } else {
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
1650 THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
1651 err_msg("Unexpected type: %s", lambda_form->klass()->external_name()));
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
1652 }
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
1653 C2V_END
15063
36e1a11a72b3 new StackIntrospection interface to allow access to stack contents
Lukas Stadler <lukas.stadler@oracle.com>
parents: 15059
diff changeset
1654
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
1655 #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
1656 #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
1657
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1658 #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
1659 #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
1660 #define CLASS "Ljava/lang/Class;"
23749
d6bd0b9cd0b6 remove uses of setAccessible (JDK-8165434)
Doug Simon <doug.simon@oracle.com>
parents: 23743
diff changeset
1661 #define EXECUTABLE "Ljava/lang/reflect/Executable;"
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
1662 #define STACK_TRACE_ELEMENT "Ljava/lang/StackTraceElement;"
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22651
diff changeset
1663 #define INSTALLED_CODE "Ljdk/vm/ci/code/InstalledCode;"
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22651
diff changeset
1664 #define TARGET_DESCRIPTION "Ljdk/vm/ci/code/TargetDescription;"
22782
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1665 #define BYTECODE_FRAME "Ljdk/vm/ci/code/BytecodeFrame;"
22672
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22651
diff changeset
1666 #define RESOLVED_METHOD "Ljdk/vm/ci/meta/ResolvedJavaMethod;"
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22651
diff changeset
1667 #define HS_RESOLVED_METHOD "Ljdk/vm/ci/hotspot/HotSpotResolvedJavaMethodImpl;"
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22651
diff changeset
1668 #define HS_RESOLVED_KLASS "Ljdk/vm/ci/hotspot/HotSpotResolvedObjectTypeImpl;"
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22651
diff changeset
1669 #define HS_CONSTANT_POOL "Ljdk/vm/ci/hotspot/HotSpotConstantPool;"
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22651
diff changeset
1670 #define HS_COMPILED_CODE "Ljdk/vm/ci/hotspot/HotSpotCompiledCode;"
1bbd4a7c274b Rename jdk.internal.jvmci to jdk.vm.ci
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22651
diff changeset
1671 #define HS_STACK_FRAME_REF "Ljdk/vm/ci/hotspot/HotSpotStackFrameReference;"
22699
ea58bbafd5b9 Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents: 22672
diff changeset
1672 #define HS_SPECULATION_LOG "Ljdk/vm/ci/hotspot/HotSpotSpeculationLog;"
13769
af344056124f Only use mature method datas
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13698
diff changeset
1673 #define METASPACE_METHOD_DATA "J"
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
1674
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1675 JNINativeMethod CompilerToVM::methods[] = {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1676 {CC"getBytecode", CC"("HS_RESOLVED_METHOD")[B", FN_PTR(getBytecode)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1677 {CC"getExceptionTableStart", CC"("HS_RESOLVED_METHOD")J", FN_PTR(getExceptionTableStart)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1678 {CC"getExceptionTableLength", CC"("HS_RESOLVED_METHOD")I", FN_PTR(getExceptionTableLength)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1679 {CC"findUniqueConcreteMethod", CC"("HS_RESOLVED_KLASS HS_RESOLVED_METHOD")"HS_RESOLVED_METHOD, FN_PTR(findUniqueConcreteMethod)},
22455
7ad03bf3d4a9 renames related to using metaspace wrappers instead of raw metaspace values
Doug Simon <doug.simon@oracle.com>
parents: 22454
diff changeset
1680 {CC"getImplementor", CC"("HS_RESOLVED_KLASS")"HS_RESOLVED_KLASS, FN_PTR(getImplementor)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1681 {CC"getStackTraceElement", CC"("HS_RESOLVED_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(getStackTraceElement)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1682 {CC"methodIsIgnoredBySecurityStackWalk", CC"("HS_RESOLVED_METHOD")Z", FN_PTR(methodIsIgnoredBySecurityStackWalk)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1683 {CC"doNotInlineOrCompile", CC"("HS_RESOLVED_METHOD")V", FN_PTR(doNotInlineOrCompile)},
23992
1b8892b4ce9c lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents: 23989
diff changeset
1684 {CC"isCompilable", CC"("HS_RESOLVED_METHOD")Z", FN_PTR(isCompilable)},
1b8892b4ce9c lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents: 23989
diff changeset
1685 {CC"hasNeverInlineDirective", CC"("HS_RESOLVED_METHOD")Z", FN_PTR(hasNeverInlineDirective)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1686 {CC"shouldInlineMethod", CC"("HS_RESOLVED_METHOD")Z", FN_PTR(shouldInlineMethod)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1687 {CC"lookupType", CC"("STRING CLASS"Z)"HS_RESOLVED_KLASS, FN_PTR(lookupType)},
22605
f0ec628cb987 fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents: 22599
diff changeset
1688 {CC"lookupNameInPool", CC"("HS_CONSTANT_POOL"I)"STRING, FN_PTR(lookupNameInPool)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1689 {CC"lookupNameAndTypeRefIndexInPool", CC"("HS_CONSTANT_POOL"I)I", FN_PTR(lookupNameAndTypeRefIndexInPool)},
22605
f0ec628cb987 fixed javadoc for lookupNameRefInPool and lookupSignatureRefInPool in CompilerToVM and renamed them to lookupNameInPool and lookupSignatureInPool
Doug Simon <doug.simon@oracle.com>
parents: 22599
diff changeset
1690 {CC"lookupSignatureInPool", CC"("HS_CONSTANT_POOL"I)"STRING, FN_PTR(lookupSignatureInPool)},
22487
a0e5714d5436 Remove Java implementation of HotSpotConstantPool Cache and ResolvedReferences and HotSpotSymbol.
twisti
parents: 22482
diff changeset
1691 {CC"lookupKlassRefIndexInPool", CC"("HS_CONSTANT_POOL"I)I", FN_PTR(lookupKlassRefIndexInPool)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1692 {CC"lookupKlassInPool", CC"("HS_CONSTANT_POOL"I)Ljava/lang/Object;", FN_PTR(lookupKlassInPool)},
22487
a0e5714d5436 Remove Java implementation of HotSpotConstantPool Cache and ResolvedReferences and HotSpotSymbol.
twisti
parents: 22482
diff changeset
1693 {CC"lookupAppendixInPool", CC"("HS_CONSTANT_POOL"I)"OBJECT, FN_PTR(lookupAppendixInPool)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1694 {CC"lookupMethodInPool", CC"("HS_CONSTANT_POOL"IB)"HS_RESOLVED_METHOD, FN_PTR(lookupMethodInPool)},
22487
a0e5714d5436 Remove Java implementation of HotSpotConstantPool Cache and ResolvedReferences and HotSpotSymbol.
twisti
parents: 22482
diff changeset
1695 {CC"constantPoolRemapInstructionOperandFromCache", CC"("HS_CONSTANT_POOL"I)I", FN_PTR(constantPoolRemapInstructionOperandFromCache)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1696 {CC"resolveConstantInPool", CC"("HS_CONSTANT_POOL"I)"OBJECT, FN_PTR(resolveConstantInPool)},
22487
a0e5714d5436 Remove Java implementation of HotSpotConstantPool Cache and ResolvedReferences and HotSpotSymbol.
twisti
parents: 22482
diff changeset
1697 {CC"resolvePossiblyCachedConstantInPool", CC"("HS_CONSTANT_POOL"I)"OBJECT, FN_PTR(resolvePossiblyCachedConstantInPool)},
22455
7ad03bf3d4a9 renames related to using metaspace wrappers instead of raw metaspace values
Doug Simon <doug.simon@oracle.com>
parents: 22454
diff changeset
1698 {CC"resolveTypeInPool", CC"("HS_CONSTANT_POOL"I)"HS_RESOLVED_KLASS, FN_PTR(resolveTypeInPool)},
23989
115d4e0d7b87 removed HotSpotResolvedJavaFieldImpl.name field
Doug Simon <doug.simon@oracle.com>
parents: 23986
diff changeset
1699 {CC"resolveFieldInPool", CC"("HS_CONSTANT_POOL"IB[I)"HS_RESOLVED_KLASS, FN_PTR(resolveFieldInPool)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1700 {CC"resolveInvokeDynamicInPool", CC"("HS_CONSTANT_POOL"I)V", FN_PTR(resolveInvokeDynamicInPool)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1701 {CC"resolveInvokeHandleInPool", CC"("HS_CONSTANT_POOL"I)V", FN_PTR(resolveInvokeHandleInPool)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1702 {CC"resolveMethod", CC"("HS_RESOLVED_KLASS HS_RESOLVED_METHOD HS_RESOLVED_KLASS")"HS_RESOLVED_METHOD, FN_PTR(resolveMethod)},
23992
1b8892b4ce9c lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents: 23989
diff changeset
1703 {CC"getSignaturePolymorphicHolders", CC"()[" STRING, FN_PTR(getSignaturePolymorphicHolders)},
22583
c9f8eec77163 CompilerToVm.getVtableIndexForInterfaceMethod must not allow non-interface methods (JDK-8136659)
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 22576
diff changeset
1704 {CC"getVtableIndexForInterfaceMethod", CC"("HS_RESOLVED_KLASS HS_RESOLVED_METHOD")I", FN_PTR(getVtableIndexForInterfaceMethod)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1705 {CC"getClassInitializer", CC"("HS_RESOLVED_KLASS")"HS_RESOLVED_METHOD, FN_PTR(getClassInitializer)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1706 {CC"hasFinalizableSubclass", CC"("HS_RESOLVED_KLASS")Z", FN_PTR(hasFinalizableSubclass)},
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1707 {CC"getMaxCallTargetOffset", CC"(J)J", FN_PTR(getMaxCallTargetOffset)},
23992
1b8892b4ce9c lazily cache the name of a HotSpotResolvedJavaMethodImpl
Doug Simon <doug.simon@oracle.com>
parents: 23989
diff changeset
1708 {CC"asResolvedJavaMethod", CC"(" EXECUTABLE ")" HS_RESOLVED_METHOD, FN_PTR(asResolvedJavaMethod)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1709 {CC"getResolvedJavaMethod", CC"(Ljava/lang/Object;J)"HS_RESOLVED_METHOD, FN_PTR(getResolvedJavaMethod)},
23734
2e17c65dddd7 8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
Doug Simon <doug.simon@oracle.com>
parents: 23709
diff changeset
1710 {CC"getConstantPool", CC"(Ljava/lang/Object;)"HS_CONSTANT_POOL, FN_PTR(getConstantPool)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1711 {CC"getResolvedJavaType", CC"(Ljava/lang/Object;JZ)"HS_RESOLVED_KLASS, FN_PTR(getResolvedJavaType)},
23679
b5557b757040 fix HotSpotVMConfig startup performance (JDK-8159167)
Doug Simon <doug.simon@oracle.com>
parents: 23408
diff changeset
1712 {CC"readConfiguration", CC"()[Ljava/lang/Object;", FN_PTR(readConfiguration)},
22699
ea58bbafd5b9 Move SpeculationLog implementation to HotSpotSpeculationLog, because it is not useful for other VMs
Christian Wimmer <christian.wimmer@oracle.com>
parents: 22672
diff changeset
1713 {CC"installCode", CC"("TARGET_DESCRIPTION HS_COMPILED_CODE INSTALLED_CODE HS_SPECULATION_LOG")I", FN_PTR(installCode)},
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1714 {CC"resetCompilationStatistics", CC"()V", FN_PTR(resetCompilationStatistics)},
22643
456800cd1a17 Ensure that not_entrant InstalledCode can still be invalidated
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22642
diff changeset
1715 {CC"disassembleCodeBlob", CC"("INSTALLED_CODE")"STRING, FN_PTR(disassembleCodeBlob)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1716 {CC"executeInstalledCode", CC"(["OBJECT INSTALLED_CODE")"OBJECT, FN_PTR(executeInstalledCode)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1717 {CC"getLineNumberTable", CC"("HS_RESOLVED_METHOD")[J", FN_PTR(getLineNumberTable)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1718 {CC"getLocalVariableTableStart", CC"("HS_RESOLVED_METHOD")J", FN_PTR(getLocalVariableTableStart)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1719 {CC"getLocalVariableTableLength", CC"("HS_RESOLVED_METHOD")I", FN_PTR(getLocalVariableTableLength)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1720 {CC"reprofile", CC"("HS_RESOLVED_METHOD")V", FN_PTR(reprofile)},
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1721 {CC"invalidateInstalledCode", CC"("INSTALLED_CODE")V", FN_PTR(invalidateInstalledCode)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1722 {CC"readUncompressedOop", CC"(J)"OBJECT, FN_PTR(readUncompressedOop)},
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1723 {CC"collectCounters", CC"()[J", FN_PTR(collectCounters)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1724 {CC"allocateCompileId", CC"("HS_RESOLVED_METHOD"I)I", FN_PTR(allocateCompileId)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1725 {CC"isMature", CC"("METASPACE_METHOD_DATA")Z", FN_PTR(isMature)},
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1726 {CC"hasCompiledCodeForOSR", CC"("HS_RESOLVED_METHOD"II)Z", FN_PTR(hasCompiledCodeForOSR)},
22487
a0e5714d5436 Remove Java implementation of HotSpotConstantPool Cache and ResolvedReferences and HotSpotSymbol.
twisti
parents: 22482
diff changeset
1727 {CC"getSymbol", CC"(J)"STRING, FN_PTR(getSymbol)},
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1728 {CC"getNextStackFrame", CC"("HS_STACK_FRAME_REF "["RESOLVED_METHOD"I)"HS_STACK_FRAME_REF, FN_PTR(getNextStackFrame)},
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1729 {CC"materializeVirtualObjects", CC"("HS_STACK_FRAME_REF"Z)V", FN_PTR(materializeVirtualObjects)},
22636
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1730 {CC"shouldDebugNonSafepoints", CC"()Z", FN_PTR(shouldDebugNonSafepoints)},
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1731 {CC"writeDebugOutput", CC"([BII)V", FN_PTR(writeDebugOutput)},
1ec4129907b3 made CompilerToVM package-private
Doug Simon <doug.simon@oracle.com>
parents: 22620
diff changeset
1732 {CC"flushDebugOutput", CC"()V", FN_PTR(flushDebugOutput)},
22573
be44a5efeaff HotSpotMethodData must handle profile data when TypeProfileLevel is non-zero
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22558
diff changeset
1733 {CC"methodDataProfileDataSize", CC"(JI)I", FN_PTR(methodDataProfileDataSize)},
24151
26a414946c56 Get host class of VM anonymous class (JDK-8182310)
Doug Simon <doug.simon@oracle.com>
parents: 24103
diff changeset
1734 {CC"getHostClass", CC"("HS_RESOLVED_KLASS")"HS_RESOLVED_KLASS, FN_PTR(getHostClass)},
22782
bf8a5a6861b1 Add CompilerToVM.interpreterFrameSize to support stack banging for deopt
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22769
diff changeset
1735 {CC"interpreterFrameSize", CC"("BYTECODE_FRAME")I", FN_PTR(interpreterFrameSize)},
23994
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
1736 {CC"compileToBytecode", CC"("OBJECT")V", FN_PTR(compileToBytecode)},
ebce30b702eb [GR-2538] reduced memory overhead of HotSpotVMConfigStore
Doug Simon <doug.simon@oracle.com>
parents: 23992
diff changeset
1737 {CC"getFlagValue", CC"("STRING")"OBJECT, FN_PTR(getFlagValue)},
1412
9195b99c841b Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1410
diff changeset
1738 };
9195b99c841b Added first VM entry method.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1410
diff changeset
1739
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1740 int CompilerToVM::methods_count() {
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22420
diff changeset
1741 return sizeof(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
1742 }
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
1743