annotate src/share/vm/compiler/abstractCompiler.hpp @ 9126:bc26f978b0ce

HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly don't use the (wrong) cached value, but ask the runtime on each request. Fixes regression on xml.* benchmarks @ specjvm2008. The problem was: After the constructor of Object was deoptimized due to an assumption violation, it was recompiled again after some time. However, on recompilation, the value of hasFinalizeSubclass for the class was not updated and it was compiled again with a, now wrong, assumption, which then triggers deoptimization again. This was repeated until it hit the recompilation limit (defined by PerMethodRecompilationCutoff), and therefore only executed by the interpreter from now on, causing the performance regression.
author Bernhard Urban <bernhard.urban@jku.at>
date Mon, 15 Apr 2013 19:54:58 +0200
parents 64f41765b3d2
children 359f7e70ae7f
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; }
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
77
0
a61af66fc99e Initial load
duke
parents:
diff changeset
78 virtual bool supports_osr () { return true; }
7644
64f41765b3d2 Merge fix.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 7643
diff changeset
79 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
80 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
81 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
82 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
83 bool is_graal() { return _type == graal; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
84
a61af66fc99e Initial load
duke
parents:
diff changeset
85 void mark_initialized() { _is_initialized = true; }
a61af66fc99e Initial load
duke
parents:
diff changeset
86 bool is_initialized() { return _is_initialized; }
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 virtual void initialize() = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 // Compilation entry point for methods
a61af66fc99e Initial load
duke
parents:
diff changeset
91 virtual void compile_method(ciEnv* env,
a61af66fc99e Initial load
duke
parents:
diff changeset
92 ciMethod* target,
a61af66fc99e Initial load
duke
parents:
diff changeset
93 int entry_bci) {
a61af66fc99e Initial load
duke
parents:
diff changeset
94 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
95 }
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97
a61af66fc99e Initial load
duke
parents:
diff changeset
98 // Print compilation timers and statistics
a61af66fc99e Initial load
duke
parents:
diff changeset
99 virtual void print_timers() {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 ShouldNotReachHere();
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
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
102
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
103 #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
104 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
105 #endif
0
a61af66fc99e Initial load
duke
parents:
diff changeset
106 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1692
diff changeset
107
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1692
diff changeset
108 #endif // SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP