annotate src/share/vm/graal/graalCodeInstaller.cpp @ 7742:9f8bf17b2d33

Remove hardcoding of x86 registers in the Graal code installer.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 07 Feb 2013 18:01:08 +0100
parents a7a93887b4c4
children 62bcf515831d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2516
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
1 /*
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
4 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
7 * published by the Free Software Foundation.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
8 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
13 * accompanied this code).
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
14 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
15 * You should have received a copy of the GNU General Public License version
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
18 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
21 * questions.
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"
7735
a7a93887b4c4 fix Solaris build and initial SPARC support
twisti
parents: 7716
diff changeset
25 #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
26 #include "runtime/javaCalls.hpp"
7089
af30115c9d0e added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
27 #include "graal/graalEnv.hpp"
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
28 #include "graal/graalCompiler.hpp"
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
29 #include "graal/graalCodeInstaller.hpp"
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
30 #include "graal/graalJavaAccess.hpp"
4221
bcbb918f5ac6 Renaming of VMExits and VMEntries part 2.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4220
diff changeset
31 #include "graal/graalCompilerToVM.hpp"
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
32 #include "graal/graalVmIds.hpp"
7125
1baf7f1e3f23 decoupled C++ Graal runtime from C1
Doug Simon <doug.simon@oracle.com>
parents: 7101
diff changeset
33 #include "graal/graalRuntime.hpp"
7742
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
34 #include "asm/register.hpp"
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
35 #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
36 #include "code/vmreg.hpp"
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
37
7742
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
38 #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
39 # 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
40 #endif
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
41 #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
42 # 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
43 #endif
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
44 #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
45 # 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
46 #endif
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
47 #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
48 # 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
49 #endif
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
50 #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
51 # 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
52 #endif
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
53
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
54 // convert Graal register indices (as used in oop maps) to HotSpot registers
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
55 VMReg get_hotspot_reg(jint graal_reg) {
7742
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
56 if (graal_reg < RegisterImpl::number_of_registers) {
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
57 return as_Register(graal_reg)->as_VMReg();
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
58 } else {
7742
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
59 int remainder = graal_reg - RegisterImpl::number_of_registers;
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
60 #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
61 if (remainder < XMMRegisterImpl::number_of_registers) {
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
62 return as_XMMRegister(remainder)->as_VMReg();
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
63 }
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
64 #endif
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
65 ShouldNotReachHere();
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
66 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
67 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
68
5542
e318468952f5 Remove CiBitMap and replace usages with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5326
diff changeset
69 const int MapWordBits = 64;
e318468952f5 Remove CiBitMap and replace usages with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5326
diff changeset
70
1469
52bb06250d35 Converted CiDebugInfo.registerRefMap field from type long to CiBitMap.
Doug Simon <doug.simon@oracle.com>
parents: 1468
diff changeset
71 static bool is_bit_set(oop bit_map, int i) {
5542
e318468952f5 Remove CiBitMap and replace usages with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5326
diff changeset
72 jint extra_idx = i / MapWordBits;
e318468952f5 Remove CiBitMap and replace usages with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5326
diff changeset
73 arrayOop extra = (arrayOop) GraalBitMap::words(bit_map);
e318468952f5 Remove CiBitMap and replace usages with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5326
diff changeset
74 assert(extra_idx >= 0 && extra_idx < extra->length(), "unexpected index");
e318468952f5 Remove CiBitMap and replace usages with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5326
diff changeset
75 jlong word = ((jlong*) extra->base(T_LONG))[extra_idx];
e318468952f5 Remove CiBitMap and replace usages with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5326
diff changeset
76 return (word & (1LL << (i % MapWordBits))) != 0;
e318468952f5 Remove CiBitMap and replace usages with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5326
diff changeset
77 }
e318468952f5 Remove CiBitMap and replace usages with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5326
diff changeset
78
e318468952f5 Remove CiBitMap and replace usages with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5326
diff changeset
79 static int bitmap_size(oop bit_map) {
e318468952f5 Remove CiBitMap and replace usages with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5326
diff changeset
80 arrayOop arr = (arrayOop) GraalBitMap::words(bit_map);
e318468952f5 Remove CiBitMap and replace usages with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5326
diff changeset
81 return arr->length() * MapWordBits;
1469
52bb06250d35 Converted CiDebugInfo.registerRefMap field from type long to CiBitMap.
Doug Simon <doug.simon@oracle.com>
parents: 1468
diff changeset
82 }
52bb06250d35 Converted CiDebugInfo.registerRefMap field from type long to CiBitMap.
Doug Simon <doug.simon@oracle.com>
parents: 1468
diff changeset
83
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
84 // creates a HotSpot oop map out of the byte arrays provided by DebugInfo
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
85 static OopMap* create_oop_map(jint total_frame_size, jint parameter_count, oop debug_info) {
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
86 OopMap* map = new OopMap(total_frame_size, parameter_count);
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
87 oop register_map = (oop) DebugInfo::registerRefMap(debug_info);
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
88 oop frame_map = (oop) DebugInfo::frameRefMap(debug_info);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
89
1469
52bb06250d35 Converted CiDebugInfo.registerRefMap field from type long to CiBitMap.
Doug Simon <doug.simon@oracle.com>
parents: 1468
diff changeset
90 if (register_map != NULL) {
7742
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
91 for (jint i = 0; i < RegisterImpl::number_of_registers; i++) {
1469
52bb06250d35 Converted CiDebugInfo.registerRefMap field from type long to CiBitMap.
Doug Simon <doug.simon@oracle.com>
parents: 1468
diff changeset
92 bool is_oop = is_bit_set(register_map, i);
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
93 VMReg reg = get_hotspot_reg(i);
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
94 if (is_oop) {
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
95 map->set_oop(reg);
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
96 } else {
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
97 map->set_value(reg);
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
98 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
99 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
100 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
101
5542
e318468952f5 Remove CiBitMap and replace usages with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5326
diff changeset
102 for (jint i = 0; i < bitmap_size(frame_map); i++) {
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
103 bool is_oop = is_bit_set(frame_map, i);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
104 // HotSpot stack slots are 4 bytes
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
105 VMReg reg = VMRegImpl::stack2reg(i * 2);
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
106 if (is_oop) {
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
107 map->set_oop(reg);
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
108 } else {
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
109 map->set_value(reg);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
110 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
111 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
112
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
113 return map;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
114 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
115
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
116 // Records any Metadata values embedded in a Constant (e.g., the value returned by HotSpotResolvedObjectType.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
117 static void record_metadata_in_constant(oop constant, OopRecorder* oop_recorder) {
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
118 char kind = Kind::typeChar(Constant::kind(constant));
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
119 char wordKind = 'j';
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
120 if (kind == wordKind) {
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
121 oop obj = Constant::object(constant);
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
122 jlong prim = Constant::primitive(constant);
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
123 if (obj != NULL) {
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
124 if (obj->is_a(HotSpotResolvedObjectType::klass())) {
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
125 Klass* klass = (Klass*) (address) HotSpotResolvedObjectType::metaspaceKlass(obj);
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
126 assert((Klass*) prim == klass, err_msg("%s @ %p != %p", klass->name()->as_C_string(), klass, prim));
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
127 int index = oop_recorder->find_index(klass);
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
128 TRACE_graal_3("metadata[%d of %d] = %s", index, oop_recorder->metadata_count(), klass->name()->as_C_string());
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
129 } else {
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
130 assert(java_lang_String::is_instance(obj),
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
131 err_msg("unexpected annotation type (%s) for constant %ld (%p) of kind %c", obj->klass()->name()->as_C_string(), prim, prim, kind));
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
132 }
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
133 }
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
134 }
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
135 }
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
136
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
137 static ScopeValue* get_hotspot_value(oop value, int total_frame_size, GrowableArray<ScopeValue*>* objects, ScopeValue* &second, OopRecorder* oop_recorder) {
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
138 second = NULL;
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6521
diff changeset
139 if (value == Value::ILLEGAL()) {
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
140 return new LocationValue(Location::new_stk_loc(Location::invalid, 0));
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
141 }
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
142
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
143 BasicType type = GraalCompiler::kindToBasicType(Kind::typeChar(Value::kind(value)));
1449
8cfe3537a0d3 Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1444
diff changeset
144 Location::Type locationType = Location::normal;
8cfe3537a0d3 Pointer verification stub. Two loose oop fixes in C1X C++ part. Logging which methods have been compiled.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1444
diff changeset
145 if (type == T_OBJECT || type == T_ARRAY) locationType = Location::oop;
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
146
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
147 if (value->is_a(RegisterValue::klass())) {
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
148 jint number = code_Register::number(RegisterValue::reg(value));
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
149 if (number < 16) {
4232
382523fc390c jsr return addresses are valid in registers
Christian Wimmer <Christian.Wimmer@Oracle.com>
parents: 4229
diff changeset
150 if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE || type == T_ADDRESS) {
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
151 locationType = Location::int_in_long;
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
152 } else if (type == T_LONG) {
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
153 locationType = Location::lng;
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
154 } else {
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
155 assert(type == T_OBJECT || type == T_ARRAY, "unexpected type in cpu register");
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
156 }
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
157 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_Register(number)->as_VMReg()));
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
158 if (type == T_LONG) {
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
159 second = value;
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
160 }
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
161 return value;
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
162 } else {
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
163 assert(type == T_FLOAT || type == T_DOUBLE, "only float and double expected in xmm register");
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
164 if (type == T_FLOAT) {
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
165 // 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
166 locationType = Location::normal;
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
167 } else {
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
168 locationType = Location::dbl;
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
169 }
7742
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
170 #ifdef TARGET_ARCH_x86
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
171 ScopeValue* value = new LocationValue(Location::new_reg_loc(locationType, as_XMMRegister(number - 16)->as_VMReg()));
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
172 if (type == T_DOUBLE) {
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
173 second = value;
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
174 }
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
175 return value;
7742
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
176 #else
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
177 ShouldNotReachHere("Platform currently does not support floating point values.");
9f8bf17b2d33 Remove hardcoding of x86 registers in the Graal code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7735
diff changeset
178 #endif
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
179 }
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
180 } else if (value->is_a(StackSlot::klass())) {
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
181 if (type == T_DOUBLE) {
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
182 locationType = Location::dbl;
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
183 } else if (type == T_LONG) {
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
184 locationType = Location::lng;
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
185 }
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
186 jint offset = StackSlot::offset(value);
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
187 if (StackSlot::addFrameSize(value)) {
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
188 offset += total_frame_size;
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
189 }
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
190 ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset));
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
191 if (type == T_DOUBLE || type == T_LONG) {
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
192 second = value;
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
193 }
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
194 return value;
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
195 } else if (value->is_a(Constant::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
196 record_metadata_in_constant(value, oop_recorder);
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
197 jlong prim = Constant::primitive(value);
1476
1f81c0d18c75 Build also release version of VM. Fix towards making SpecJVM2008 run.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1472
diff changeset
198 if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE) {
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
199 return new ConstantIntValue(*(jint*)&prim);
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
200 } else if (type == T_LONG || type == T_DOUBLE) {
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
201 second = new ConstantIntValue(0);
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
202 return new ConstantLongValue(prim);
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
203 } else if (type == T_OBJECT) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
204 oop obj = Constant::object(value);
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
205 if (obj == NULL) {
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
206 return new ConstantOopWriteValue(NULL);
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
207 } else {
3669
53636e2c9d03 No longer use shared ciFactory. Remove make_global usage in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3668
diff changeset
208 return new ConstantOopWriteValue(JNIHandles::make_local(obj));
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
209 }
1476
1f81c0d18c75 Build also release version of VM. Fix towards making SpecJVM2008 run.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1472
diff changeset
210 } else if (type == T_ADDRESS) {
1f81c0d18c75 Build also release version of VM. Fix towards making SpecJVM2008 run.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1472
diff changeset
211 return new ConstantLongValue(prim);
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
212 }
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
213 tty->print("%i", type);
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
214 } else if (value->is_a(VirtualObject::klass())) {
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
215 oop type = VirtualObject::type(value);
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
216 int id = VirtualObject::id(value);
7084
9ba90252ce08 HotSpotResolvedJavaType is now the HotSpot implementation of ResolvedJavaType,
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7081
diff changeset
217 oop javaMirror = HotSpotResolvedObjectType::javaMirror(type);
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
218 Klass* klass = java_lang_Class::as_Klass(javaMirror);
5104
9ec2917fd0de Allow ints to be put into a virtual long array.
Andreas Woess <andreas.woess@jku.at>
parents: 5000
diff changeset
219 bool isLongArray = klass == Universe::longArrayKlassObj();
3090
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
220
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
221 for (jint i = 0; i < objects->length(); i++) {
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
222 ObjectValue* obj = (ObjectValue*) objects->at(i);
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
223 if (obj->id() == id) {
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
224 return obj;
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
225 }
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
226 }
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
227
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
228 ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), javaMirror)));
6351
c5024000ff0f fix for cyclic references in virtual objects
Lukas Stadler <lukas.stadler@jku.at>
parents: 5839
diff changeset
229 objects->append(sv);
3090
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
230
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
231 arrayOop values = (arrayOop) VirtualObject::values(value);
3090
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
232 for (jint i = 0; i < values->length(); i++) {
3133
5aeb62416609 Fixed an issue in the C++ code of the escape analysis (wrongly commented out code).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3091
diff changeset
233 ScopeValue* cur_second = NULL;
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
234 ScopeValue* value = get_hotspot_value(((oop*) values->base(T_OBJECT))[i], total_frame_size, objects, cur_second, oop_recorder);
3133
5aeb62416609 Fixed an issue in the C++ code of the escape analysis (wrongly commented out code).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3091
diff changeset
235
5126
43d5ae1051f7 added better debug output when an optimistic deoptimization is disabled
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5104
diff changeset
236 if (isLongArray && cur_second == NULL) {
43d5ae1051f7 added better debug output when an optimistic deoptimization is disabled
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5104
diff changeset
237 // we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations.
43d5ae1051f7 added better debug output when an optimistic deoptimization is disabled
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5104
diff changeset
238 // add an int 0 constant
5144
f7b2800b1738 Use VM_LITTLE_ENDIAN to determine endianness.
Andreas Woess <andreas.woess@jku.at>
parents: 5130
diff changeset
239 #ifdef VM_LITTLE_ENDIAN
f7b2800b1738 Use VM_LITTLE_ENDIAN to determine endianness.
Andreas Woess <andreas.woess@jku.at>
parents: 5130
diff changeset
240 cur_second = new ConstantIntValue(0);
f7b2800b1738 Use VM_LITTLE_ENDIAN to determine endianness.
Andreas Woess <andreas.woess@jku.at>
parents: 5130
diff changeset
241 #else
5126
43d5ae1051f7 added better debug output when an optimistic deoptimization is disabled
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5104
diff changeset
242 cur_second = value;
43d5ae1051f7 added better debug output when an optimistic deoptimization is disabled
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5104
diff changeset
243 value = new ConstantIntValue(0);
43d5ae1051f7 added better debug output when an optimistic deoptimization is disabled
Christian Haeubl <christian.haeubl@oracle.com>
parents: 5104
diff changeset
244 #endif
5104
9ec2917fd0de Allow ints to be put into a virtual long array.
Andreas Woess <andreas.woess@jku.at>
parents: 5000
diff changeset
245 }
9ec2917fd0de Allow ints to be put into a virtual long array.
Andreas Woess <andreas.woess@jku.at>
parents: 5000
diff changeset
246
3133
5aeb62416609 Fixed an issue in the C++ code of the escape analysis (wrongly commented out code).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3091
diff changeset
247 if (cur_second != NULL) {
5aeb62416609 Fixed an issue in the C++ code of the escape analysis (wrongly commented out code).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3091
diff changeset
248 sv->field_values()->append(cur_second);
5aeb62416609 Fixed an issue in the C++ code of the escape analysis (wrongly commented out code).
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3091
diff changeset
249 }
3090
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
250 sv->field_values()->append(value);
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
251 }
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
252 return sv;
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
253 } else {
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
254 value->klass()->print();
1462
1845386f5403 Full GC after bootstrap. Disable IRChecker by default. Disable compiled method logging by default.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1458
diff changeset
255 value->print();
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
256 }
2215
999f8086cc4f More changes to make it compile and work on win64.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 2182
diff changeset
257 ShouldNotReachHere();
999f8086cc4f More changes to make it compile and work on win64.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 2182
diff changeset
258 return NULL;
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
259 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
260
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
261 static MonitorValue* get_monitor_value(oop value, int total_frame_size, GrowableArray<ScopeValue*>* objects, OopRecorder* oop_recorder) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
262 guarantee(value->is_a(code_MonitorValue::klass()), "Monitors must be of type MonitorValue");
3714
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
263
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
264 ScopeValue* second = NULL;
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
265 ScopeValue* owner_value = get_hotspot_value(code_MonitorValue::owner(value), total_frame_size, objects, second, oop_recorder);
3714
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
266 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
267
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
268 ScopeValue* lock_data_value = get_hotspot_value(code_MonitorValue::lockData(value), total_frame_size, objects, second, oop_recorder);
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
269 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
270 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
271 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
272
3717
4177ddd2d1d1 Fix build error for Windows builds
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3714
diff changeset
273 bool eliminated = false;
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
274 if (code_MonitorValue::eliminated(value)) {
3717
4177ddd2d1d1 Fix build error for Windows builds
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3714
diff changeset
275 eliminated = true;
4177ddd2d1d1 Fix build error for Windows builds
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3714
diff changeset
276 }
3714
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
277
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
278 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
279 }
b648304ba4ff Change Graal monitor enter and exit from BasicObjectLock to BasicLock
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3710
diff changeset
280
3670
f198b24093f3 put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3669
diff changeset
281 void CodeInstaller::initialize_assumptions(oop target_method) {
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
282 _oop_recorder = new OopRecorder(&_arena);
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
283 _dependencies = new Dependencies(&_arena, _oop_recorder);
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
284 Handle assumptions_handle = CompilationResult::assumptions(HotSpotCompilationResult::comp(target_method));
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
285 if (!assumptions_handle.is_null()) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
286 objArrayHandle assumptions(Thread::current(), (objArrayOop)Assumptions::list(assumptions_handle()));
3670
f198b24093f3 put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3669
diff changeset
287 int length = assumptions->length();
f198b24093f3 put back in thread transitions.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3669
diff changeset
288 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
289 Handle assumption = assumptions->obj_at(i);
5e331d5f760e removed transition to vm in ci interface
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3670
diff changeset
290 if (!assumption.is_null()) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
291 if (assumption->klass() == Assumptions_MethodContents::klass()) {
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4583
diff changeset
292 assumption_MethodContents(assumption);
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
293 } 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
294 assumption_ConcreteSubtype(assumption);
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
295 } 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
296 assumption_ConcreteMethod(assumption);
3657
47edfca346ab Fix a safepoint bug in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
297 } else {
47edfca346ab Fix a safepoint bug in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
298 assumption->print();
47edfca346ab Fix a safepoint bug in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
299 fatal("unexpected Assumption subclass");
47edfca346ab Fix a safepoint bug in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
300 }
47edfca346ab Fix a safepoint bug in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
301 }
47edfca346ab Fix a safepoint bug in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
302 }
47edfca346ab Fix a safepoint bug in code installer.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
303 }
3668
46f211fe010c Removed global handle usage in ci interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3667
diff changeset
304 }
46f211fe010c Removed global handle usage in ci interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3667
diff changeset
305
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7154
diff changeset
306 GrowableArray<jlong>* get_leaf_graph_ids(Handle& comp_result) {
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7154
diff changeset
307 arrayOop leafGraphArray = (arrayOop) CompilationResult::leafGraphIds(HotSpotCompilationResult::comp(comp_result));
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7154
diff changeset
308
7716
fa8a56a351a5 null-check on leafGraphArray
Roland Schatz <roland.schatz@oracle.com>
parents: 7660
diff changeset
309 jint length;
fa8a56a351a5 null-check on leafGraphArray
Roland Schatz <roland.schatz@oracle.com>
parents: 7660
diff changeset
310 if (leafGraphArray == NULL) {
fa8a56a351a5 null-check on leafGraphArray
Roland Schatz <roland.schatz@oracle.com>
parents: 7660
diff changeset
311 length = 0;
fa8a56a351a5 null-check on leafGraphArray
Roland Schatz <roland.schatz@oracle.com>
parents: 7660
diff changeset
312 } else {
fa8a56a351a5 null-check on leafGraphArray
Roland Schatz <roland.schatz@oracle.com>
parents: 7660
diff changeset
313 length = leafGraphArray->length();
fa8a56a351a5 null-check on leafGraphArray
Roland Schatz <roland.schatz@oracle.com>
parents: 7660
diff changeset
314 }
fa8a56a351a5 null-check on leafGraphArray
Roland Schatz <roland.schatz@oracle.com>
parents: 7660
diff changeset
315
fa8a56a351a5 null-check on leafGraphArray
Roland Schatz <roland.schatz@oracle.com>
parents: 7660
diff changeset
316 GrowableArray<jlong>* result = new GrowableArray<jlong>(length);
fa8a56a351a5 null-check on leafGraphArray
Roland Schatz <roland.schatz@oracle.com>
parents: 7660
diff changeset
317 for (int i = 0; i < length; i++) {
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7154
diff changeset
318 result->append(((jlong*) leafGraphArray->base(T_LONG))[i]);
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7154
diff changeset
319 }
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7154
diff changeset
320
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7154
diff changeset
321 return result;
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7154
diff changeset
322 }
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7154
diff changeset
323
3668
46f211fe010c Removed global handle usage in ci interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3667
diff changeset
324 // constructor used to create a method
7089
af30115c9d0e added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
325 CodeInstaller::CodeInstaller(Handle& comp_result, methodHandle method, GraalEnv::CodeInstallResult& result, nmethod*& nm, Handle installed_code) {
3668
46f211fe010c Removed global handle usage in ci interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3667
diff changeset
326 GraalCompiler::initialize_buffer_blob();
46f211fe010c Removed global handle usage in ci interface.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3667
diff changeset
327 CodeBuffer buffer(JavaThread::current()->get_buffer_blob());
5839
58a607307306 renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
328 jobject comp_result_obj = JNIHandles::make_local(comp_result());
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6948
diff changeset
329 jint entry_bci = HotSpotCompilationResult::entryBCI(comp_result);
5839
58a607307306 renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
330 initialize_assumptions(JNIHandles::resolve(comp_result_obj));
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
331
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
332 {
6e1abd79e7c8 Register assumptions before anything else. Don't free code blob (it is reused).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3663
diff changeset
333 No_Safepoint_Verifier no_safepoint;
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
334 initialize_fields(JNIHandles::resolve(comp_result_obj), method);
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
335 initialize_buffer(buffer);
6e1abd79e7c8 Register assumptions before anything else. Don't free code blob (it is reused).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3663
diff changeset
336 process_exception_handlers();
6e1abd79e7c8 Register assumptions before anything else. Don't free code blob (it is reused).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3663
diff changeset
337 }
6e1abd79e7c8 Register assumptions before anything else. Don't free code blob (it is reused).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3663
diff changeset
338
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
339 int stack_slots = _total_frame_size / HeapWordSize; // conversion to words
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7154
diff changeset
340 GrowableArray<jlong>* leaf_graph_ids = get_leaf_graph_ids(comp_result);
4319
3c21eee8ab4d Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents: 4232
diff changeset
341
7089
af30115c9d0e added metering of code installation failure rate to detect excessive failure caused by overly optimistic assumptions
Doug Simon <doug.simon@oracle.com>
parents: 7084
diff changeset
342 result = GraalEnv::register_method(method, nm, entry_bci, &_offsets, _custom_stack_area_offset, &buffer, stack_slots, _debug_recorder->_oopmaps, &_exception_handler_table,
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7154
diff changeset
343 &_implicit_exception_table, GraalCompiler::instance(), _debug_recorder, _dependencies, NULL, -1, true, false, leaf_graph_ids, installed_code);
4319
3c21eee8ab4d Add installMethodCallback() to HotSpotRuntime.
Andreas Woess <andreas.woess@jku.at>
parents: 4232
diff changeset
344
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3636
diff changeset
345 method->clear_queued_for_compilation();
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
346 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
347
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
348 // constructor used to create a stub
5275
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5259
diff changeset
349 CodeInstaller::CodeInstaller(Handle& target_method, BufferBlob*& blob, jlong& id) {
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
350 No_Safepoint_Verifier no_safepoint;
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
351
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
352 _oop_recorder = new OopRecorder(&_arena);
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
353 initialize_fields(target_method(), NULL);
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
354 assert(_name != NULL, "installMethod needs NON-NULL name");
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
355
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
356 // (very) conservative estimate: each site needs a relocation
3555
22d11b3bc561 Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3554
diff changeset
357 GraalCompiler::initialize_buffer_blob();
22d11b3bc561 Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3554
diff changeset
358 CodeBuffer buffer(JavaThread::current()->get_buffer_blob());
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
359 initialize_buffer(buffer);
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
360
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
361 const char* cname = java_lang_String::as_utf8_string(_name);
5275
290b3025b66f added support for disassembling code after installation (so that the result of patching and relocation can be seen)
Doug Simon <doug.simon@oracle.com>
parents: 5259
diff changeset
362 blob = BufferBlob::create(strdup(cname), &buffer); // this is leaking strings... but only a limited number of stubs will be created
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
363 IF_TRACE_graal_3 Disassembler::decode((CodeBlob*) blob);
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1484
diff changeset
364 id = VmIds::addStub(blob->code_begin());
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
365 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
366
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
367 void CodeInstaller::initialize_fields(oop comp_result, methodHandle method) {
5839
58a607307306 renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
368 _comp_result = HotSpotCompilationResult::comp(comp_result);
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
369 if (!method.is_null()) {
5839
58a607307306 renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
370 _parameter_count = method->size_of_parameters();
58a607307306 renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
371 TRACE_graal_1("installing code for %s", method->name_and_sig_as_C_string());
3660
c805dfba251d Fixed regression.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3659
diff changeset
372 }
5839
58a607307306 renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
373 _name = HotSpotCompilationResult::name(comp_result);
58a607307306 renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
374 _sites = (arrayOop) HotSpotCompilationResult::sites(comp_result);
58a607307306 renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
375 _exception_handlers = (arrayOop) HotSpotCompilationResult::exceptionHandlers(comp_result);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
376
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
377 _code = (arrayOop) CompilationResult::targetCode(_comp_result);
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
378 _code_size = CompilationResult::targetCodeSize(_comp_result);
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
379 // The frame size we get from the target method does not include the return address, so add one word for it here.
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
380 _total_frame_size = CompilationResult::frameSize(_comp_result) + HeapWordSize;
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
381 _custom_stack_area_offset = CompilationResult::customStackAreaOffset(_comp_result);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
382
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
383 // (very) conservative estimate: each site needs a constant section entry
2495
c737ee310b39 Small adjustment to assertion and constants size calculation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2494
diff changeset
384 _constants_size = _sites->length() * (BytesPerLong*2);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
385 _total_size = align_size_up(_code_size, HeapWordSize) + _constants_size;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
386
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
387 _next_call_type = MARK_INVOKE_INVALID;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
388 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
389
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
390 // perform data and call relocation on the CodeBuffer
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
391 void CodeInstaller::initialize_buffer(CodeBuffer& buffer) {
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1484
diff changeset
392 int locs_buffer_size = _sites->length() * (relocInfo::length_limit + sizeof(relocInfo));
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1484
diff changeset
393 char* locs_buffer = NEW_RESOURCE_ARRAY(char, locs_buffer_size);
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1484
diff changeset
394 buffer.insts()->initialize_shared_locs((relocInfo*)locs_buffer, locs_buffer_size / sizeof(relocInfo));
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1484
diff changeset
395 buffer.initialize_stubs_size(256);
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1484
diff changeset
396 buffer.initialize_consts_size(_constants_size);
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1484
diff changeset
397
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
398 _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
399 _debug_recorder->set_oopmaps(new OopMapSet());
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
400
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
401 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
402
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
403 _instructions = buffer.insts();
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
404 _constants = buffer.consts();
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
405
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
406 // copy the code into the newly created CodeBuffer
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
407 memcpy(_instructions->start(), _code->base(T_BYTE), _code_size);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
408 _instructions->set_end(_instructions->start() + _code_size);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
409
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
410 oop* sites = (oop*) _sites->base(T_OBJECT);
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
411 for (int i = 0; i < _sites->length(); i++) {
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
412 oop site = sites[i];
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
413 jint pc_offset = CompilationResult_Site::pcOffset(site);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
414
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
415 if (site->is_a(CompilationResult_Call::klass())) {
3561
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
416 TRACE_graal_4("call at %i", pc_offset);
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
417 site_Call(buffer, pc_offset, site);
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
418 } else if (site->is_a(CompilationResult_Safepoint::klass())) {
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
419 TRACE_graal_4("safepoint at %i", pc_offset);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
420 site_Safepoint(buffer, pc_offset, site);
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
421 } else if (site->is_a(CompilationResult_DataPatch::klass())) {
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
422 TRACE_graal_4("datapatch at %i", pc_offset);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
423 site_DataPatch(buffer, pc_offset, site);
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
424 } else if (site->is_a(CompilationResult_Mark::klass())) {
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
425 TRACE_graal_4("mark at %i", pc_offset);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
426 site_Mark(buffer, pc_offset, site);
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
427 } else {
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
428 fatal("unexpected Site subclass");
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
429 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
430 }
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
431 }
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
432
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4583
diff changeset
433 void CodeInstaller::assumption_MethodContents(Handle assumption) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
434 Handle method_handle = Assumptions_MethodContents::method(assumption());
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4583
diff changeset
435 methodHandle method = getMethodFromHotSpotMethod(method_handle());
7101
0778b04fc682 better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents: 7094
diff changeset
436 _dependencies->assert_evol_method(method());
4670
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4583
diff changeset
437 }
41034914e2ee add MethodContents assumption to fix debbugging issue
Lukas Stadler <lukas.stadler@jku.at>
parents: 4583
diff changeset
438
3672
5e331d5f760e removed transition to vm in ci interface
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3670
diff changeset
439 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
440 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
441 Handle subtype_handle = Assumptions_ConcreteSubtype::subtype(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
442 Klass* context = asKlass(HotSpotResolvedObjectType::metaspaceKlass(context_handle));
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
443 Klass* subtype = asKlass(HotSpotResolvedObjectType::metaspaceKlass(subtype_handle));
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
444
7101
0778b04fc682 better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents: 7094
diff changeset
445 _dependencies->assert_leaf_type(subtype);
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
446 if (context != subtype) {
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
447 assert(context->is_abstract(), "");
7101
0778b04fc682 better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents: 7094
diff changeset
448 _dependencies->assert_abstract_with_unique_concrete_subtype(context, subtype);
2048
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
449 }
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
450 }
177398c6147d Added unique concrete subtype assumption.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2046
diff changeset
451
3672
5e331d5f760e removed transition to vm in ci interface
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3670
diff changeset
452 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
453 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
454 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
455
3704
342a54994e05 Made C++ changes to reflect changes to CiAssumptions.ConcreteMethod.
Doug Simon <doug.simon@oracle.com>
parents: 3690
diff changeset
456 methodHandle impl = getMethodFromHotSpotMethod(impl_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
457 Klass* context = asKlass(HotSpotResolvedObjectType::metaspaceKlass(context_handle));
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
458
7101
0778b04fc682 better encoding of dependencies during dependency recording by Graal
Doug Simon <doug.simon@oracle.com>
parents: 7094
diff changeset
459 _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
460 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
461
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
462 void CodeInstaller::process_exception_handlers() {
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
463 // allocate some arrays for use by the collection code.
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
464 const int num_handlers = 5;
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
465 GrowableArray<intptr_t>* bcis = new GrowableArray<intptr_t> (num_handlers);
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
466 GrowableArray<intptr_t>* scope_depths = new GrowableArray<intptr_t> (num_handlers);
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
467 GrowableArray<intptr_t>* pcos = new GrowableArray<intptr_t> (num_handlers);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
468
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
469 if (_exception_handlers != NULL) {
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
470 oop* exception_handlers = (oop*) _exception_handlers->base(T_OBJECT);
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
471 for (int i = 0; i < _exception_handlers->length(); i++) {
4693
07bcee8b70a4 Simplify exception debug information and exception handler table creation based on Graal's simplified model of exception handler information (i.e. the dispatch is done in compiled code).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4691
diff changeset
472 oop exc = exception_handlers[i];
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
473 jint pc_offset = CompilationResult_Site::pcOffset(exc);
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
474 jint handler_offset = CompilationResult_ExceptionHandler::handlerPos(exc);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
475
4693
07bcee8b70a4 Simplify exception debug information and exception handler table creation based on Graal's simplified model of exception handler information (i.e. the dispatch is done in compiled code).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4691
diff changeset
476 // Subtable header
07bcee8b70a4 Simplify exception debug information and exception handler table creation based on Graal's simplified model of exception handler information (i.e. the dispatch is done in compiled code).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4691
diff changeset
477 _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
478
4693
07bcee8b70a4 Simplify exception debug information and exception handler table creation based on Graal's simplified model of exception handler information (i.e. the dispatch is done in compiled code).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4691
diff changeset
479 // Subtable entry
07bcee8b70a4 Simplify exception debug information and exception handler table creation based on Graal's simplified model of exception handler information (i.e. the dispatch is done in compiled code).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4691
diff changeset
480 _exception_handler_table.add_entry(HandlerTableEntry(-1, handler_offset, 0));
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
481 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
482 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
483 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
484
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
485 // 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
486 // 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
487 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
488 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
489 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
490 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
491 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
492 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
493 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
494 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
495 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
496 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
497 }
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
498 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
499 }
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
500
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
501 void CodeInstaller::record_scope(jint pc_offset, oop frame, GrowableArray<ScopeValue*>* objects) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
502 assert(frame->klass() == BytecodeFrame::klass(), "BytecodeFrame expected");
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
503 oop caller_frame = BytecodePosition::caller(frame);
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
504 if (caller_frame != NULL) {
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
505 record_scope(pc_offset, caller_frame, objects);
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
506 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
507
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
508 oop hotspot_method = BytecodePosition::method(frame);
6948
e522a00b91aa Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
Doug Simon <doug.simon@oracle.com>
parents: 6674
diff changeset
509 Method* method = getMethodFromHotSpotMethod(hotspot_method);
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
510 jint bci = BytecodePosition::bci(frame);
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
511 bool reexecute;
6388
6b74f44c5059 added Log.printObject() and Log.printlnObject() for more detailed logging of objects
Doug Simon <doug.simon@oracle.com>
parents: 6351
diff changeset
512 if (bci == -1 || bci == -2){
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
513 reexecute = false;
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
514 } else {
2182
9569fdf936ff Made merge compile.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 2059
diff changeset
515 Bytecodes::Code code = Bytecodes::java_code_at(method, method->bcp_from(bci));
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
516 reexecute = bytecode_should_reexecute(code);
4678
a03f3fd16b22 Fix reexecute boolean in HotSpot debug information. Introduce "duringCall" flag in FrameState that indicates that the bci of the frame state denotes an invoke that should *not* be reexecuted.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4670
diff changeset
517 if (frame != NULL) {
6515
e722fa145b37 Fixed VS2010 warnings in HotSpot.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 6446
diff changeset
518 reexecute = (BytecodeFrame::duringCall(frame) == JNI_FALSE);
4678
a03f3fd16b22 Fix reexecute boolean in HotSpot debug information. Introduce "duringCall" flag in FrameState that indicates that the bci of the frame state denotes an invoke that should *not* be reexecuted.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 4670
diff changeset
519 }
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
520 }
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
521
2901
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
522 if (TraceGraal >= 2) {
1937
4853c5cad3aa More deoptmization tracing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1936
diff changeset
523 tty->print_cr("Recording scope pc_offset=%d bci=%d frame=%d", pc_offset, bci, frame);
4853c5cad3aa More deoptmization tracing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1936
diff changeset
524 }
4853c5cad3aa More deoptmization tracing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1936
diff changeset
525
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
526 jint local_count = BytecodeFrame::numLocals(frame);
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
527 jint expression_count = BytecodeFrame::numStack(frame);
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
528 jint monitor_count = BytecodeFrame::numLocks(frame);
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
529 arrayOop values = (arrayOop) BytecodeFrame::values(frame);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
530
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
531 assert(local_count + expression_count + monitor_count == values->length(), "unexpected values length");
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
532
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
533 GrowableArray<ScopeValue*>* locals = new GrowableArray<ScopeValue*> ();
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
534 GrowableArray<ScopeValue*>* expressions = new GrowableArray<ScopeValue*> ();
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
535 GrowableArray<MonitorValue*>* monitors = new GrowableArray<MonitorValue*> ();
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
536
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
537 if (TraceGraal >= 2) {
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
538 tty->print_cr("Scope at bci %d with %d values", bci, values->length());
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
539 tty->print_cr("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count);
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
540 }
1936
8d88c9ac9247 Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1931
diff changeset
541
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
542 for (jint i = 0; i < values->length(); i++) {
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
543 ScopeValue* second = NULL;
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
544 oop value = ((oop*) values->base(T_OBJECT))[i];
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
545
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
546 if (i < local_count) {
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
547 ScopeValue* first = get_hotspot_value(value, _total_frame_size, objects, second, _oop_recorder);
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
548 if (second != NULL) {
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
549 locals->append(second);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
550 }
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
551 locals->append(first);
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
552 } else if (i < local_count + expression_count) {
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
553 ScopeValue* first = get_hotspot_value(value, _total_frame_size, objects, second, _oop_recorder);
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
554 if (second != NULL) {
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
555 expressions->append(second);
2938
c7783b6773ea fixed graph start frame state
Lukas Stadler <lukas.stadler@jku.at>
parents: 2901
diff changeset
556 }
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
557 expressions->append(first);
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
558 } else {
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
559 monitors->append(get_monitor_value(value, _total_frame_size, objects, _oop_recorder));
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
560 }
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
561 if (second != NULL) {
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
562 i++;
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6521
diff changeset
563 assert(i < values->length(), "double-slot value not followed by Value.ILLEGAL");
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6521
diff changeset
564 assert(((oop*) values->base(T_OBJECT))[i] == Value::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL");
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
565 }
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
566 }
3090
536528f48708 more escape analysis work: debug info
Lukas Stadler <lukas.stadler@jku.at>
parents: 3053
diff changeset
567
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
568 _debug_recorder->dump_object_pool(objects);
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
569
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
570 DebugToken* locals_token = _debug_recorder->create_scope_values(locals);
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
571 DebugToken* expressions_token = _debug_recorder->create_scope_values(expressions);
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
572 DebugToken* monitors_token = _debug_recorder->create_monitor_values(monitors);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
573
7046
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 7018
diff changeset
574 GrowableArray<DeferredWriteValue*>* deferred_writes = new GrowableArray<DeferredWriteValue*> ();
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 7018
diff changeset
575 // deferred_writes->append(new DeferredWriteValue(new LocationValue(Location::new_reg_loc(Location::lng, rax->as_VMReg())), new ConstantIntValue(0), 0, 100, new ConstantIntValue(123)));
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 7018
diff changeset
576 DebugToken* deferred_writes_token = _debug_recorder->create_deferred_writes(deferred_writes);
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 7018
diff changeset
577
6515
e722fa145b37 Fixed VS2010 warnings in HotSpot.
Christian Haeubl <haeubl@ssw.jku.at>
parents: 6446
diff changeset
578 bool throw_exception = BytecodeFrame::rethrowException(frame) == JNI_TRUE;
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
579
7046
b6a8f2d23057 VM support for deferred reads and writes: ScopeDesc, DebugInfo, DebugInfoRecorder
Lukas Stadler <lukas.stadler@jku.at>
parents: 7018
diff changeset
580 _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, false, locals_token, expressions_token, monitors_token, deferred_writes_token);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
581 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
582
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
583 void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, oop site) {
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
584 oop debug_info = CompilationResult_Safepoint::debugInfo(site);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
585 assert(debug_info != NULL, "debug info expected");
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
586
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
587 // address instruction = _instructions->start() + pc_offset;
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
588 // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start();
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7154
diff changeset
589 _debug_recorder->add_safepoint(pc_offset, create_oop_map(_total_frame_size, _parameter_count, debug_info));
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
590
7139
045c5f8ae689 modified code installation to handle debug info that only contains oop maps but no frame information
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
591 oop frame = DebugInfo::bytecodePosition(debug_info);
045c5f8ae689 modified code installation to handle debug info that only contains oop maps but no frame information
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
592 if (frame != NULL) {
045c5f8ae689 modified code installation to handle debug info that only contains oop maps but no frame information
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
593 record_scope(pc_offset, frame, new GrowableArray<ScopeValue*>());
045c5f8ae689 modified code installation to handle debug info that only contains oop maps but no frame information
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
594 } else {
045c5f8ae689 modified code installation to handle debug info that only contains oop maps but no frame information
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
595 // Stubs do not record scope info, just oop maps
045c5f8ae689 modified code installation to handle debug info that only contains oop maps but no frame information
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
596 }
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
597
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
598 _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
599 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
600
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
601 void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, oop site) {
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
602 oop target = CompilationResult_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
603 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
604
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
605 oop hotspot_method = NULL; // JavaMethod
3561
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
606 oop global_stub = NULL;
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
607
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
608 if (target_klass->is_subclass_of(SystemDictionary::Long_klass())) {
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
609 global_stub = target;
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
610 } else {
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
611 hotspot_method = target;
bea018622324 Changes to JavaAccess as a result of CRI changes.
Doug Simon <doug.simon@oracle.com>
parents: 3560
diff changeset
612 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
613
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
614 oop debug_info = CompilationResult_Call::debugInfo(site);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
615
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
616 assert((hotspot_method ? 1 : 0) + (global_stub ? 1 : 0) == 1, "Call site needs exactly one type");
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
617
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
618 NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset);
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
619 jint next_pc_offset = 0x0;
5000
b5dc2403c1e7 add option to inline VTable stubs
Lukas Stadler <lukas.stadler@jku.at>
parents: 4695
diff changeset
620 bool is_call_reg = false;
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
621 if (inst->is_call() || inst->is_jump()) {
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
622 assert(NativeCall::instruction_size == (int)NativeJump::instruction_size, "unexpected size");
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
623 next_pc_offset = pc_offset + NativeCall::instruction_size;
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
624 } else if (inst->is_mov_literal64()) {
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
625 // mov+call instruction pair
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
626 next_pc_offset = pc_offset + NativeMovConstReg::instruction_size;
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
627 u_char* call = (u_char*) (_instructions->start() + next_pc_offset);
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
628 assert((call[0] == 0x40 || call[0] == 0x41) && call[1] == 0xFF, "expected call with rex/rexb prefix byte");
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
629 next_pc_offset += 3; /* prefix byte + opcode byte + modrm byte */
5000
b5dc2403c1e7 add option to inline VTable stubs
Lukas Stadler <lukas.stadler@jku.at>
parents: 4695
diff changeset
630 } else if (inst->is_call_reg()) {
5839
58a607307306 renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
631 // the inlined vtable stub contains a "call register" instruction
5000
b5dc2403c1e7 add option to inline VTable stubs
Lukas Stadler <lukas.stadler@jku.at>
parents: 4695
diff changeset
632 assert(hotspot_method != NULL, "only valid for virtual calls");
b5dc2403c1e7 add option to inline VTable stubs
Lukas Stadler <lukas.stadler@jku.at>
parents: 4695
diff changeset
633 is_call_reg = true;
5839
58a607307306 renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
634 next_pc_offset = pc_offset + ((NativeCallReg *) inst)->next_instruction_offset();
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
635 } else {
5839
58a607307306 renaming in native code for CiTargetMethod -> CompilationResult
Doug Simon <doug.simon@oracle.com>
parents: 5823
diff changeset
636 tty->print_cr("at pc_offset %d", pc_offset);
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
637 fatal("unsupported type of instruction for call site");
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
638 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
639
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
640 if (target->is_a(SystemDictionary::HotSpotInstalledCode_klass())) {
3619
5e9645341ec3 support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents: 3594
diff changeset
641 assert(inst->is_jump(), "jump expected");
5e9645341ec3 support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents: 3594
diff changeset
642
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
643 nmethod* nm = (nmethod*) HotSpotInstalledCode::nmethod(target);
3619
5e9645341ec3 support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents: 3594
diff changeset
644 nativeJump_at((address)inst)->set_jump_destination(nm->verified_entry_point());
5e9645341ec3 support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents: 3594
diff changeset
645 _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand);
5e9645341ec3 support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents: 3594
diff changeset
646
5e9645341ec3 support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents: 3594
diff changeset
647 return;
5e9645341ec3 support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents: 3594
diff changeset
648 }
5e9645341ec3 support for new RiRuntime features: add code without making it the default for the method, executing Java tasks on the compile thread, communicate nmethod reference to Java code as HotSpotCompiledMethod
Lukas Stadler <lukas.stadler@jku.at>
parents: 3594
diff changeset
649
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
650 if (debug_info != NULL) {
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
651 oop frame = DebugInfo::bytecodePosition(debug_info);
7660
0b646334c5f7 keep track of leafGraphIds only at the StructuredGraph level (see GRAAL-60)
Lukas Stadler <lukas.stadler@jku.at>
parents: 7154
diff changeset
652 _debug_recorder->add_safepoint(next_pc_offset, create_oop_map(_total_frame_size, _parameter_count, debug_info));
7139
045c5f8ae689 modified code installation to handle debug info that only contains oop maps but no frame information
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
653 if (frame != NULL) {
045c5f8ae689 modified code installation to handle debug info that only contains oop maps but no frame information
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
654 record_scope(next_pc_offset, frame, new GrowableArray<ScopeValue*>());
045c5f8ae689 modified code installation to handle debug info that only contains oop maps but no frame information
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
655 } else {
045c5f8ae689 modified code installation to handle debug info that only contains oop maps but no frame information
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
656 // Stubs do not record scope info, just oop maps
045c5f8ae689 modified code installation to handle debug info that only contains oop maps but no frame information
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
657 }
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
658 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
659
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
660 if (global_stub != NULL) {
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
661 assert(java_lang_boxing_object::is_instance(global_stub, T_LONG), "global_stub needs to be of type Long");
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
662
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
663 if (inst->is_call()) {
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
664 // NOTE: for call without a mov, the offset must fit a 32-bit immediate
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
665 // see also CompilerToVM.getMaxCallTargetOffset()
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
666 NativeCall* call = nativeCall_at((address) (inst));
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
667 call->set_destination(VmIds::getStub(global_stub));
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
668 _instructions->relocate(call->instruction_address(), runtime_call_Relocation::spec(), Assembler::call32_operand);
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
669 } else if (inst->is_mov_literal64()) {
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
670 NativeMovConstReg* mov = nativeMovConstReg_at((address) (inst));
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
671 mov->set_data((intptr_t) VmIds::getStub(global_stub));
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
672 _instructions->relocate(mov->instruction_address(), runtime_call_Relocation::spec(), Assembler::imm_operand);
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
673 } else {
6521
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
674 NativeJump* jump = nativeJump_at((address) (inst));
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
675 jump->set_jump_destination(VmIds::getStub(global_stub));
2a0c9f20baa1 consolidated framework for runtime and stub calls and moved declaration of descriptors for such calls to the source file in which they are used
Doug Simon <doug.simon@oracle.com>
parents: 6515
diff changeset
676 _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand);
1433
efba53f86c4f various fixes and enhancements
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1432
diff changeset
677 }
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
678 TRACE_graal_3("relocating (stub) at %p", inst);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
679 } else { // method != NULL
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
680 assert(hotspot_method != NULL, "unexpected JavaMethod");
7018
17eeac928874 Put code that is used only in ASSERT mode behind #ifdef ASSERT
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7003
diff changeset
681 #ifdef ASSERT
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
682 Method* method = NULL;
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2951
diff changeset
683 // we need to check, this might also be an unresolved method
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
684 if (hotspot_method->is_a(HotSpotResolvedJavaMethod::klass())) {
3011
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2951
diff changeset
685 method = getMethodFromHotSpotMethod(hotspot_method);
f00918f35c7f inlining and runtime interface related changes:
Lukas Stadler <lukas.stadler@jku.at>
parents: 2951
diff changeset
686 }
7018
17eeac928874 Put code that is used only in ASSERT mode behind #ifdef ASSERT
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7003
diff changeset
687 #endif
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
688 assert(debug_info != NULL, "debug info expected");
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
689
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
690 TRACE_graal_3("method call");
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
691 switch (_next_call_type) {
5823
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5798
diff changeset
692 case MARK_INLINE_INVOKEVIRTUAL: {
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5798
diff changeset
693 break;
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5798
diff changeset
694 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
695 case MARK_INVOKEVIRTUAL:
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
696 case MARK_INVOKEINTERFACE: {
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
697 assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface");
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
698
5000
b5dc2403c1e7 add option to inline VTable stubs
Lukas Stadler <lukas.stadler@jku.at>
parents: 4695
diff changeset
699 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
700 call->set_destination(SharedRuntime::get_resolve_virtual_call_stub());
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
701 _instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc), Assembler::call32_operand);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
702 break;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
703 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
704 case MARK_INVOKESTATIC: {
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
705 assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic");
3538
e4616e3d207b support for new CiRuntimeCalls CreateNullPointerException and CreateOutOfBoundsException
Lukas Stadler <lukas.stadler@jku.at>
parents: 3133
diff changeset
706
5000
b5dc2403c1e7 add option to inline VTable stubs
Lukas Stadler <lukas.stadler@jku.at>
parents: 4695
diff changeset
707 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
708 call->set_destination(SharedRuntime::get_resolve_static_call_stub());
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
709 _instructions->relocate(call->instruction_address(), relocInfo::static_call_type, Assembler::call32_operand);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
710 break;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
711 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
712 case MARK_INVOKESPECIAL: {
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
713 assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial");
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
714
5000
b5dc2403c1e7 add option to inline VTable stubs
Lukas Stadler <lukas.stadler@jku.at>
parents: 4695
diff changeset
715 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
716 call->set_destination(SharedRuntime::get_resolve_opt_virtual_call_stub());
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
717 _instructions->relocate(call->instruction_address(), relocInfo::opt_virtual_call_type, Assembler::call32_operand);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
718 break;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
719 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
720 case MARK_INVOKE_INVALID:
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
721 default:
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1484
diff changeset
722 fatal("invalid _next_call_type value");
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
723 break;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
724 }
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
725 }
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
726 _next_call_type = MARK_INVOKE_INVALID;
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
727 if (debug_info != NULL) {
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
728 _debug_recorder->end_safepoint(next_pc_offset);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
729 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
730 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
731
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
732 void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site) {
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
733 oop constant = CompilationResult_DataPatch::constant(site);
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
734 int alignment = CompilationResult_DataPatch::alignment(site);
7068
263bc2349f15 removed high-level interpreter code from HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 7003
diff changeset
735 bool inlined = CompilationResult_DataPatch::inlined(site) == JNI_TRUE;
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
736 oop kind = Constant::kind(constant);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
737
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
738 address instruction = _instructions->start() + pc_offset;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
739
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
740 char typeChar = Kind::typeChar(kind);
2494
e88293edf07c Fixed an issue with alignment of double/long values in the code buffer. Can now run Scimark again.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 2282
diff changeset
741 switch (typeChar) {
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
742 case 'z':
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
743 case 'b':
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
744 case 's':
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
745 case 'c':
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
746 case 'i':
5326
a53162ca8219 introduced HotSpotKlassOop type to convey a klassOop value from the compiler to the C++ code instead of relying on the C++ code automagically converting a HotSpotTypeResolvedImpl value to a klassOop
Doug Simon <doug.simon@oracle.com>
parents: 5275
diff changeset
747 fatal("int-sized values not expected in DataPatch");
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
748 break;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
749 case 'f':
3594
af1319bc4fd5 Fixed wrong type char check.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3572
diff changeset
750 case 'j':
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
751 case 'd': {
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
752 record_metadata_in_constant(constant, _oop_recorder);
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
753 if (inlined) {
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
754 address operand = Assembler::locate_operand(instruction, Assembler::imm_operand);
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
755 *((jlong*) operand) = Constant::primitive(constant);
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
756 } else {
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
757 address operand = Assembler::locate_operand(instruction, Assembler::disp32_operand);
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
758 address next_instruction = Assembler::locate_next_instruction(instruction);
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
759 int size = _constants->size();
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
760 if (alignment > 0) {
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
761 guarantee(alignment <= _constants->alignment(), "Alignment inside constants section is restricted by alignment of section begin");
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
762 size = align_size_up(size, alignment);
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
763 }
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
764 // we don't care if this is a long/double/etc., the primitive field contains the right bits
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
765 address dest = _constants->start() + size;
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
766 _constants->set_end(dest + BytesPerLong);
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
767 *(jlong*) dest = Constant::primitive(constant);
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
768
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
769 long disp = dest - next_instruction;
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
770 assert(disp == (jint) disp, "disp doesn't fit in 32 bits");
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
771 *((jint*) operand) = (jint) disp;
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
772
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
773 _instructions->relocate(instruction, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand);
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
774 TRACE_graal_3("relocating (%c) at %p/%p with destination at %p (%d)", typeChar, instruction, operand, dest, size);
3710
4e037604f6ee use alignment for constants specified in DataPatch.alignment
Christian Wimmer <christian.wimmer@oracle.com>
parents: 3707
diff changeset
775 }
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
776 break;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
777 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
778 case 'a': {
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
779 address operand = Assembler::locate_operand(instruction, Assembler::imm_operand);
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5553
diff changeset
780 Handle obj = Constant::object(constant);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
781
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
782 jobject value = JNIHandles::make_local(obj());
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
783 *((jobject*) operand) = value;
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
784 _instructions->relocate(instruction, oop_Relocation::spec_for_immediate(), Assembler::imm_operand);
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
785 TRACE_graal_3("relocating (oop constant) at %p/%p", instruction, operand);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
786 break;
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 default:
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
789 fatal(err_msg("unexpected Kind (%d) in DataPatch", typeChar));
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
790 break;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
791 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
792 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
793
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
794 void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, oop site) {
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
795 oop id_obj = CompilationResult_Mark::id(site);
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
796 arrayOop references = (arrayOop) CompilationResult_Mark::references(site);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
797
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
798 if (id_obj != NULL) {
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
799 assert(java_lang_boxing_object::is_instance(id_obj, T_INT), "Integer id expected");
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
800 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
801
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
802 address instruction = _instructions->start() + pc_offset;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
803
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
804 switch (id) {
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
805 case MARK_UNVERIFIED_ENTRY:
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
806 _offsets.set_value(CodeOffsets::Entry, pc_offset);
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
807 break;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
808 case MARK_VERIFIED_ENTRY:
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
809 _offsets.set_value(CodeOffsets::Verified_Entry, pc_offset);
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
810 break;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
811 case MARK_OSR_ENTRY:
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
812 _offsets.set_value(CodeOffsets::OSR_Entry, pc_offset);
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
813 break;
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
814 case MARK_EXCEPTION_HANDLER_ENTRY:
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
815 _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
816 break;
1936
8d88c9ac9247 Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1931
diff changeset
817 case MARK_DEOPT_HANDLER_ENTRY:
8d88c9ac9247 Correct deopt handler entry. New flag -XX:+TraceSignals. More detailed deopt printing.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1931
diff changeset
818 _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
819 break;
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
820 case MARK_STATIC_CALL_STUB: {
7003
bb524ee6b8e9 added relocation entry for the Method* operand of the MOV instruction in a static call stub
Doug Simon <doug.simon@oracle.com>
parents: 7000
diff changeset
821 _instructions->relocate(instruction, metadata_Relocation::spec_for_immediate());
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
822 assert(references->length() == 1, "static call stub needs one reference");
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
823 oop ref = ((oop*) references->base(T_OBJECT))[0];
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6559
diff changeset
824 address call_pc = _instructions->start() + CompilationResult_Site::pcOffset(ref);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
825 _instructions->relocate(instruction, static_stub_Relocation::spec(call_pc));
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
826 break;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
827 }
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5776
diff changeset
828 case MARK_INVOKEVIRTUAL:
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5776
diff changeset
829 case MARK_INVOKEINTERFACE: {
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
830 // Convert the initial value of the Klass* slot in an inline cache
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
831 // from 0L to Universe::non_oop_word().
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5776
diff changeset
832 NativeMovConstReg* n_copy = nativeMovConstReg_at(instruction);
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
833 assert(n_copy->data() == 0, "inline cache Klass* initial value should be 0L");
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5776
diff changeset
834 n_copy->set_data((intptr_t)Universe::non_oop_word());
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5776
diff changeset
835 }
5823
f238fe91dc7f partial (non XIR) support for inlining virtual dispatch at call sites - still needs fixing
Doug Simon <doug.simon@oracle.com>
parents: 5798
diff changeset
836 case MARK_INLINE_INVOKEVIRTUAL:
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
837 case MARK_INVOKE_INVALID:
5798
2585af1e26ac implemented non-XIR lowering of invokes (todo: inline virtual dispatch and null checking of receivers)
Doug Simon <doug.simon@oracle.com>
parents: 5776
diff changeset
838 case MARK_INVOKESPECIAL:
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
839 case MARK_INVOKESTATIC:
1432
b61a43cd1255 sourcecode formatting
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1429
diff changeset
840 _next_call_type = (MarkId) id;
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
841 _invoke_mark_pc = instruction;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
842 break;
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
843 case MARK_IMPLICIT_NULL:
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
844 _implicit_exception_table.append(pc_offset, pc_offset);
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
845 break;
3550
aee1479c0a4b Use 2 different marks for NEAR/FAR polling : fixes wrong polling addresse problem after relocation
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3549
diff changeset
846 case MARK_POLL_NEAR: {
aee1479c0a4b Use 2 different marks for NEAR/FAR polling : fixes wrong polling addresse problem after relocation
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3549
diff changeset
847 NativeInstruction* ni = nativeInstruction_at(instruction);
aee1479c0a4b Use 2 different marks for NEAR/FAR polling : fixes wrong polling addresse problem after relocation
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3549
diff changeset
848 int32_t* disp = (int32_t*) Assembler::locate_operand(instruction, Assembler::disp32_operand);
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
849 int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand
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
850 intptr_t new_disp = (intptr_t) (os::get_polling_page() + offset) - (intptr_t) ni;
3550
aee1479c0a4b Use 2 different marks for NEAR/FAR polling : fixes wrong polling addresse problem after relocation
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3549
diff changeset
851 *disp = (int32_t)new_disp;
aee1479c0a4b Use 2 different marks for NEAR/FAR polling : fixes wrong polling addresse problem after relocation
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3549
diff changeset
852 }
aee1479c0a4b Use 2 different marks for NEAR/FAR polling : fixes wrong polling addresse problem after relocation
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3549
diff changeset
853 case MARK_POLL_FAR:
3549
25765a764212 Add support for polling mark in code installer
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3538
diff changeset
854 _instructions->relocate(instruction, relocInfo::poll_type);
25765a764212 Add support for polling mark in code installer
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3538
diff changeset
855 break;
3550
aee1479c0a4b Use 2 different marks for NEAR/FAR polling : fixes wrong polling addresse problem after relocation
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3549
diff changeset
856 case MARK_POLL_RETURN_NEAR: {
aee1479c0a4b Use 2 different marks for NEAR/FAR polling : fixes wrong polling addresse problem after relocation
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3549
diff changeset
857 NativeInstruction* ni = nativeInstruction_at(instruction);
aee1479c0a4b Use 2 different marks for NEAR/FAR polling : fixes wrong polling addresse problem after relocation
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3549
diff changeset
858 int32_t* disp = (int32_t*) Assembler::locate_operand(instruction, Assembler::disp32_operand);
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
859 int32_t offset = *disp; // The Java code installed the polling page offset into the disp32 operand
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
860 intptr_t new_disp = (intptr_t) (os::get_polling_page() + offset) - (intptr_t) ni;
3550
aee1479c0a4b Use 2 different marks for NEAR/FAR polling : fixes wrong polling addresse problem after relocation
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3549
diff changeset
861 *disp = (int32_t)new_disp;
aee1479c0a4b Use 2 different marks for NEAR/FAR polling : fixes wrong polling addresse problem after relocation
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3549
diff changeset
862 }
aee1479c0a4b Use 2 different marks for NEAR/FAR polling : fixes wrong polling addresse problem after relocation
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3549
diff changeset
863 case MARK_POLL_RETURN_FAR:
3549
25765a764212 Add support for polling mark in code installer
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3538
diff changeset
864 _instructions->relocate(instruction, relocInfo::poll_return_type);
25765a764212 Add support for polling mark in code installer
Gilles Duboscq <gilles.duboscq@oracle.com>
parents: 3538
diff changeset
865 break;
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
866 default:
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1484
diff changeset
867 ShouldNotReachHere();
1428
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
868 break;
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
869 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
870 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
871 }
695451afc619 refactoring classes into separate files
Lukas Stadler <lukas.stadler@oracle.com>
parents:
diff changeset
872