annotate src/share/vm/compiler/abstractCompiler.hpp @ 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
author Doug Simon <doug.simon@oracle.com>
date Wed, 12 Dec 2012 21:36:40 +0100
parents 6a8b22829e36
children 140d4d4ab3b9
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
6197
d2a62e0f25eb 6995781: Native Memory Tracking (Phase 1)
zgu
parents: 1972
diff changeset
32 class AbstractCompiler : public CHeapObj<mtCompiler> {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
33 private:
a61af66fc99e Initial load
duke
parents:
diff changeset
34 bool _is_initialized; // Mark whether compiler object is initialized
a61af66fc99e Initial load
duke
parents:
diff changeset
35
a61af66fc99e Initial load
duke
parents:
diff changeset
36 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // Used for tracking global state of compiler runtime initialization
a61af66fc99e Initial load
duke
parents:
diff changeset
38 enum { uninitialized, initializing, initialized };
a61af66fc99e Initial load
duke
parents:
diff changeset
39
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
40 // 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
41 // 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
42 // '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
43 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
44
0
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // This method will call the initialization method "f" once (per compiler class/subclass)
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // and do so without holding any locks
a61af66fc99e Initial load
duke
parents:
diff changeset
47 void initialize_runtimes(initializer f, volatile int* state);
a61af66fc99e Initial load
duke
parents:
diff changeset
48
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
49 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
50 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
51
0
a61af66fc99e Initial load
duke
parents:
diff changeset
52 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
53 AbstractCompiler(Type type) : _is_initialized(false), _type(type) {}
0
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // Name of this compiler
a61af66fc99e Initial load
duke
parents:
diff changeset
56 virtual const char* name() = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
57
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
58 // 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
59 // 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
60 // a native method".
0
a61af66fc99e Initial load
duke
parents:
diff changeset
61 virtual bool supports_native() { return true; }
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
62
0
a61af66fc99e Initial load
duke
parents:
diff changeset
63 virtual bool supports_osr () { 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
64 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
65 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
66 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
67 bool is_graal() { return _type == graal; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 void mark_initialized() { _is_initialized = true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
70 bool is_initialized() { return _is_initialized; }
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 virtual void initialize() = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // Compilation entry point for methods
a61af66fc99e Initial load
duke
parents:
diff changeset
75 virtual void compile_method(ciEnv* env,
a61af66fc99e Initial load
duke
parents:
diff changeset
76 ciMethod* target,
a61af66fc99e Initial load
duke
parents:
diff changeset
77 int entry_bci) {
a61af66fc99e Initial load
duke
parents:
diff changeset
78 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
79 }
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81
a61af66fc99e Initial load
duke
parents:
diff changeset
82 // Print compilation timers and statistics
a61af66fc99e Initial load
duke
parents:
diff changeset
83 virtual void print_timers() {
a61af66fc99e Initial load
duke
parents:
diff changeset
84 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
85 }
a61af66fc99e Initial load
duke
parents:
diff changeset
86 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1692
diff changeset
87
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1692
diff changeset
88 #endif // SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP