annotate src/share/vm/compiler/abstractCompiler.hpp @ 12356:359f7e70ae7f

Reduce HotSpot diff and fix previous merge
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 11 Oct 2013 15:41:33 +0200
parents 64f41765b3d2
children f6c511451e4a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6842
b9a9ed0f8eeb 7197424: update copyright year to match last edit in jdk8 hotspot repository
mikael
parents: 6197
diff changeset
2 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1692
diff changeset
25 #ifndef SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1692
diff changeset
26 #define SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1692
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1692
diff changeset
28 #include "ci/compilerInterface.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1692
diff changeset
29
0
a61af66fc99e Initial load
duke
parents:
diff changeset
30 typedef void (*initializer)(void);
a61af66fc99e Initial load
duke
parents:
diff changeset
31
7568
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
32 #ifdef GRAAL
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
33 class CompilerStatistics {
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
34 public:
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
35 elapsedTimer _t_osr_compilation;
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
36 elapsedTimer _t_standard_compilation;
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
37 int _sum_osr_bytes_compiled;
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
38 int _sum_standard_bytes_compiled;
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
39 CompilerStatistics() : _sum_osr_bytes_compiled(0), _sum_standard_bytes_compiled(0) {}
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
40 };
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
41 #endif
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
42
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 1972
diff changeset
43 class AbstractCompiler : public CHeapObj<mtCompiler> {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
44 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
45 bool _is_initialized; // Mark whether compiler object is initialized
a61af66fc99e Initial load
duke
parents:
diff changeset
46
a61af66fc99e Initial load
duke
parents:
diff changeset
47 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
48 // Used for tracking global state of compiler runtime initialization
a61af66fc99e Initial load
duke
parents:
diff changeset
49 enum { uninitialized, initializing, initialized };
a61af66fc99e Initial load
duke
parents:
diff changeset
50
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: 7149
diff changeset
51 // The (closed set) of concrete compiler classes. Using an tag like this
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: 7149
diff changeset
52 // avoids a confusing use of macros around the definition of the
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: 7149
diff changeset
53 // 'is_<compiler type>' methods.
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: 7149
diff changeset
54 enum Type { c1, c2, shark, graal };
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: 7149
diff changeset
55
0
a61af66fc99e Initial load
duke
parents:
diff changeset
56 // This method will call the initialization method "f" once (per compiler class/subclass)
a61af66fc99e Initial load
duke
parents:
diff changeset
57 // and do so without holding any locks
a61af66fc99e Initial load
duke
parents:
diff changeset
58 void initialize_runtimes(initializer f, volatile int* state);
a61af66fc99e Initial load
duke
parents:
diff changeset
59
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: 7149
diff changeset
60 private:
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: 7149
diff changeset
61 Type _type;
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: 7149
diff changeset
62
7568
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
63 #ifdef GRAAL
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
64 CompilerStatistics _stats;
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
65 #endif
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
66
0
a61af66fc99e Initial load
duke
parents:
diff changeset
67 public:
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: 7149
diff changeset
68 AbstractCompiler(Type type) : _is_initialized(false), _type(type) {}
0
a61af66fc99e Initial load
duke
parents:
diff changeset
69
a61af66fc99e Initial load
duke
parents:
diff changeset
70 // Name of this compiler
a61af66fc99e Initial load
duke
parents:
diff changeset
71 virtual const char* name() = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
72
7149
6a8b22829e36 made the Graal implementation of the C++ AbstractCompiler class support native wrapper generation
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
73 // Should a native wrapper be generated by the runtime. This method
6a8b22829e36 made the Graal implementation of the C++ AbstractCompiler class support native wrapper generation
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
74 // does *not* answer the question "can this compiler generate code for
6a8b22829e36 made the Graal implementation of the C++ AbstractCompiler class support native wrapper generation
Doug Simon <doug.simon@oracle.com>
parents: 7125
diff changeset
75 // a native method".
0
a61af66fc99e Initial load
duke
parents:
diff changeset
76 virtual bool supports_native() { return true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
77 virtual bool supports_osr () { return true; }
7644
64f41765b3d2 Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7643
diff changeset
78 virtual bool can_compile_method(methodHandle method) { return true; }
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: 7149
diff changeset
79 bool is_c1 () { return _type == c1; }
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: 7149
diff changeset
80 bool is_c2 () { return _type == c2; }
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: 7149
diff changeset
81 bool is_shark() { return _type == shark; }
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: 7149
diff changeset
82 bool is_graal() { return _type == graal; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
83
12356
359f7e70ae7f Reduce HotSpot diff and fix previous merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7644
diff changeset
84 // Customization
359f7e70ae7f Reduce HotSpot diff and fix previous merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7644
diff changeset
85 virtual bool needs_stubs () = 0;
359f7e70ae7f Reduce HotSpot diff and fix previous merge
Gilles Duboscq <duboscq@ssw.jku.at>
parents: 7644
diff changeset
86
0
a61af66fc99e Initial load
duke
parents:
diff changeset
87 void mark_initialized() { _is_initialized = true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
88 bool is_initialized() { return _is_initialized; }
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 virtual void initialize() = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
91
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // Compilation entry point for methods
a61af66fc99e Initial load
duke
parents:
diff changeset
93 virtual void compile_method(ciEnv* env,
a61af66fc99e Initial load
duke
parents:
diff changeset
94 ciMethod* target,
a61af66fc99e Initial load
duke
parents:
diff changeset
95 int entry_bci) {
a61af66fc99e Initial load
duke
parents:
diff changeset
96 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
97 }
a61af66fc99e Initial load
duke
parents:
diff changeset
98
a61af66fc99e Initial load
duke
parents:
diff changeset
99
a61af66fc99e Initial load
duke
parents:
diff changeset
100 // Print compilation timers and statistics
a61af66fc99e Initial load
duke
parents:
diff changeset
101 virtual void print_timers() {
a61af66fc99e Initial load
duke
parents:
diff changeset
102 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
103 }
7568
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
104
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
105 #ifdef GRAAL
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
106 CompilerStatistics* stats() { return &_stats; }
140d4d4ab3b9 added per-compiler compilation speed statistics for C1 and C2 (included in output produced by -XX:+CITime)
Doug Simon <doug.simon@oracle.com>
parents: 7154
diff changeset
107 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
108 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1692
diff changeset
109
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1692
diff changeset
110 #endif // SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP