annotate src/share/vm/jvmci/jvmciCodeInstaller.cpp @ 24109:1e693dba88e4

call_site_target_value dependency can be invalidated with counter changing
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Tue, 21 Feb 2017 16:57:23 -0800
parents 464eb43e7814
children
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 /*
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
2 * Copyright (c) 2011, 2016, 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.
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
22 */
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
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"
15046
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
25 #include "code/compiledIC.hpp"
13816
d006a6332db8 Make sure a compile id is assigned
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13726
diff changeset
26 #include "compiler/compileBroker.hpp"
7735
a7a93887b4c4 fix Solaris build and initial SPARC support
twisti
parents: 7716
diff changeset
27 #include "compiler/disassembler.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: 6539
diff changeset
28 #include "runtime/javaCalls.hpp"
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
29 #include "jvmci/jvmciEnv.hpp"
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
30 #include "jvmci/jvmciCompiler.hpp"
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
31 #include "jvmci/jvmciCodeInstaller.hpp"
22548
02fc27dc1da7 Rename jvmciJavaAccess.* to jvmciJavaClasses.*
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22544
diff changeset
32 #include "jvmci/jvmciJavaClasses.hpp"
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
33 #include "jvmci/jvmciCompilerToVM.hpp"
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
34 #include "jvmci/jvmciRuntime.hpp"
7742
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
35 #include "asm/register.hpp"
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
36 #include "classfile/vmSymbols.hpp"
7742
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
37 #include "code/vmreg.hpp"
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
38
7742
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
39 #ifdef TARGET_ARCH_x86
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
40 # include "vmreg_x86.inline.hpp"
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
41 #endif
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
42 #ifdef TARGET_ARCH_sparc
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
43 # include "vmreg_sparc.inline.hpp"
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
44 #endif
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
45 #ifdef TARGET_ARCH_zero
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
46 # include "vmreg_zero.inline.hpp"
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
47 #endif
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
48 #ifdef TARGET_ARCH_arm
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
49 # include "vmreg_arm.inline.hpp"
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
50 #endif
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
51 #ifdef TARGET_ARCH_ppc
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
52 # include "vmreg_ppc.inline.hpp"
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
53 #endif
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
54
18173
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
55
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
56 // frequently used constants
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
57 // Allocate them with new so they are never destroyed (otherwise, a
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
58 // forced exit could destroy these objects while they are still in
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
59 // use).
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
60 ConstantOopWriteValue* CodeInstaller::_oop_null_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantOopWriteValue(NULL);
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
61 ConstantIntValue* CodeInstaller::_int_m1_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(-1);
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
62 ConstantIntValue* CodeInstaller::_int_0_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(0);
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
63 ConstantIntValue* CodeInstaller::_int_1_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(1);
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
64 ConstantIntValue* CodeInstaller::_int_2_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(2);
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
65 LocationValue* CodeInstaller::_illegal_value = new (ResourceObj::C_HEAP, mtCompiler) LocationValue(Location());
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
66
14104
a38a54030ea2 pass metaspace pointers instead of object to VM
twisti
parents: 14029
diff changeset
67 Method* getMethodFromHotSpotMethod(oop hotspot_method) {
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18196
diff changeset
68 assert(hotspot_method != NULL && hotspot_method->is_a(HotSpotResolvedJavaMethodImpl::klass()), "sanity");
22454
76af33d4d504 Make jvmci redefinition safe
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22147
diff changeset
69 return CompilerToVM::asMethod(hotspot_method);
14104
a38a54030ea2 pass metaspace pointers instead of object to VM
twisti
parents: 14029
diff changeset
70 }
a38a54030ea2 pass metaspace pointers instead of object to VM
twisti
parents: 14029
diff changeset
71
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
72 VMReg getVMRegFromLocation(Handle location, int total_frame_size, TRAPS) {
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
73 if (location.is_null()) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
74 THROW_NULL(vmSymbols::java_lang_NullPointerException());
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
75 }
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
76
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
77 Handle reg = code_Location::reg(location);
21982
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
78 jint offset = code_Location::offset(location);
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
79
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
80 if (reg.not_null()) {
21982
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
81 // register
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
82 jint number = code_Register::number(reg);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
83 VMReg vmReg = CodeInstaller::get_hotspot_reg(number, CHECK_NULL);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
84 if (offset % 4 == 0) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
85 return vmReg->next(offset / 4);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
86 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
87 JVMCI_ERROR_NULL("unaligned subregister offset %d in oop map", offset);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
88 }
21982
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
89 } else {
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
90 // stack slot
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
91 if (offset % 4 == 0) {
23674
09a536b9233c 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23396
diff changeset
92 VMReg vmReg = VMRegImpl::stack2reg(offset / 4);
09a536b9233c 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23396
diff changeset
93 if (!OopMapValue::legal_vm_reg_name(vmReg)) {
09a536b9233c 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23396
diff changeset
94 // This restriction only applies to VMRegs that are used in OopMap but
09a536b9233c 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23396
diff changeset
95 // since that's the only use of VMRegs it's simplest to put this test
09a536b9233c 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23396
diff changeset
96 // here. This test should also be equivalent legal_vm_reg_name but JVMCI
09a536b9233c 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23396
diff changeset
97 // clients can use max_oop_map_stack_stack_offset to detect this problem
09a536b9233c 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23396
diff changeset
98 // directly. The asserts just ensure that the tests are in agreement.
23709
1b939a613788 Rename JVMCIRuntime::max_oop_map_stack_offset to CompilerToVM::Data::_max_oop_map_stack_offset
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23677
diff changeset
99 assert(offset > CompilerToVM::Data::max_oop_map_stack_offset(), "illegal VMReg");
23674
09a536b9233c 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23396
diff changeset
100 JVMCI_ERROR_NULL("stack offset %d is too large to be encoded in OopMap (max %d)",
23709
1b939a613788 Rename JVMCIRuntime::max_oop_map_stack_offset to CompilerToVM::Data::_max_oop_map_stack_offset
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23677
diff changeset
101 offset, CompilerToVM::Data::max_oop_map_stack_offset());
23674
09a536b9233c 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23396
diff changeset
102 }
09a536b9233c 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23396
diff changeset
103 assert(OopMapValue::legal_vm_reg_name(vmReg), "illegal VMReg");
09a536b9233c 8158850: [JVMCI] be more precise when enforcing OopMapValue encoding limitations
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23396
diff changeset
104 return vmReg;
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
105 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
106 JVMCI_ERROR_NULL("unaligned stack offset %d in oop map", offset);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
107 }
21982
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
108 }
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
109 }
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
110
21730
b9f9b8af17ff Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21561
diff changeset
111 // creates a HotSpot oop map out of the byte arrays provided by DebugInfo
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
112 OopMap* CodeInstaller::create_oop_map(Handle debug_info, TRAPS) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
113 Handle reference_map = DebugInfo::referenceMap(debug_info);
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
114 if (reference_map.is_null()) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
115 THROW_NULL(vmSymbols::java_lang_NullPointerException());
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
116 }
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
117 if (!reference_map->is_a(HotSpotReferenceMap::klass())) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
118 JVMCI_ERROR_NULL("unknown reference map: %s", reference_map->klass()->signature_name());
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
119 }
21731
df9d2375512a Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21730
diff changeset
120 if (HotSpotReferenceMap::maxRegisterSize(reference_map) > 16) {
df9d2375512a Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21730
diff changeset
121 _has_wide_vector = true;
df9d2375512a Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21730
diff changeset
122 }
21730
b9f9b8af17ff Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21561
diff changeset
123 OopMap* map = new OopMap(_total_frame_size, _parameter_count);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
124 objArrayHandle objects = HotSpotReferenceMap::objects(reference_map);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
125 objArrayHandle derivedBase = HotSpotReferenceMap::derivedBase(reference_map);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
126 typeArrayHandle sizeInBytes = HotSpotReferenceMap::sizeInBytes(reference_map);
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
127 if (objects.is_null() || derivedBase.is_null() || sizeInBytes.is_null()) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
128 THROW_NULL(vmSymbols::java_lang_NullPointerException());
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
129 }
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
130 if (objects->length() != derivedBase->length() || objects->length() != sizeInBytes->length()) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
131 JVMCI_ERROR_NULL("arrays in reference map have different sizes: %d %d %d", objects->length(), derivedBase->length(), sizeInBytes->length());
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
132 }
21730
b9f9b8af17ff Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21561
diff changeset
133 for (int i = 0; i < objects->length(); i++) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
134 Handle location = objects->obj_at(i);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
135 Handle baseLocation = derivedBase->obj_at(i);
21982
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
136 int bytes = sizeInBytes->int_at(i);
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
137
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
138 VMReg vmReg = getVMRegFromLocation(location, _total_frame_size, CHECK_NULL);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
139 if (baseLocation.not_null()) {
21982
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
140 // derived oop
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
141 #ifdef _LP64
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
142 if (bytes == 8) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
143 #else
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
144 if (bytes == 4) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
145 #endif
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
146 VMReg baseReg = getVMRegFromLocation(baseLocation, _total_frame_size, CHECK_NULL);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
147 map->set_derived_oop(vmReg, baseReg);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
148 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
149 JVMCI_ERROR_NULL("invalid derived oop size in ReferenceMap: %d", bytes);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
150 }
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
151 #ifdef _LP64
21982
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
152 } else if (bytes == 8) {
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
153 // wide oop
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
154 map->set_oop(vmReg);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
155 } else if (bytes == 4) {
21982
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
156 // narrow oop
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
157 map->set_narrowoop(vmReg);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
158 #else
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
159 } else if (bytes == 4) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
160 map->set_oop(vmReg);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
161 #endif
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
162 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
163 JVMCI_ERROR_NULL("invalid oop size in ReferenceMap: %d", bytes);
21730
b9f9b8af17ff Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21561
diff changeset
164 }
16093
39be5bc00046 Support XMM registers in oop maps.
Roland Schatz <roland.schatz@oracle.com>
parents: 15728
diff changeset
165 }
21982
861108f5408e Support derived references in HotSpotReferenceMap.
Roland Schatz <roland.schatz@oracle.com>
parents: 21731
diff changeset
166
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
167 Handle callee_save_info = (oop) DebugInfo::calleeSaveInfo(debug_info);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
168 if (callee_save_info.not_null()) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
169 objArrayHandle registers = RegisterSaveLayout::registers(callee_save_info);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
170 typeArrayHandle slots = RegisterSaveLayout::slots(callee_save_info);
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: 9192
diff changeset
171 for (jint i = 0; i < slots->length(); i++) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
172 Handle jvmci_reg = registers->obj_at(i);
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
173 jint jvmci_reg_number = code_Register::number(jvmci_reg);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
174 VMReg hotspot_reg = CodeInstaller::get_hotspot_reg(jvmci_reg_number, CHECK_NULL);
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: 9192
diff changeset
175 // HotSpot stack slots are 4 bytes
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
176 jint jvmci_slot = slots->int_at(i);
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
177 jint hotspot_slot = jvmci_slot * VMRegImpl::slots_per_word;
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: 9192
diff changeset
178 VMReg hotspot_slot_as_reg = VMRegImpl::stack2reg(hotspot_slot);
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: 9192
diff changeset
179 map->set_callee_saved(hotspot_slot_as_reg, hotspot_reg);
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: 9192
diff changeset
180 #ifdef _LP64
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: 9192
diff changeset
181 // (copied from generate_oop_map() in c1_Runtime1_x86.cpp)
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: 9192
diff changeset
182 VMReg hotspot_slot_hi_as_reg = VMRegImpl::stack2reg(hotspot_slot + 1);
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: 9192
diff changeset
183 map->set_callee_saved(hotspot_slot_hi_as_reg, hotspot_reg->next());
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: 9192
diff changeset
184 #endif
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: 9192
diff changeset
185 }
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: 9192
diff changeset
186 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
187 return map;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
188 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
189
23767
edf3f2eb3b00 Record metadata_Relocations for metadata references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23709
diff changeset
190 void* CodeInstaller::record_metadata_reference(CodeSection* section, address dest, Handle constant, TRAPS) {
23330
83b296a07c33 Fix wrong pointer cast.
Roland Schatz <roland.schatz@oracle.com>
parents: 23322
diff changeset
191 /*
83b296a07c33 Fix wrong pointer cast.
Roland Schatz <roland.schatz@oracle.com>
parents: 23322
diff changeset
192 * This method needs to return a raw (untyped) pointer, since the value of a pointer to the base
83b296a07c33 Fix wrong pointer cast.
Roland Schatz <roland.schatz@oracle.com>
parents: 23322
diff changeset
193 * class is in general not equal to the pointer of the subclass. When patching metaspace pointers,
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
194 * the compiler expects a direct pointer to the subclass (Klass* or Method*), not a pointer to the
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
195 * base class (Metadata* or MetaspaceObj*).
23330
83b296a07c33 Fix wrong pointer cast.
Roland Schatz <roland.schatz@oracle.com>
parents: 23322
diff changeset
196 */
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
197 oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant);
18223
17c98fad6980 converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18222
diff changeset
198 if (obj->is_a(HotSpotResolvedObjectTypeImpl::klass())) {
17c98fad6980 converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18222
diff changeset
199 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj));
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
200 assert(!HotSpotMetaspaceConstantImpl::compressed(constant), err_msg("unexpected compressed klass pointer %s @ " INTPTR_FORMAT, klass->name()->as_C_string(), p2i(klass)));
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
201 int index = _oop_recorder->find_index(klass);
23767
edf3f2eb3b00 Record metadata_Relocations for metadata references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23709
diff changeset
202 section->relocate(dest, metadata_Relocation::spec(index));
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
203 TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string());
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
204 return klass;
18222
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18196
diff changeset
205 } else if (obj->is_a(HotSpotResolvedJavaMethodImpl::klass())) {
a8cff27ca2e1 converted HotSpotResolvedJavaMethod to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18196
diff changeset
206 Method* method = (Method*) (address) HotSpotResolvedJavaMethodImpl::metaspaceMethod(obj);
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
207 assert(!HotSpotMetaspaceConstantImpl::compressed(constant), err_msg("unexpected compressed method pointer %s @ " INTPTR_FORMAT, method->name()->as_C_string(), p2i(method)));
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
208 int index = _oop_recorder->find_index(method);
23767
edf3f2eb3b00 Record metadata_Relocations for metadata references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23709
diff changeset
209 section->relocate(dest, metadata_Relocation::spec(index));
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
210 TRACE_jvmci_3("metadata[%d of %d] = %s", index, _oop_recorder->metadata_count(), method->name()->as_C_string());
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
211 return method;
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
212 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
213 JVMCI_ERROR_NULL("unexpected metadata reference for constant of type %s", obj->klass()->signature_name());
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
214 }
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
215 }
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
216
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
217 #ifdef _LP64
23767
edf3f2eb3b00 Record metadata_Relocations for metadata references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23709
diff changeset
218 narrowKlass CodeInstaller::record_narrow_metadata_reference(CodeSection* section, address dest, Handle constant, TRAPS) {
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
219 oop obj = HotSpotMetaspaceConstantImpl::metaspaceObject(constant);
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
220 assert(HotSpotMetaspaceConstantImpl::compressed(constant), err_msg("unexpected uncompressed pointer"));
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
221
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
222 if (!obj->is_a(HotSpotResolvedObjectTypeImpl::klass())) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
223 JVMCI_ERROR_0("unexpected compressed pointer of type %s", obj->klass()->signature_name());
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
224 }
15018
db4254246f9a Remove Constant.forObject and Constant.asObject to improve compiler/VM separation
Christian Wimmer <christian.wimmer@oracle.com>
parents: 14729
diff changeset
225
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
226 Klass* klass = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(obj));
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
227 int index = _oop_recorder->find_index(klass);
23767
edf3f2eb3b00 Record metadata_Relocations for metadata references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23709
diff changeset
228 section->relocate(dest, metadata_Relocation::spec(index));
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
229 TRACE_jvmci_3("narrowKlass[%d of %d] = %s", index, _oop_recorder->metadata_count(), klass->name()->as_C_string());
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
230 return Klass::encode_klass(klass);
6996
eec373d34caf added support for annotated Constants and used it to track Klass* values in Graal and register them in the metadata section of a nmethod during code installation
Doug Simon <doug.simon@oracle.com>
parents: 6950
diff changeset
231 }
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
232 #endif
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
233
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
234 Location::Type CodeInstaller::get_oop_type(Handle value) {
23396
9ed5b586018b Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents: 23390
diff changeset
235 Handle valueKind = Value::valueKind(value);
9ed5b586018b Replace LIRKind with abstract base class (JDK-8156942).
Roland Schatz <roland.schatz@oracle.com>
parents: 23390
diff changeset
236 Handle platformKind = ValueKind::platformKind(valueKind);
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
237
22535
ca418f35d728 Use wordKind instead of Kind.Object in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 22533
diff changeset
238 if (platformKind == word_kind()) {
ca418f35d728 Use wordKind instead of Kind.Object in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 22533
diff changeset
239 return Location::oop;
ca418f35d728 Use wordKind instead of Kind.Object in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 22533
diff changeset
240 } else {
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
241 return Location::narrowoop;
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
242 }
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
243 }
16580
a7d9b88ecd68 use LIRKind in graalCodeInstaller, support compressed oops in frame states
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16573
diff changeset
244
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
245 ScopeValue* CodeInstaller::get_scope_value(Handle value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second, TRAPS) {
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
246 second = NULL;
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
247 if (value.is_null()) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
248 THROW_NULL(vmSymbols::java_lang_NullPointerException());
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
249 } else if (value == Value::ILLEGAL()) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
250 if (type != T_ILLEGAL) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
251 JVMCI_ERROR_NULL("unexpected illegal value, expected %s", basictype_to_str(type));
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
252 }
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
253 return _illegal_value;
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
254 } else if (value->is_a(RegisterValue::klass())) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
255 Handle reg = RegisterValue::reg(value);
16996
6ea6d4c260c8 [SPARC/AMD64] Fixing handling of floatingpoint register handling
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16941
diff changeset
256 jint number = code_Register::number(reg);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
257 VMReg hotspotRegister = get_hotspot_reg(number, CHECK_NULL);
17024
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16996
diff changeset
258 if (is_general_purpose_reg(hotspotRegister)) {
16580
a7d9b88ecd68 use LIRKind in graalCodeInstaller, support compressed oops in frame states
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16573
diff changeset
259 Location::Type locationType;
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
260 if (type == T_OBJECT) {
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
261 locationType = get_oop_type(value);
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
262 } else if (type == T_LONG) {
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
263 locationType = Location::lng;
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
264 } else if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
265 locationType = Location::int_in_long;
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
266 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
267 JVMCI_ERROR_NULL("unexpected type %s in cpu register", basictype_to_str(type));
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
268 }
17024
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16996
diff changeset
269 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister));
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
270 if (type == T_LONG) {
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
271 second = value;
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
272 }
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
273 return value;
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
274 } else {
16580
a7d9b88ecd68 use LIRKind in graalCodeInstaller, support compressed oops in frame states
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16573
diff changeset
275 Location::Type locationType;
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
276 if (type == T_FLOAT) {
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
277 // this seems weird, but the same value is used in c1_LinearScan
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
278 locationType = Location::normal;
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
279 } else if (type == T_DOUBLE) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
280 locationType = Location::dbl;
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
281 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
282 JVMCI_ERROR_NULL("unexpected type %s in floating point register", basictype_to_str(type));
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
283 }
17024
4e2d34d7715b [SPARC/AMD64] Splitting up oopmap generation for Intel XMM and SPARC Floatingpoint registers
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 16996
diff changeset
284 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, hotspotRegister));
16589
6bdd2ec553eb handle HotSpotCompressedNullConstant in graalCodeInstaller
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16580
diff changeset
285 if (type == T_DOUBLE) {
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
286 second = value;
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
287 }
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
288 return value;
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
289 }
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
290 } else if (value->is_a(StackSlot::klass())) {
21730
b9f9b8af17ff Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21561
diff changeset
291 jint offset = StackSlot::offset(value);
b9f9b8af17ff Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21561
diff changeset
292 if (StackSlot::addFrameSize(value)) {
b9f9b8af17ff Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21561
diff changeset
293 offset += _total_frame_size;
b9f9b8af17ff Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21561
diff changeset
294 }
b9f9b8af17ff Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21561
diff changeset
295
b9f9b8af17ff Simplify interface to reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21561
diff changeset
296 Location::Type locationType;
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
297 if (type == T_OBJECT) {
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
298 locationType = get_oop_type(value);
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
299 } else if (type == T_LONG) {
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
300 locationType = Location::lng;
16580
a7d9b88ecd68 use LIRKind in graalCodeInstaller, support compressed oops in frame states
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16573
diff changeset
301 } else if (type == T_DOUBLE) {
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
302 locationType = Location::dbl;
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
303 } else if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BYTE || type == T_BOOLEAN) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
304 locationType = Location::normal;
16580
a7d9b88ecd68 use LIRKind in graalCodeInstaller, support compressed oops in frame states
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16573
diff changeset
305 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
306 JVMCI_ERROR_NULL("unexpected type %s in stack slot", basictype_to_str(type));
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
307 }
4181
319860ae697a Simplify FrameMap: make offsets of spill slots and outgoing parameters independent so that they can be allocated at the same time, eliminating the separate phases. This makes the separate StackBlock unnecesary. Change CiStackSlot to use byte offsets instead of spill slot index. This makes CiTarget.spillSlotSize unnecessary.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4174
diff changeset
308 ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset));
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
309 if (type == T_DOUBLE || type == T_LONG) {
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
310 second = value;
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
311 }
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
312 return value;
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
313 } else if (value->is_a(JavaConstant::klass())) {
16580
a7d9b88ecd68 use LIRKind in graalCodeInstaller, support compressed oops in frame states
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16573
diff changeset
314 if (value->is_a(PrimitiveConstant::klass())) {
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
315 if (value->is_a(RawConstant::klass())) {
17084
26f5733fb645 Fix the endianess issue, when using JSR/RET instruction and deoptimization happens in this subroutine
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17024
diff changeset
316 jlong prim = PrimitiveConstant::primitive(value);
26f5733fb645 Fix the endianess issue, when using JSR/RET instruction and deoptimization happens in this subroutine
Stefan Anzinger <stefan.anzinger@oracle.com>
parents: 17024
diff changeset
317 return new ConstantLongValue(prim);
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
318 } else {
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
319 BasicType constantType = JVMCIRuntime::kindToBasicType(PrimitiveConstant::kind(value), CHECK_NULL);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
320 if (type != constantType) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
321 JVMCI_ERROR_NULL("primitive constant type doesn't match, expected %s but got %s", basictype_to_str(type), basictype_to_str(constantType));
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
322 }
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
323 if (type == T_INT || type == T_FLOAT) {
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
324 jint prim = (jint)PrimitiveConstant::primitive(value);
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
325 switch (prim) {
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
326 case -1: return _int_m1_scope_value;
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
327 case 0: return _int_0_scope_value;
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
328 case 1: return _int_1_scope_value;
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
329 case 2: return _int_2_scope_value;
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
330 default: return new ConstantIntValue(prim);
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
331 }
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
332 } else if (type == T_LONG || type == T_DOUBLE) {
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
333 jlong prim = PrimitiveConstant::primitive(value);
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
334 second = _int_1_scope_value;
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
335 return new ConstantLongValue(prim);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
336 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
337 JVMCI_ERROR_NULL("unexpected primitive constant type %s", basictype_to_str(type));
18173
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
338 }
16580
a7d9b88ecd68 use LIRKind in graalCodeInstaller, support compressed oops in frame states
Lukas Stadler <lukas.stadler@oracle.com>
parents: 16573
diff changeset
339 }
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
340 } else if (value->is_a(NullConstant::klass()) || value->is_a(HotSpotCompressedNullConstant::klass())) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
341 if (type == T_OBJECT) {
18173
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
342 return _oop_null_scope_value;
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
343 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
344 JVMCI_ERROR_NULL("unexpected null constant, expected %s", basictype_to_str(type));
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
345 }
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
346 } else if (value->is_a(HotSpotObjectConstantImpl::klass())) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
347 if (type == T_OBJECT) {
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18238
diff changeset
348 oop obj = HotSpotObjectConstantImpl::object(value);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
349 if (obj == NULL) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
350 JVMCI_ERROR_NULL("null value must be in NullConstant");
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
351 }
3669
53636e2c9d03 No longer use shared ciFactory. Remove make_global usage in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3668
diff changeset
352 return new ConstantOopWriteValue(JNIHandles::make_local(obj));
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
353 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
354 JVMCI_ERROR_NULL("unexpected object constant, expected %s", basictype_to_str(type));
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
355 }
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
356 }
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
357 } else if (value->is_a(VirtualObject::klass())) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
358 if (type == T_OBJECT) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
359 int id = VirtualObject::id(value);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
360 if (0 <= id && id < objects->length()) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
361 ScopeValue* object = objects->at(id);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
362 if (object != NULL) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
363 return object;
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
364 }
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
365 }
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
366 JVMCI_ERROR_NULL("unknown virtual object id %d", id);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
367 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
368 JVMCI_ERROR_NULL("unexpected virtual object, expected %s", basictype_to_str(type));
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
369 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
370 }
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
371
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
372 JVMCI_ERROR_NULL("unexpected value in scope: %s", value->klass()->signature_name())
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
373 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
374
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
375 void CodeInstaller::record_object_value(ObjectValue* sv, Handle value, GrowableArray<ScopeValue*>* objects, TRAPS) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
376 Handle type = VirtualObject::type(value);
20044
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
377 int id = VirtualObject::id(value);
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
378 oop javaMirror = HotSpotResolvedObjectTypeImpl::javaClass(type);
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
379 Klass* klass = java_lang_Class::as_Klass(javaMirror);
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
380 bool isLongArray = klass == Universe::longArrayKlassObj();
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
381
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
382 objArrayHandle values = VirtualObject::values(value);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
383 objArrayHandle slotKinds = VirtualObject::slotKinds(value);
20044
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
384 for (jint i = 0; i < values->length(); i++) {
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
385 ScopeValue* cur_second = NULL;
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
386 Handle object = values->obj_at(i);
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
387 BasicType type = JVMCIRuntime::kindToBasicType(slotKinds->obj_at(i), CHECK);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
388 ScopeValue* value = get_scope_value(object, type, objects, cur_second, CHECK);
20044
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
389
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
390 if (isLongArray && cur_second == NULL) {
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
391 // we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations.
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
392 // add an int 0 constant
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
393 cur_second = _int_0_scope_value;
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
394 }
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
395
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
396 if (cur_second != NULL) {
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
397 sv->field_values()->append(cur_second);
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
398 }
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
399 assert(value != NULL, "missing value");
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
400 sv->field_values()->append(value);
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
401 }
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
402 }
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
403
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
404 MonitorValue* CodeInstaller::get_monitor_value(Handle value, GrowableArray<ScopeValue*>* objects, TRAPS) {
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
405 if (value.is_null()) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
406 THROW_NULL(vmSymbols::java_lang_NullPointerException());
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
407 }
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
408 if (!value->is_a(StackLockValue::klass())) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
409 JVMCI_ERROR_NULL("Monitors must be of type StackLockValue, got %s", value->klass()->signature_name());
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
410 }
3714
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
411
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
412 ScopeValue* second = NULL;
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
413 ScopeValue* owner_value = get_scope_value(StackLockValue::owner(value), T_OBJECT, objects, second, CHECK_NULL);
3714
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
414 assert(second == NULL, "monitor cannot occupy two stack slots");
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
415
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
416 ScopeValue* lock_data_value = get_scope_value(StackLockValue::slot(value), T_LONG, objects, second, CHECK_NULL);
4174
79c91d220d73 Use callee save area to model the saved rbp register. Remove various hacks that added the saved area size in native code.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 3717
diff changeset
417 assert(second == lock_data_value, "monitor is LONG value that occupies two stack slots");
3714
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
418 assert(lock_data_value->is_location(), "invalid monitor location");
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
419 Location lock_data_loc = ((LocationValue*)lock_data_value)->location();
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
420
3717
4177ddd2d1d1 Fix build error for Windows builds
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3714
diff changeset
421 bool eliminated = false;
19602
b6beb2161e7a Move stack monitor value into api.code
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19426
diff changeset
422 if (StackLockValue::eliminated(value)) {
3717
4177ddd2d1d1 Fix build error for Windows builds
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3714
diff changeset
423 eliminated = true;
4177ddd2d1d1 Fix build error for Windows builds
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3714
diff changeset
424 }
3714
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
425
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
426 return new MonitorValue(owner_value, lock_data_loc, eliminated);
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
427 }
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
428
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
429 void CodeInstaller::initialize_dependencies(oop compiled_code, TRAPS) {
18226
6eda3b299460 Record compilation dependencies with +LogCompilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18196
diff changeset
430 JavaThread* thread = JavaThread::current();
6eda3b299460 Record compilation dependencies with +LogCompilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18196
diff changeset
431 CompilerThread* compilerThread = thread->is_Compiler_thread() ? thread->as_CompilerThread() : NULL;
17377
44b83285b645 Deduplicate constant oops during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17335
diff changeset
432 _oop_recorder = new OopRecorder(&_arena, true);
18226
6eda3b299460 Record compilation dependencies with +LogCompilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18196
diff changeset
433 _dependencies = new Dependencies(&_arena, _oop_recorder, compilerThread != NULL ? compilerThread->log() : NULL);
22780
b4ff1a18d19c Move data fields from CompiledCode to HotSpotCompiledCode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 22773
diff changeset
434 objArrayHandle assumptions = HotSpotCompiledCode::assumptions(compiled_code);
19251
063e8873bd14 changed type of assumptions field in CompilationResult from Assumptions to Assumption[]
Doug Simon <doug.simon@oracle.com>
parents: 18950
diff changeset
435 if (!assumptions.is_null()) {
3670
f198b24093f3 put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3669
diff changeset
436 int length = assumptions->length();
f198b24093f3 put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3669
diff changeset
437 for (int i = 0; i < length; ++i) {
3672
5e331d5f760e removed transition to vm in ci interface
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3670
diff changeset
438 Handle assumption = assumptions->obj_at(i);
5e331d5f760e removed transition to vm in ci interface
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3670
diff changeset
439 if (!assumption.is_null()) {
19306
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19251
diff changeset
440 if (assumption->klass() == Assumptions_NoFinalizableSubclass::klass()) {
9012
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 9004
diff changeset
441 assumption_NoFinalizableSubclass(assumption);
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
442 } else if (assumption->klass() == Assumptions_ConcreteSubtype::klass()) {
3672
5e331d5f760e removed transition to vm in ci interface
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3670
diff changeset
443 assumption_ConcreteSubtype(assumption);
19801
deab43a789ad Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19739
diff changeset
444 } else if (assumption->klass() == Assumptions_LeafType::klass()) {
deab43a789ad Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19739
diff changeset
445 assumption_LeafType(assumption);
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
446 } else if (assumption->klass() == Assumptions_ConcreteMethod::klass()) {
3672
5e331d5f760e removed transition to vm in ci interface
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3670
diff changeset
447 assumption_ConcreteMethod(assumption);
8947
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 8589
diff changeset
448 } else if (assumption->klass() == Assumptions_CallSiteTargetValue::klass()) {
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 8589
diff changeset
449 assumption_CallSiteTargetValue(assumption);
3657
47edfca346ab Fix a safepoint bug in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
450 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
451 JVMCI_ERROR("unexpected Assumption subclass %s", assumption->klass()->signature_name());
3657
47edfca346ab Fix a safepoint bug in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
452 }
47edfca346ab Fix a safepoint bug in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
453 }
47edfca346ab Fix a safepoint bug in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
454 }
47edfca346ab Fix a safepoint bug in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
455 }
22702
15013021dbfa only install evol_method dependencies if JVMTI needs them
Doug Simon <doug.simon@oracle.com>
parents: 22650
diff changeset
456 if (JvmtiExport::can_hotswap_or_post_breakpoint()) {
22780
b4ff1a18d19c Move data fields from CompiledCode to HotSpotCompiledCode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 22773
diff changeset
457 objArrayHandle methods = HotSpotCompiledCode::methods(compiled_code);
22702
15013021dbfa only install evol_method dependencies if JVMTI needs them
Doug Simon <doug.simon@oracle.com>
parents: 22650
diff changeset
458 if (!methods.is_null()) {
15013021dbfa only install evol_method dependencies if JVMTI needs them
Doug Simon <doug.simon@oracle.com>
parents: 22650
diff changeset
459 int length = methods->length();
15013021dbfa only install evol_method dependencies if JVMTI needs them
Doug Simon <doug.simon@oracle.com>
parents: 22650
diff changeset
460 for (int i = 0; i < length; ++i) {
15013021dbfa only install evol_method dependencies if JVMTI needs them
Doug Simon <doug.simon@oracle.com>
parents: 22650
diff changeset
461 Handle method_handle = methods->obj_at(i);
15013021dbfa only install evol_method dependencies if JVMTI needs them
Doug Simon <doug.simon@oracle.com>
parents: 22650
diff changeset
462 methodHandle method = getMethodFromHotSpotMethod(method_handle());
15013021dbfa only install evol_method dependencies if JVMTI needs them
Doug Simon <doug.simon@oracle.com>
parents: 22650
diff changeset
463 _dependencies->assert_evol_method(method());
15013021dbfa only install evol_method dependencies if JVMTI needs them
Doug Simon <doug.simon@oracle.com>
parents: 22650
diff changeset
464 }
19306
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19251
diff changeset
465 }
a0a760b0fb5f pulled method evolution dependencies out of Assumptions and directly into StructuredGraph
Doug Simon <doug.simon@oracle.com>
parents: 19251
diff changeset
466 }
3668
46f211fe010c Removed global handle usage in ci interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3667
diff changeset
467 }
46f211fe010c Removed global handle usage in ci interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3667
diff changeset
468
46f211fe010c Removed global handle usage in ci interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3667
diff changeset
469 // constructor used to create a method
22728
eb2091fcd682 Pass Handle per value.
Roland Schatz <roland.schatz@oracle.com>
parents: 22722
diff changeset
470 JVMCIEnv::CodeInstallResult CodeInstaller::install(JVMCICompiler* compiler, Handle target, Handle compiled_code, CodeBlob*& cb, Handle installed_code, Handle speculation_log, TRAPS) {
22538
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
471 CodeBuffer buffer("JVMCI Compiler CodeBuffer");
9669
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9654
diff changeset
472 jobject compiled_code_obj = JNIHandles::make_local(compiled_code());
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
473 initialize_dependencies(JNIHandles::resolve(compiled_code_obj), CHECK_OK);
1465
2c754f3a2722 Inlining of static final field values. Java mirror instead of VmID. Support for PrintMetrics option.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1462
diff changeset
474
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10540
diff changeset
475 // Get instructions and constants CodeSections early because we need it.
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10540
diff changeset
476 _instructions = buffer.insts();
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10540
diff changeset
477 _constants = buffer.consts();
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10540
diff changeset
478
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
479 initialize_fields(target(), JNIHandles::resolve(compiled_code_obj), CHECK_OK);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
480 JVMCIEnv::CodeInstallResult result = initialize_buffer(buffer, CHECK_OK);
22538
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
481 if (result != JVMCIEnv::ok) {
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
482 return result;
3664
6e1abd79e7c8 Register assumptions before anything else. Don't free code blob (it is reused).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3663
diff changeset
483 }
6e1abd79e7c8 Register assumptions before anything else. Don't free code blob (it is reused).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3663
diff changeset
484
4174
79c91d220d73 Use callee save area to model the saved rbp register. Remove various hacks that added the saved area size in native code.
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 3717
diff changeset
485 int stack_slots = _total_frame_size / HeapWordSize; // conversion to words
4319
3c21eee8ab4d Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents: 4232
diff changeset
486
21526
1da7aef31a08 created com.oracle.graal.hotspot.jvmci package and moved classes destined for future JVMCI module into it (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21030
diff changeset
487 if (!compiled_code->is_a(HotSpotCompiledNmethod::klass())) {
22780
b4ff1a18d19c Move data fields from CompiledCode to HotSpotCompiledCode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 22773
diff changeset
488 oop stubName = HotSpotCompiledCode::name(compiled_code_obj);
9669
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9654
diff changeset
489 char* name = strdup(java_lang_String::as_utf8_string(stubName));
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: 9192
diff changeset
490 cb = RuntimeStub::new_runtime_stub(name,
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: 9192
diff changeset
491 &buffer,
0266549ff6e0 added support from compiled stubs to be installed as RuntimeStubs and to be able to directly call C/C++ runtime functions (GRAAL-81)
Doug Simon <doug.simon@oracle.com>
parents: 9192
diff changeset
492 CodeOffsets::frame_never_safe,
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: 9192
diff changeset
493 stack_slots,
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: 9192
diff changeset
494 _debug_recorder->_oopmaps,
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: 9192
diff changeset
495 false);
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
496 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: 9192
diff changeset
497 } 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: 9192
diff changeset
498 nmethod* nm = NULL;
9669
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9654
diff changeset
499 methodHandle method = getMethodFromHotSpotMethod(HotSpotCompiledNmethod::method(compiled_code));
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9654
diff changeset
500 jint entry_bci = HotSpotCompiledNmethod::entryBCI(compiled_code);
13630
b1838411e896 Use compile ids assigned by hotspot
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13576
diff changeset
501 jint id = HotSpotCompiledNmethod::id(compiled_code);
22147
32434ca987d7 fixed Windows build issues
Doug Simon <doug.simon@oracle.com>
parents: 22134
diff changeset
502 bool has_unsafe_access = HotSpotCompiledNmethod::hasUnsafeAccess(compiled_code) == JNI_TRUE;
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
503 JVMCIEnv* env = (JVMCIEnv*) (address) HotSpotCompiledNmethod::jvmciEnv(compiled_code);
13816
d006a6332db8 Make sure a compile id is assigned
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13726
diff changeset
504 if (id == -1) {
d006a6332db8 Make sure a compile id is assigned
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13726
diff changeset
505 // Make sure a valid compile_id is associated with every compile
13969
fe034af88233 Acquire proper locks before calling assign_compile_id
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13816
diff changeset
506 id = CompileBroker::assign_compile_id_unlocked(Thread::current(), method, entry_bci);
13816
d006a6332db8 Make sure a compile id is assigned
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 13726
diff changeset
507 }
23299
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
508 result = JVMCIEnv::register_method(method, nm, entry_bci, &_offsets, _orig_pc_offset, &buffer,
21731
df9d2375512a Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21730
diff changeset
509 stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table,
22650
939d5da65929 reduced delta against jvmci-9
Doug Simon <doug.simon@oracle.com>
parents: 22592
diff changeset
510 compiler, _debug_recorder, _dependencies, env, id,
22147
32434ca987d7 fixed Windows build issues
Doug Simon <doug.simon@oracle.com>
parents: 22134
diff changeset
511 has_unsafe_access, _has_wide_vector, installed_code, compiled_code, 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: 9192
diff changeset
512 cb = nm;
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: 9192
diff changeset
513 }
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10540
diff changeset
514
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10540
diff changeset
515 if (cb != NULL) {
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10540
diff changeset
516 // Make sure the pre-calculated constants section size was correct.
18238
4221c8332c34 Remove unnecessary padding in constants section.
Roland Schatz <roland.schatz@oracle.com>
parents: 18229
diff changeset
517 guarantee((cb->code_begin() - cb->content_begin()) >= _constants_size, err_msg("%d < %d", (int)(cb->code_begin() - cb->content_begin()), _constants_size));
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10540
diff changeset
518 }
13493
03bb0ee05409 made CodeInstaller subclassable and virtualized the methods for creating ScopeValues
Doug Simon <doug.simon@oracle.com>
parents: 13261
diff changeset
519 return result;
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
520 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
521
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
522 void CodeInstaller::initialize_fields(oop target, oop compiled_code, TRAPS) {
9669
ed6202820ecf renamed HotSpotCompilationResult to HotSpotCompiledCode and added subclasses HotSpotCompiledNmethod and HotSpotCompiledRuntimeStub
Doug Simon <doug.simon@oracle.com>
parents: 9654
diff changeset
523 if (compiled_code->is_a(HotSpotCompiledNmethod::klass())) {
17241
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
524 Handle hotspotJavaMethod = HotSpotCompiledNmethod::method(compiled_code);
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
525 methodHandle method = getMethodFromHotSpotMethod(hotspotJavaMethod());
5839
58a607307306 renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
526 _parameter_count = method->size_of_parameters();
22482
da68ca58b271 Adjust meaning of TraceJVMCI levels
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22478
diff changeset
527 TRACE_jvmci_2("installing code for %s", method->name_and_sig_as_C_string());
9654
18632807db02 RuntimeStub installation support is now more distinct from normal nmethod installation
Doug Simon <doug.simon@oracle.com>
parents: 9359
diff changeset
528 } else {
22551
71ea8d7db665 removed author tags in comments
Doug Simon <doug.simon@oracle.com>
parents: 22548
diff changeset
529 // Must be a HotSpotCompiledRuntimeStub.
71ea8d7db665 removed author tags in comments
Doug Simon <doug.simon@oracle.com>
parents: 22548
diff changeset
530 // Only used in OopMap constructor for non-product builds
9654
18632807db02 RuntimeStub installation support is now more distinct from normal nmethod installation
Doug Simon <doug.simon@oracle.com>
parents: 9359
diff changeset
531 _parameter_count = 0;
3660
c805dfba251d Fixed regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3659
diff changeset
532 }
22780
b4ff1a18d19c Move data fields from CompiledCode to HotSpotCompiledCode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 22773
diff changeset
533 _sites_handle = JNIHandles::make_local(HotSpotCompiledCode::sites(compiled_code));
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
534
22780
b4ff1a18d19c Move data fields from CompiledCode to HotSpotCompiledCode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 22773
diff changeset
535 _code_handle = JNIHandles::make_local(HotSpotCompiledCode::targetCode(compiled_code));
b4ff1a18d19c Move data fields from CompiledCode to HotSpotCompiledCode
Christian Wimmer <christian.wimmer@oracle.com>
parents: 22773
diff changeset
536 _code_size = HotSpotCompiledCode::targetCodeSize(compiled_code);
21506
5cbaf1e9ff2e Remove reference to CompilationResult from HotSpotCompiledCode.
Roland Schatz <roland.schatz@oracle.com>
parents: 21030
diff changeset
537 _total_frame_size = HotSpotCompiledCode::totalFrameSize(compiled_code);
23299
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
538
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
539 oop deoptRescueSlot = HotSpotCompiledCode::deoptRescueSlot(compiled_code);
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
540 if (deoptRescueSlot == NULL) {
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
541 _orig_pc_offset = -1;
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
542 } else {
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
543 _orig_pc_offset = StackSlot::offset(deoptRescueSlot);
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
544 if (StackSlot::addFrameSize(deoptRescueSlot)) {
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
545 _orig_pc_offset += _total_frame_size;
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
546 }
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
547 if (_orig_pc_offset < 0) {
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
548 JVMCI_ERROR("invalid deopt rescue slot: %d", _orig_pc_offset);
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
549 }
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
550 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
551
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10540
diff changeset
552 // Pre-calculate the constants section size. This is required for PC-relative addressing.
17335
508e88b5f1d3 Don't hang onto code install references after install finished
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17241
diff changeset
553 _data_section_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSection(compiled_code));
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
554 if ((_constants->alignment() % HotSpotCompiledCode::dataSectionAlignment(compiled_code)) != 0) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
555 JVMCI_ERROR("invalid data section alignment: %d", HotSpotCompiledCode::dataSectionAlignment(compiled_code));
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
556 }
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 18174
diff changeset
557 _constants_size = data_section()->length();
10684
6ff467cdb105 Code installer changes for SPARC.
twisti
parents: 10540
diff changeset
558
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 18174
diff changeset
559 _data_section_patches_handle = JNIHandles::make_local(HotSpotCompiledCode::dataSectionPatches(compiled_code));
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 18174
diff changeset
560
9807
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9740
diff changeset
561 #ifndef PRODUCT
18172
c59612b9d110 Use arrayOop subclasses in graalJavaAccess
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18043
diff changeset
562 _comments_handle = JNIHandles::make_local(HotSpotCompiledCode::comments(compiled_code));
9807
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9740
diff changeset
563 #endif
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
564
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
565 _next_call_type = INVOKE_INVALID;
21731
df9d2375512a Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21730
diff changeset
566
df9d2375512a Track max live register value in reference map
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 21730
diff changeset
567 _has_wide_vector = false;
22535
ca418f35d728 Use wordKind instead of Kind.Object in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 22533
diff changeset
568
ca418f35d728 Use wordKind instead of Kind.Object in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 22533
diff changeset
569 oop arch = TargetDescription::arch(target);
ca418f35d728 Use wordKind instead of Kind.Object in backend.
Roland Schatz <roland.schatz@oracle.com>
parents: 22533
diff changeset
570 _word_kind_handle = JNIHandles::make_local(Architecture::wordKind(arch));
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
571 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
572
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
573 int CodeInstaller::estimate_stubs_size(TRAPS) {
15046
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
574 // Estimate the number of static call stubs that might be emitted.
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
575 int static_call_stubs = 0;
17241
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
576 objArrayOop sites = this->sites();
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
577 for (int i = 0; i < sites->length(); i++) {
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
578 oop site = sites->obj_at(i);
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
579 if (site != NULL && site->is_a(site_Mark::klass())) {
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
580 oop id_obj = site_Mark::id(site);
15046
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
581 if (id_obj != NULL) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
582 if (!java_lang_boxing_object::is_instance(id_obj, T_INT)) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
583 JVMCI_ERROR_0("expected Integer id, got %s", id_obj->klass()->signature_name());
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
584 }
15046
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
585 jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT));
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
586 if (id == INVOKESTATIC || id == INVOKESPECIAL) {
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
587 static_call_stubs++;
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
588 }
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
589 }
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
590 }
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
591 }
22538
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
592 return static_call_stubs * CompiledStaticCall::to_interp_stub_size();
15046
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
593 }
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
594
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
595 // perform data and call relocation on the CodeBuffer
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
596 JVMCIEnv::CodeInstallResult CodeInstaller::initialize_buffer(CodeBuffer& buffer, TRAPS) {
17241
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
597 HandleMark hm;
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
598 objArrayHandle sites = this->sites();
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
599 int locs_buffer_size = sites->length() * (relocInfo::length_limit + sizeof(relocInfo));
22538
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
600
15046
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
601 // Allocate enough space in the stub section for the static call
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
602 // stubs. Stubs have extra relocs but they are managed by the stub
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
603 // section itself so they don't need to be accounted for in the
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
604 // locs_buffer above.
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
605 int stubs_size = estimate_stubs_size(CHECK_OK);
22538
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
606 int total_size = round_to(_code_size, buffer.insts()->alignment()) + round_to(_constants_size, buffer.consts()->alignment()) + round_to(stubs_size, buffer.stubs()->alignment());
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
607
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
608 if (total_size > JVMCINMethodSizeLimit) {
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
609 return JVMCIEnv::code_too_large;
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
610 }
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
611
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
612 buffer.initialize(total_size, locs_buffer_size);
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
613 if (buffer.blob() == NULL) {
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
614 return JVMCIEnv::cache_full;
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
615 }
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
616 buffer.initialize_stubs_size(stubs_size);
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1484
diff changeset
617 buffer.initialize_consts_size(_constants_size);
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1484
diff changeset
618
7094
eec7173947a1 removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents: 7093
diff changeset
619 _debug_recorder = new DebugInformationRecorder(_oop_recorder);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
620 _debug_recorder->set_oopmaps(new OopMapSet());
8947
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 8589
diff changeset
621
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
622 buffer.initialize_oop_recorder(_oop_recorder);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
623
18196
ff1f1481b367 Fix bug in code installer.
Roland Schatz <roland.schatz@oracle.com>
parents: 18187
diff changeset
624 // copy the constant data into the newly created CodeBuffer
ff1f1481b367 Fix bug in code installer.
Roland Schatz <roland.schatz@oracle.com>
parents: 18187
diff changeset
625 address end_data = _constants->start() + _constants_size;
ff1f1481b367 Fix bug in code installer.
Roland Schatz <roland.schatz@oracle.com>
parents: 18187
diff changeset
626 memcpy(_constants->start(), data_section()->base(T_BYTE), _constants_size);
ff1f1481b367 Fix bug in code installer.
Roland Schatz <roland.schatz@oracle.com>
parents: 18187
diff changeset
627 _constants->set_end(end_data);
ff1f1481b367 Fix bug in code installer.
Roland Schatz <roland.schatz@oracle.com>
parents: 18187
diff changeset
628
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
629 // copy the code into the newly created CodeBuffer
10540
0ba44a5a8420 Add sanity check to avoid overwriting the reserved code buffer for very large methods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10410
diff changeset
630 address end_pc = _instructions->start() + _code_size;
22538
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
631 guarantee(_instructions->allocates2(end_pc), "initialize should have reserved enough space for all the code");
18196
ff1f1481b367 Fix bug in code installer.
Roland Schatz <roland.schatz@oracle.com>
parents: 18187
diff changeset
632 memcpy(_instructions->start(), code()->base(T_BYTE), _code_size);
10540
0ba44a5a8420 Add sanity check to avoid overwriting the reserved code buffer for very large methods.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 10410
diff changeset
633 _instructions->set_end(end_pc);
18855
82e5b5ccdb0c fix format string
Doug Simon <doug.simon@oracle.com>
parents: 18661
diff changeset
634
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 18174
diff changeset
635 for (int i = 0; i < data_section_patches()->length(); i++) {
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 18174
diff changeset
636 Handle patch = data_section_patches()->obj_at(i);
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
637 if (patch.is_null()) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
638 THROW_(vmSymbols::java_lang_NullPointerException(), JVMCIEnv::ok);
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
639 }
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
640 Handle reference = site_DataPatch::reference(patch);
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
641 if (reference.is_null()) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
642 THROW_(vmSymbols::java_lang_NullPointerException(), JVMCIEnv::ok);
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
643 }
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
644 if (!reference->is_a(site_ConstantReference::klass())) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
645 JVMCI_ERROR_OK("invalid patch in data section: %s", reference->klass()->signature_name());
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
646 }
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
647 Handle constant = site_ConstantReference::constant(reference);
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
648 if (constant.is_null()) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
649 THROW_(vmSymbols::java_lang_NullPointerException(), JVMCIEnv::ok);
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
650 }
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
651 address dest = _constants->start() + site_Site::pcOffset(patch);
18266
ae181ec869c5 converted HotSpotMetaspaceConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18262
diff changeset
652 if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
653 if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
654 #ifdef _LP64
23767
edf3f2eb3b00 Record metadata_Relocations for metadata references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23709
diff changeset
655 *((narrowKlass*) dest) = record_narrow_metadata_reference(_constants, dest, constant, CHECK_OK);
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
656 #else
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
657 JVMCI_ERROR_OK("unexpected compressed Klass* in 32-bit mode");
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
658 #endif
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
659 } else {
23767
edf3f2eb3b00 Record metadata_Relocations for metadata references
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23709
diff changeset
660 *((void**) dest) = record_metadata_reference(_constants, dest, constant, CHECK_OK);
22590
3f6488b29c1a Remove rawValue from HotSpotMetaspaceConstantImpl, patch raw pointer at code installation time.
Roland Schatz <roland.schatz@oracle.com>
parents: 22556
diff changeset
661 }
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18238
diff changeset
662 } else if (constant->is_a(HotSpotObjectConstantImpl::klass())) {
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18238
diff changeset
663 Handle obj = HotSpotObjectConstantImpl::object(constant);
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
664 jobject value = JNIHandles::make_local(obj());
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
665 int oop_index = _oop_recorder->find_index(value);
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 13493
diff changeset
666
18262
f7d45e2426d4 converted HotSpotObjectConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18238
diff changeset
667 if (HotSpotObjectConstantImpl::compressed(constant)) {
18177
89f97291c3a5 Hotspot: Support narrow oop relocations in constants section.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
668 #ifdef _LP64
89f97291c3a5 Hotspot: Support narrow oop relocations in constants section.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
669 _constants->relocate(dest, oop_Relocation::spec(oop_index), relocInfo::narrow_oop_in_const);
89f97291c3a5 Hotspot: Support narrow oop relocations in constants section.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
670 #else
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
671 JVMCI_ERROR_OK("unexpected compressed oop in 32-bit mode");
18177
89f97291c3a5 Hotspot: Support narrow oop relocations in constants section.
Roland Schatz <roland.schatz@oracle.com>
parents: 18176
diff changeset
672 #endif
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 18174
diff changeset
673 } else {
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 18174
diff changeset
674 _constants->relocate(dest, oop_Relocation::spec(oop_index));
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 18174
diff changeset
675 }
14729
8db730993642 check that data patches are of the expected type
Doug Simon <doug.simon@oracle.com>
parents: 14583
diff changeset
676 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
677 JVMCI_ERROR_OK("invalid constant in data section: %s", constant->klass()->signature_name());
13576
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 13493
diff changeset
678 }
4e679d50ba9a Move data section building code to Java.
Roland Schatz <roland.schatz@oracle.com>
parents: 13493
diff changeset
679 }
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
680 jint last_pc_offset = -1;
17241
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
681 for (int i = 0; i < sites->length(); i++) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
682 Handle site = sites->obj_at(i);
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
683 if (site.is_null()) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
684 THROW_(vmSymbols::java_lang_NullPointerException(), JVMCIEnv::ok);
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
685 }
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
686
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
687 jint pc_offset = site_Site::pcOffset(site);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
688
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
689 if (site->is_a(site_Call::klass())) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
690 TRACE_jvmci_4("call at %i", pc_offset);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
691 site_Call(buffer, pc_offset, site, CHECK_OK);
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
692 } else if (site->is_a(site_Infopoint::klass())) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
693 // three reasons for infopoints denote actual safepoints
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
694 oop reason = site_Infopoint::reason(site);
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
695 if (site_InfopointReason::SAFEPOINT() == reason || site_InfopointReason::CALL() == reason || site_InfopointReason::IMPLICIT_EXCEPTION() == reason) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
696 TRACE_jvmci_4("safepoint at %i", pc_offset);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
697 site_Safepoint(buffer, pc_offset, site, CHECK_OK);
23299
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
698 if (_orig_pc_offset < 0) {
23305
b057a49aa52a Typo in jvmciCodeInstaller.cpp
Roland Schatz <roland.schatz@oracle.com>
parents: 23299
diff changeset
699 JVMCI_ERROR_OK("method contains safepoint, but has no deopt rescue slot");
23299
805d58f2cd8c Use explicit StackSlot instead of int offset for the deopt rescue slot.
Roland Schatz <roland.schatz@oracle.com>
parents: 22780
diff changeset
700 }
22739
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
701 } else {
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
702 TRACE_jvmci_4("infopoint at %i", pc_offset);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
703 site_Infopoint(buffer, pc_offset, site, CHECK_OK);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
704 }
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
705 } else if (site->is_a(site_DataPatch::klass())) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
706 TRACE_jvmci_4("datapatch at %i", pc_offset);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
707 site_DataPatch(buffer, pc_offset, site, CHECK_OK);
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
708 } else if (site->is_a(site_Mark::klass())) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
709 TRACE_jvmci_4("mark at %i", pc_offset);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
710 site_Mark(buffer, pc_offset, site, CHECK_OK);
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
711 } else if (site->is_a(site_ExceptionHandler::klass())) {
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
712 TRACE_jvmci_4("exceptionhandler at %i", pc_offset);
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
713 site_ExceptionHandler(pc_offset, site);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
714 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
715 JVMCI_ERROR_OK("unexpected site subclass: %s", site->klass()->signature_name());
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
716 }
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
717 last_pc_offset = pc_offset;
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
718
17241
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
719 if (CodeInstallSafepointChecks && SafepointSynchronize::do_call_back()) {
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
720 // this is a hacky way to force a safepoint check but nothing else was jumping out at me.
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
721 ThreadToNativeFromVM ttnfv(JavaThread::current());
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
722 }
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
723 }
9807
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9740
diff changeset
724
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9740
diff changeset
725 #ifndef PRODUCT
17241
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
726 if (comments() != NULL) {
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
727 for (int i = 0; i < comments()->length(); i++) {
6fcb6691fe5f Add safepoint checks during code installation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 17084
diff changeset
728 oop comment = comments()->obj_at(i);
9807
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9740
diff changeset
729 assert(comment->is_a(HotSpotCompiledCode_Comment::klass()), "cce");
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9740
diff changeset
730 jint offset = HotSpotCompiledCode_Comment::pcOffset(comment);
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9740
diff changeset
731 char* text = java_lang_String::as_utf8_string(HotSpotCompiledCode_Comment::text(comment));
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9740
diff changeset
732 buffer.block_comment(offset, text);
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9740
diff changeset
733 }
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9740
diff changeset
734 }
d552919fbb05 Graal's code annotations are installed into codeBlobs and are thus included in disassembler output (in a non-PRODUCT build)
Doug Simon <doug.simon@oracle.com>
parents: 9740
diff changeset
735 #endif
22538
ea6d1727fdc6 Remove BufferBlob from JavaThread and allocate as needed during compilation
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 22536
diff changeset
736 return JVMCIEnv::ok;
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
737 }
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
738
9012
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 9004
diff changeset
739 void CodeInstaller::assumption_NoFinalizableSubclass(Handle assumption) {
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 9004
diff changeset
740 Handle receiverType_handle = Assumptions_NoFinalizableSubclass::receiverType(assumption());
18223
17c98fad6980 converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18222
diff changeset
741 Klass* receiverType = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(receiverType_handle));
9012
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 9004
diff changeset
742 _dependencies->assert_has_no_finalizable_subclasses(receiverType);
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 9004
diff changeset
743 }
2979aaac95af assumptions: enable NoFinalizableSubclass assumption
Bernhard Urban <bernhard.urban@jku.at>
parents: 9004
diff changeset
744
3672
5e331d5f760e removed transition to vm in ci interface
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3670
diff changeset
745 void CodeInstaller::assumption_ConcreteSubtype(Handle assumption) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
746 Handle context_handle = Assumptions_ConcreteSubtype::context(assumption());
7094
eec7173947a1 removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents: 7093
diff changeset
747 Handle subtype_handle = Assumptions_ConcreteSubtype::subtype(assumption());
18223
17c98fad6980 converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18222
diff changeset
748 Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle));
17c98fad6980 converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18222
diff changeset
749 Klass* subtype = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(subtype_handle));
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
750
19801
deab43a789ad Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19739
diff changeset
751 assert(context->is_abstract(), "");
deab43a789ad Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19739
diff changeset
752 _dependencies->assert_abstract_with_unique_concrete_subtype(context, subtype);
deab43a789ad Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19739
diff changeset
753 }
deab43a789ad Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19739
diff changeset
754
deab43a789ad Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19739
diff changeset
755 void CodeInstaller::assumption_LeafType(Handle assumption) {
deab43a789ad Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19739
diff changeset
756 Handle context_handle = Assumptions_LeafType::context(assumption());
deab43a789ad Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19739
diff changeset
757 Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle));
deab43a789ad Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19739
diff changeset
758
deab43a789ad Split LeafType off from ConcreteSubtype
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19739
diff changeset
759 _dependencies->assert_leaf_type(context);
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
760 }
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
761
3672
5e331d5f760e removed transition to vm in ci interface
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3670
diff changeset
762 void CodeInstaller::assumption_ConcreteMethod(Handle assumption) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
763 Handle impl_handle = Assumptions_ConcreteMethod::impl(assumption());
7094
eec7173947a1 removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents: 7093
diff changeset
764 Handle context_handle = Assumptions_ConcreteMethod::context(assumption());
eec7173947a1 removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents: 7093
diff changeset
765
3704
342a54994e05 Made C++ changes to reflect changes to CiAssumptions.ConcreteMethod.
Doug Simon <doug.simon@oracle.com>
parents: 3690
diff changeset
766 methodHandle impl = getMethodFromHotSpotMethod(impl_handle());
18223
17c98fad6980 converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18222
diff changeset
767 Klass* context = java_lang_Class::as_Klass(HotSpotResolvedObjectTypeImpl::javaClass(context_handle));
7094
eec7173947a1 removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
Doug Simon <doug.simon@oracle.com>
parents: 7093
diff changeset
768
7101
0778b04fc682 better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents: 7094
diff changeset
769 _dependencies->assert_unique_concrete_method(context, impl());
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
770 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
771
8947
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 8589
diff changeset
772 void CodeInstaller::assumption_CallSiteTargetValue(Handle assumption) {
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 8589
diff changeset
773 Handle callSite = Assumptions_CallSiteTargetValue::callSite(assumption());
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 8589
diff changeset
774 Handle methodHandle = Assumptions_CallSiteTargetValue::methodHandle(assumption());
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 8589
diff changeset
775
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 8589
diff changeset
776 _dependencies->assert_call_site_target_value(callSite(), methodHandle());
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 8589
diff changeset
777 }
707b20dd9512 draft call site target value assumption
Andreas Woess <andreas.woess@jku.at>
parents: 8589
diff changeset
778
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
779 void CodeInstaller::site_ExceptionHandler(jint pc_offset, Handle exc) {
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
780 jint handler_offset = site_ExceptionHandler::handlerPos(exc);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
781
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
782 // Subtable header
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
783 _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0));
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
784
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
785 // Subtable entry
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
786 _exception_handler_table.add_entry(HandlerTableEntry(-1, handler_offset, 0));
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
787 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
788
7154
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
789 // If deoptimization happens, the interpreter should reexecute these bytecodes.
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
790 // This function mainly helps the compilers to set up the reexecute bit.
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
791 static bool bytecode_should_reexecute(Bytecodes::Code code) {
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
792 switch (code) {
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
793 case Bytecodes::_invokedynamic:
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
794 case Bytecodes::_invokevirtual:
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
795 case Bytecodes::_invokeinterface:
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
796 case Bytecodes::_invokespecial:
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
797 case Bytecodes::_invokestatic:
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
798 return false;
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
799 default:
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
800 return true;
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
801 }
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
802 return true;
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
803 }
5d0bb7d52783 changes to support Graal co-existing with the other HotSpot compiler(s) and being used for explicit compilation requests and code installation via the Graal API
Doug Simon <doug.simon@oracle.com>
parents: 7139
diff changeset
804
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
805 GrowableArray<ScopeValue*>* CodeInstaller::record_virtual_objects(Handle debug_info, TRAPS) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
806 objArrayHandle virtualObjects = DebugInfo::virtualObjectMapping(debug_info);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
807 if (virtualObjects.is_null()) {
20044
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
808 return NULL;
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
809 }
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
810 GrowableArray<ScopeValue*>* objects = new GrowableArray<ScopeValue*>(virtualObjects->length(), virtualObjects->length(), NULL);
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
811 // Create the unique ObjectValues
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
812 for (int i = 0; i < virtualObjects->length(); i++) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
813 Handle value = virtualObjects->obj_at(i);
20044
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
814 int id = VirtualObject::id(value);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
815 Handle type = VirtualObject::type(value);
20044
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
816 oop javaMirror = HotSpotResolvedObjectTypeImpl::javaClass(type);
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
817 ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), javaMirror)));
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
818 if (id < 0 || id >= objects->length()) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
819 JVMCI_ERROR_NULL("virtual object id %d out of bounds", id);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
820 }
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
821 if (objects->at(id) != NULL) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
822 JVMCI_ERROR_NULL("duplicate virtual object id %d", id);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
823 }
20044
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
824 objects->at_put(id, sv);
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
825 }
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
826 // All the values which could be referenced by the VirtualObjects
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
827 // exist, so now describe all the VirtualObjects themselves.
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
828 for (int i = 0; i < virtualObjects->length(); i++) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
829 Handle value = virtualObjects->obj_at(i);
20044
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
830 int id = VirtualObject::id(value);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
831 record_object_value(objects->at(id)->as_ObjectValue(), value, objects, CHECK_NULL);
20044
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
832 }
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
833 _debug_recorder->dump_object_pool(objects);
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
834 return objects;
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
835 }
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
836
23984
7139570e01c0 8169938: [AOT] SIGSEGV at ~BufferBlob::vtable chunks
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23767
diff changeset
837 void CodeInstaller::record_scope(jint pc_offset, Handle debug_info, ScopeMode scope_mode, bool return_oop, TRAPS) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
838 Handle position = DebugInfo::bytecodePosition(debug_info);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
839 if (position.is_null()) {
20044
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
840 // Stubs do not record scope info, just oop maps
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
841 return;
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
842 }
22478
822922922f3c Explicitly store slot kinds in DebugInfo.
Roland Schatz <roland.schatz@oracle.com>
parents: 22454
diff changeset
843
22739
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
844 GrowableArray<ScopeValue*>* objectMapping;
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
845 if (scope_mode == CodeInstaller::FullFrame) {
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
846 objectMapping = record_virtual_objects(debug_info, CHECK);
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
847 } else {
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
848 objectMapping = NULL;
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
849 }
23984
7139570e01c0 8169938: [AOT] SIGSEGV at ~BufferBlob::vtable chunks
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23767
diff changeset
850 record_scope(pc_offset, position, scope_mode, objectMapping, return_oop, CHECK);
20044
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
851 }
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
852
23984
7139570e01c0 8169938: [AOT] SIGSEGV at ~BufferBlob::vtable chunks
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23767
diff changeset
853 void CodeInstaller::record_scope(jint pc_offset, Handle position, ScopeMode scope_mode, GrowableArray<ScopeValue*>* objects, bool return_oop, TRAPS) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
854 Handle frame;
22739
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
855 if (scope_mode == CodeInstaller::FullFrame) {
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
856 if (!position->is_a(BytecodeFrame::klass())) {
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
857 JVMCI_ERROR("Full frame expected for debug info at %i", pc_offset);
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
858 }
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
859 frame = position;
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
860 }
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
861 Handle caller_frame = BytecodePosition::caller(position);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
862 if (caller_frame.not_null()) {
23984
7139570e01c0 8169938: [AOT] SIGSEGV at ~BufferBlob::vtable chunks
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23767
diff changeset
863 record_scope(pc_offset, caller_frame, scope_mode, objects, return_oop, CHECK);
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
864 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
865
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
866 Handle hotspot_method = BytecodePosition::method(position);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
867 Method* method = getMethodFromHotSpotMethod(hotspot_method());
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
868 jint bci = BytecodePosition::bci(position);
15264
29e3ba750c9e graalCodeInstaller translate BytecodeFrame::BEFORE_BCI into SynchronizationEntryBCI
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
869 if (bci == BytecodeFrame::BEFORE_BCI()) {
29e3ba750c9e graalCodeInstaller translate BytecodeFrame::BEFORE_BCI into SynchronizationEntryBCI
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
870 bci = SynchronizationEntryBCI;
29e3ba750c9e graalCodeInstaller translate BytecodeFrame::BEFORE_BCI into SynchronizationEntryBCI
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 15180
diff changeset
871 }
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
872
22544
b87d1bf3cd9a renamed TraceJVMCI option to JVMCITraceLevel and ensured all tracing controlled by this option uses the TRACE_jvmci_* macros
Doug Simon <doug.simon@oracle.com>
parents: 22538
diff changeset
873 TRACE_jvmci_2("Recording scope pc_offset=%d bci=%d method=%s", pc_offset, bci, method->name_and_sig_as_C_string());
1937
4853c5cad3aa More deoptmization tracing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1936
diff changeset
874
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
875 bool reexecute = false;
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
876 if (frame.not_null()) {
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
877 if (bci == SynchronizationEntryBCI){
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
878 reexecute = false;
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
879 } else {
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
880 Bytecodes::Code code = Bytecodes::java_code_at(method, method->bcp_from(bci));
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
881 reexecute = bytecode_should_reexecute(code);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
882 if (frame.not_null()) {
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
883 reexecute = (BytecodeFrame::duringCall(frame) == JNI_FALSE);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
884 }
5129
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5000
diff changeset
885 }
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5000
diff changeset
886 }
3090
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
887
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
888 DebugToken* locals_token = NULL;
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
889 DebugToken* expressions_token = NULL;
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
890 DebugToken* monitors_token = NULL;
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
891 bool throw_exception = false;
9887
4d5872186e76 Add compressed oops support in Graal/Hotspot site
Christos Kotselidis <christos.kotselidis@oracle.com>
parents: 9807
diff changeset
892
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
893 if (frame.not_null()) {
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
894 jint local_count = BytecodeFrame::numLocals(frame);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
895 jint expression_count = BytecodeFrame::numStack(frame);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
896 jint monitor_count = BytecodeFrame::numLocks(frame);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
897 objArrayHandle values = BytecodeFrame::values(frame);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
898 objArrayHandle slotKinds = BytecodeFrame::slotKinds(frame);
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
899
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
900 if (values.is_null() || slotKinds.is_null()) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
901 THROW(vmSymbols::java_lang_NullPointerException());
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
902 }
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
903 if (local_count + expression_count + monitor_count != values->length()) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
904 JVMCI_ERROR("unexpected values length %d in scope (%d locals, %d expressions, %d monitors)", values->length(), local_count, expression_count, monitor_count);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
905 }
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
906 if (local_count + expression_count != slotKinds->length()) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
907 JVMCI_ERROR("unexpected slotKinds length %d in scope (%d locals, %d expressions)", slotKinds->length(), local_count, expression_count);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
908 }
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
909
18173
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
910 GrowableArray<ScopeValue*>* locals = local_count > 0 ? new GrowableArray<ScopeValue*> (local_count) : NULL;
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
911 GrowableArray<ScopeValue*>* expressions = expression_count > 0 ? new GrowableArray<ScopeValue*> (expression_count) : NULL;
8c079b8d0446 Reduce allocation during scope recording
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 18172
diff changeset
912 GrowableArray<MonitorValue*>* monitors = monitor_count > 0 ? new GrowableArray<MonitorValue*> (monitor_count) : NULL;
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
913
22544
b87d1bf3cd9a renamed TraceJVMCI option to JVMCITraceLevel and ensured all tracing controlled by this option uses the TRACE_jvmci_* macros
Doug Simon <doug.simon@oracle.com>
parents: 22538
diff changeset
914 TRACE_jvmci_2("Scope at bci %d with %d values", bci, values->length());
b87d1bf3cd9a renamed TraceJVMCI option to JVMCITraceLevel and ensured all tracing controlled by this option uses the TRACE_jvmci_* macros
Doug Simon <doug.simon@oracle.com>
parents: 22538
diff changeset
915 TRACE_jvmci_2("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count);
5129
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5000
diff changeset
916
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
917 for (jint i = 0; i < values->length(); i++) {
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
918 ScopeValue* second = NULL;
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
919 Handle value = values->obj_at(i);
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
920 if (i < local_count) {
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
921 BasicType type = JVMCIRuntime::kindToBasicType(slotKinds->obj_at(i), CHECK);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
922 ScopeValue* first = get_scope_value(value, type, objects, second, CHECK);
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
923 if (second != NULL) {
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
924 locals->append(second);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
925 }
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
926 locals->append(first);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
927 } else if (i < local_count + expression_count) {
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
928 BasicType type = JVMCIRuntime::kindToBasicType(slotKinds->obj_at(i), CHECK);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
929 ScopeValue* first = get_scope_value(value, type, objects, second, CHECK);
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
930 if (second != NULL) {
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
931 expressions->append(second);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
932 }
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
933 expressions->append(first);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
934 } else {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
935 MonitorValue *monitor = get_monitor_value(value, objects, CHECK);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
936 monitors->append(monitor);
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
937 }
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
938 if (second != NULL) {
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
939 i++;
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
940 if (i >= values->length() || values->obj_at(i) != Value::ILLEGAL()) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
941 JVMCI_ERROR("double-slot value not followed by Value.ILLEGAL");
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
942 }
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
943 }
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
944 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
945
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
946 locals_token = _debug_recorder->create_scope_values(locals);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
947 expressions_token = _debug_recorder->create_scope_values(expressions);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
948 monitors_token = _debug_recorder->create_monitor_values(monitors);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
949
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
950 throw_exception = BytecodeFrame::rethrowException(frame) == JNI_TRUE;
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
951 }
3018
5857923e563c Fixed an issue with frame states in exception dispatch chains (now we are correctly rethrowing the exception immediately at entering the interpreter).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3011
diff changeset
952
23984
7139570e01c0 8169938: [AOT] SIGSEGV at ~BufferBlob::vtable chunks
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23767
diff changeset
953 _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, return_oop,
20044
c1f116cd4b67 Speed up debug info generation for virtual objects
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 19801
diff changeset
954 locals_token, expressions_token, monitors_token);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
955 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
956
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
957 void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
958 Handle debug_info = site_Infopoint::debugInfo(site);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
959 if (debug_info.is_null()) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
960 JVMCI_ERROR("debug info expected at safepoint at %i", pc_offset);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
961 }
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
962
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
963 // address instruction = _instructions->start() + pc_offset;
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
964 // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start();
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
965 OopMap *map = create_oop_map(debug_info, CHECK);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
966 _debug_recorder->add_safepoint(pc_offset, map);
22739
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
967 record_scope(pc_offset, debug_info, CodeInstaller::FullFrame, CHECK);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
968 _debug_recorder->end_safepoint(pc_offset);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
969 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
970
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
971 void CodeInstaller::site_Infopoint(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
972 Handle debug_info = site_Infopoint::debugInfo(site);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
973 if (debug_info.is_null()) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
974 JVMCI_ERROR("debug info expected at infopoint at %i", pc_offset);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
975 }
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
976
22739
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
977 // We'd like to check that pc_offset is greater than the
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
978 // last pc recorded with _debug_recorder (raising an exception if not)
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
979 // but DebugInformationRecorder doesn't have sufficient public API.
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
980
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
981 _debug_recorder->add_non_safepoint(pc_offset);
22739
f41ed1d87d68 8143730 [JVMCI] infopoint recording is too restrictive
Doug Simon <doug.simon@oracle.com>
parents: 22728
diff changeset
982 record_scope(pc_offset, debug_info, CodeInstaller::BytecodePosition, CHECK);
16573
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
983 _debug_recorder->end_non_safepoint(pc_offset);
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
984 }
a2ec1ac769e4 Add simple infopoint nodes which do not contain debugging informations for values. Use them when shouldDebugNonSafepoints is true.
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 16520
diff changeset
985
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
986 void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
987 Handle target = site_Call::target(site);
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
988 InstanceKlass* target_klass = InstanceKlass::cast(target->klass());
3561
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
989
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
990 Handle hotspot_method; // JavaMethod
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
991 Handle foreign_call;
3561
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
992
21526
1da7aef31a08 created com.oracle.graal.hotspot.jvmci package and moved classes destined for future JVMCI module into it (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21030
diff changeset
993 if (target_klass->is_subclass_of(SystemDictionary::HotSpotForeignCallTarget_klass())) {
9740
c4b1aa93b9af rename: HotSpotRuntimeCallTarget -> HotSpotForeignCallLinkage
Doug Simon <doug.simon@oracle.com>
parents: 9669
diff changeset
994 foreign_call = target;
3561
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
995 } else {
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
996 hotspot_method = target;
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
997 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
998
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
999 Handle debug_info = site_Call::debugInfo(site);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1000
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1001 assert(hotspot_method.not_null() ^ foreign_call.not_null(), "Call site needs exactly one type");
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1002
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: 3561
diff changeset
1003 NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1004 jint next_pc_offset = CodeInstaller::pd_next_offset(inst, pc_offset, hotspot_method, CHECK);
18855
82e5b5ccdb0c fix format string
Doug Simon <doug.simon@oracle.com>
parents: 18661
diff changeset
1005
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1006 if (debug_info.not_null()) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1007 OopMap *map = create_oop_map(debug_info, CHECK);
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1008 _debug_recorder->add_safepoint(next_pc_offset, map);
23984
7139570e01c0 8169938: [AOT] SIGSEGV at ~BufferBlob::vtable chunks
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23767
diff changeset
1009
7139570e01c0 8169938: [AOT] SIGSEGV at ~BufferBlob::vtable chunks
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23767
diff changeset
1010 bool return_oop = hotspot_method.not_null() && getMethodFromHotSpotMethod(hotspot_method())->is_returning_oop();
7139570e01c0 8169938: [AOT] SIGSEGV at ~BufferBlob::vtable chunks
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23767
diff changeset
1011
7139570e01c0 8169938: [AOT] SIGSEGV at ~BufferBlob::vtable chunks
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 23767
diff changeset
1012 record_scope(next_pc_offset, debug_info, CodeInstaller::FullFrame, return_oop, CHECK);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
1013 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1014
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1015 if (foreign_call.not_null()) {
21526
1da7aef31a08 created com.oracle.graal.hotspot.jvmci package and moved classes destined for future JVMCI module into it (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21030
diff changeset
1016 jlong foreign_call_destination = HotSpotForeignCallTarget::address(foreign_call);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1017 CodeInstaller::pd_relocate_ForeignCall(inst, foreign_call_destination, CHECK);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
1018 } else { // method != NULL
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1019 if (debug_info.is_null()) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
1020 JVMCI_ERROR("debug info expected at call at %i", pc_offset);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1021 }
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
1022
21559
be896a1983c0 recast all Graal native code as JVMCI code (JBS:GRAAL-53)
Doug Simon <doug.simon@oracle.com>
parents: 21526
diff changeset
1023 TRACE_jvmci_3("method call");
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1024 CodeInstaller::pd_relocate_JavaMethod(hotspot_method, pc_offset, CHECK);
15046
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
1025 if (_next_call_type == INVOKESTATIC || _next_call_type == INVOKESPECIAL) {
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
1026 // Need a static call stub for transitions from compiled to interpreted.
24095
464eb43e7814 JVMCI code installer: throw an exception if emit_to_interp_stub fails
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 23984
diff changeset
1027 address addr = CompiledStaticCall::emit_to_interp_stub(buffer, _instructions->start() + pc_offset);
464eb43e7814 JVMCI code installer: throw an exception if emit_to_interp_stub fails
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 23984
diff changeset
1028 if (addr == NULL) {
464eb43e7814 JVMCI code installer: throw an exception if emit_to_interp_stub fails
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 23984
diff changeset
1029 JVMCI_ERROR("Could not emit static call stub, was estimate_stubs_size wrong?");
464eb43e7814 JVMCI code installer: throw an exception if emit_to_interp_stub fails
Gilles Duboscq <gilles.m.duboscq@oracle.com>
parents: 23984
diff changeset
1030 }
15046
5c71dcf0915d use hotspot static stubs for call sites
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 15018
diff changeset
1031 }
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
1032 }
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10810
diff changeset
1033
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1034 _next_call_type = INVOKE_INVALID;
10854
e1fcdda22831 SPARC: can compile some stubs now but they don't work yet
twisti
parents: 10810
diff changeset
1035
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1036 if (debug_info.not_null()) {
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
1037 _debug_recorder->end_safepoint(next_pc_offset);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1038 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1039 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1040
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1041 void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
1042 Handle reference = site_DataPatch::reference(site);
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
1043 if (reference.is_null()) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
1044 THROW(vmSymbols::java_lang_NullPointerException());
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
1045 } else if (reference->is_a(site_ConstantReference::klass())) {
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
1046 Handle constant = site_ConstantReference::constant(reference);
23408
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
1047 if (constant.is_null()) {
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
1048 THROW(vmSymbols::java_lang_NullPointerException());
f84a5ac3be22 make JVMCI JDK immutable and sharable among different JVMCI clients
Doug Simon <doug.simon@oracle.com>
parents: 23396
diff changeset
1049 } else if (constant->is_a(HotSpotObjectConstantImpl::klass())) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1050 pd_patch_OopConstant(pc_offset, constant, CHECK);
18266
ae181ec869c5 converted HotSpotMetaspaceConstant to an interface
Doug Simon <doug.simon@oracle.com>
parents: 18262
diff changeset
1051 } else if (constant->is_a(HotSpotMetaspaceConstantImpl::klass())) {
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1052 pd_patch_MetaspaceConstant(pc_offset, constant, CHECK);
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 18174
diff changeset
1053 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
1054 JVMCI_ERROR("unknown constant type in data patch: %s", constant->klass()->signature_name());
18176
c2270ad35f57 Better construction of data section and data patches.
Roland Schatz <roland.schatz@oracle.com>
parents: 18174
diff changeset
1055 }
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
1056 } else if (reference->is_a(site_DataSectionReference::klass())) {
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
1057 int data_offset = site_DataSectionReference::offset(reference);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1058 if (0 <= data_offset && data_offset < _constants_size) {
23310
e5b5170606a2 8149689: [JVMCI] CodeInstaller::pd_patch_DataSectionReference should be able to throw exceptions
twisti
parents: 23305
diff changeset
1059 pd_patch_DataSectionReference(pc_offset, data_offset, CHECK);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1060 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
1061 JVMCI_ERROR("data offset 0x%X points outside data section (size 0x%X)", data_offset, _constants_size);
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1062 }
14561
e14198669e5c Make data patch system use vm specific NarrowOop kind.
Roland Schatz <roland.schatz@oracle.com>
parents: 14172
diff changeset
1063 } else {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
1064 JVMCI_ERROR("unknown data patch type: %s", reference->klass()->signature_name());
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1065 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1066 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1067
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1068 void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, Handle site, TRAPS) {
22773
9273bb6ba33e Simplify code installation interface: Use CompiledCode class instead of CompilationResult and DataSection.
Roland Schatz <roland.schatz@oracle.com>
parents: 22739
diff changeset
1069 Handle id_obj = site_Mark::id(site);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1070
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1071 if (id_obj.not_null()) {
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1072 if (!java_lang_boxing_object::is_instance(id_obj(), T_INT)) {
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
1073 JVMCI_ERROR("expected Integer id, got %s", id_obj->klass()->signature_name());
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1074 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1075 jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT));
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1076
10771
ec8ee1c2ad7a Move non_oop_bits value up to Graal.
twisti
parents: 10684
diff changeset
1077 address pc = _instructions->start() + pc_offset;
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1078
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1079 switch (id) {
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1080 case UNVERIFIED_ENTRY:
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1081 _offsets.set_value(CodeOffsets::Entry, pc_offset);
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1082 break;
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1083 case VERIFIED_ENTRY:
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1084 _offsets.set_value(CodeOffsets::Verified_Entry, pc_offset);
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1085 break;
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1086 case OSR_ENTRY:
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1087 _offsets.set_value(CodeOffsets::OSR_Entry, pc_offset);
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1088 break;
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1089 case EXCEPTION_HANDLER_ENTRY:
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
1090 _offsets.set_value(CodeOffsets::Exceptions, pc_offset);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
1091 break;
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1092 case DEOPT_HANDLER_ENTRY:
1936
8d88c9ac9247 Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1931
diff changeset
1093 _offsets.set_value(CodeOffsets::Deopt, pc_offset);
8d88c9ac9247 Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1931
diff changeset
1094 break;
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1095 case INVOKEVIRTUAL:
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1096 case INVOKEINTERFACE:
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1097 case INLINE_INVOKE:
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1098 case INVOKESTATIC:
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1099 case INVOKESPECIAL:
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
1100 _next_call_type = (MarkId) id;
10771
ec8ee1c2ad7a Move non_oop_bits value up to Graal.
twisti
parents: 10684
diff changeset
1101 _invoke_mark_pc = pc;
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1102 break;
14574
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1103 case POLL_NEAR:
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1104 case POLL_FAR:
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1105 case POLL_RETURN_NEAR:
6bab029d6e3a removed com/oracle/graal/hotspot/bridge/Marks.java and replaced with enum
twisti
parents: 14562
diff changeset
1106 case POLL_RETURN_FAR:
22711
316e768645c0 8139589: [JVMCI] throw exceptions in faulty code installation operations
Roland Schatz <roland.schatz@oracle.com>
parents: 22702
diff changeset
1107 pd_relocate_poll(pc, id, CHECK);
3549
25765a764212 Add support for polling mark in code installer
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3538
diff changeset
1108 break;
18661
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18350
diff changeset
1109 case CARD_TABLE_SHIFT:
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18350
diff changeset
1110 case CARD_TABLE_ADDRESS:
aa4f2e3629ca Added card table PIC support
adlertz
parents: 18350
diff changeset
1111 break;
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1112 default:
22721
510846133438 8139589: [JVMCI] Using fthrow when throwing JVMCIError.
Roland Schatz <roland.schatz@oracle.com>
parents: 22715
diff changeset
1113 JVMCI_ERROR("invalid mark id: %d", id);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1114 break;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1115 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1116 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1117 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
1118