annotate src/share/vm/graal/graalCompiler.hpp @ 6948:e522a00b91aa

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
author Doug Simon <doug.simon@oracle.com>
date Mon, 12 Nov 2012 23:14:12 +0100
parents fd71ca8c5f88
children a0f4001cf53c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2516
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
1 /*
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
4 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
7 * published by the Free Software Foundation.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
8 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
13 * accompanied this code).
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
14 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
15 * You should have received a copy of the GNU General Public License version
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
18 *
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
a384fac3fd34 Removed anything OSR-related.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2502
diff changeset
21 * questions.
1410
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
22 */
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
23
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5554
diff changeset
24 #ifndef SHARE_VM_GRAAL_GRAAL_COMPILER_HPP
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5554
diff changeset
25 #define SHARE_VM_GRAAL_GRAAL_COMPILER_HPP
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5554
diff changeset
26
2045
9c96c873c42b Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1931
diff changeset
27 #include "compiler/abstractCompiler.hpp"
9c96c873c42b Fix includes to match new hotspot mechanism.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1931
diff changeset
28
5129
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
29 #define LEAF_GRAPH_ARRAY_SIZE (8192)
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
30
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
31 class GraalCompiler : public AbstractCompiler {
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
32
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
33 private:
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
34
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
35 bool _initialized;
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
36
5129
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
37 static GraalCompiler* _instance;
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
38
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
39 jlong _deopted_leaf_graphs[LEAF_GRAPH_ARRAY_SIZE];
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
40 int _deopted_leaf_graph_count;
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
41
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
42 public:
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
43
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
44 GraalCompiler();
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
45
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
46 static GraalCompiler* instance() { return _instance; }
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
47
1414
e1a275dbc8cd Executing a+b with C1X on HotSpot ;-) !
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1413
diff changeset
48
2891
75a99b4f1c98 Rebranded C++ part from C1X to Graal.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2890
diff changeset
49 virtual const char* name() { return "G"; }
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
50
1422
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
51 // Native / OSR not supported
5068
6e7c1fb1980f enabled wrappers for native method calls
Christian Haeubl <christian.haeubl@oracle.com>
parents: 4441
diff changeset
52 virtual bool supports_native() { return true; }
6674
fd71ca8c5f88 VM infrstructure for OnStackReplacement
Lukas Stadler <lukas.stadler@jku.at>
parents: 6442
diff changeset
53 virtual bool supports_osr () { return true; }
1422
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
54
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
55 // Pretend to be C1
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
56 bool is_c1 () { return true; }
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
57 bool is_c2 () { return false; }
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
58
1422
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
59 // Initialization
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
60 virtual void initialize();
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
61
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
62 // Compilation entry point for methods
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
63 virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci);
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
64
3651
a31028282e3e Support blocking compilation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3650
diff changeset
65 void compile_method(methodHandle target, int entry_bci, jboolean blocking);
3650
0e8a2a629afb Pass-by compilation broker.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3649
diff changeset
66
5129
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
67 void deopt_leaf_graph(jlong leaf_graph_id);
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
68 oop dump_deopted_leaf_graphs(TRAPS);
51111665eda6 Support for recording a leaf graph id for each deoptimization point in the debug info.
Lukas Stadler <lukas.stadler@jku.at>
parents: 5068
diff changeset
69
1422
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
70 // Print compilation timers and statistics
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
71 virtual void print_timers();
3637
ff6a991c6e3c Use GraalEnv to look up types.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3619
diff changeset
72
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
73 static Handle get_JavaTypeFromSignature(Symbol* signature, KlassHandle accessor, TRAPS);
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5129
diff changeset
74 static Handle get_JavaType(constantPoolHandle cp, int index, KlassHandle accessor, TRAPS);
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5129
diff changeset
75 static Handle get_JavaType(Symbol* klass_name, TRAPS);
6442
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5747
diff changeset
76 static Handle get_JavaTypeFromClass(Handle javaClassHandle, TRAPS);
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5129
diff changeset
77 static Handle get_JavaType(KlassHandle klass, TRAPS);
6442
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 5747
diff changeset
78 static Handle get_JavaField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, TRAPS);
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
79
5554
70f715dfbb41 Bring Java renamings and restructurings to the C++ part.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5129
diff changeset
80 static Handle createHotSpotResolvedJavaType(KlassHandle klass, Handle name, TRAPS);
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
81 static Handle createHotSpotResolvedJavaType(methodHandle method, TRAPS);
1429
abc670a709dc * -XX:TraceC1X=0...5 controls the native c1x tracing
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1428
diff changeset
82
2901
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
83 void exit();
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
84
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
85 static BasicType kindToBasicType(jchar ch);
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1461
diff changeset
86
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1461
diff changeset
87 static int to_cp_index_u2(int index) {
3577
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3565
diff changeset
88 // Tag.
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
89 return to_index_u2(index) + ConstantPool::CPCACHE_INDEX_TAG;
3577
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3565
diff changeset
90 }
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3565
diff changeset
91
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3565
diff changeset
92 static int to_index_u2(int index) {
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1461
diff changeset
93 // Swap.
3577
96c40b338c1a Added new method that loads and initializes a class that is referenced by a cp entry.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 3565
diff changeset
94 return ((index & 0xFF) << 8) | (index >> 8);
1931
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1461
diff changeset
95 }
48bbaead8b6c Adjustments after merge with OpenJDK repository.
Thomas Wuerthinger <wuerthinger@ssw.jku.at>
parents: 1461
diff changeset
96
3555
22d11b3bc561 Various hacks to be able to install machine code from a Java thread.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 3011
diff changeset
97 static void initialize_buffer_blob();
1422
3483ec571caf * using reflected objects instead of oops
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1421
diff changeset
98 };
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
99
1410
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
100 // Tracing macros
b30a2cd5e3a2 Added methods to c1x_VMExits.cpp
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents: 1406
diff changeset
101
2901
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
102 #define IF_TRACE_graal_1 if (!(TraceGraal >= 1)) ; else
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
103 #define IF_TRACE_graal_2 if (!(TraceGraal >= 2)) ; else
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
104 #define IF_TRACE_graal_3 if (!(TraceGraal >= 3)) ; else
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
105 #define IF_TRACE_graal_4 if (!(TraceGraal >= 4)) ; else
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
106 #define IF_TRACE_graal_5 if (!(TraceGraal >= 5)) ; else
1406
35069ca331f2 Hooked C1XCompiler class into the system.
Thomas Wuerthinger <thomas.wuerthinger@gmail.com>
parents:
diff changeset
107
1434
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
108 // using commas and else to keep one-instruction semantics
72cfb36c6bb2 * enabled all jtt tests
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1433
diff changeset
109
2901
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
110 #define TRACE_graal_1 if (!(TraceGraal >= 1 && (tty->print("TraceGraal-1: "), true))) ; else tty->print_cr
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
111 #define TRACE_graal_2 if (!(TraceGraal >= 2 && (tty->print(" TraceGraal-2: "), true))) ; else tty->print_cr
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
112 #define TRACE_graal_3 if (!(TraceGraal >= 3 && (tty->print(" TraceGraal-3: "), true))) ; else tty->print_cr
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
113 #define TRACE_graal_4 if (!(TraceGraal >= 4 && (tty->print(" TraceGraal-4: "), true))) ; else tty->print_cr
d577d07cedec Added time measurement for phases.
Thomas Wuerthinger <thomas@wuerthinger.net>
parents: 2891
diff changeset
114 #define TRACE_graal_5 if (!(TraceGraal >= 5 && (tty->print(" TraceGraal-5: "), true))) ; else tty->print_cr
1423
760213a60e8b * rewrite of the code installation
Lukas Stadler <lukas.stadler@oracle.com>
parents: 1422
diff changeset
115
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5554
diff changeset
116 #endif // SHARE_VM_GRAAL_GRAAL_COMPILER_HPP