Mercurial > hg > truffle
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 |
rev | line source |
---|---|
0 | 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 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
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 | 22 * |
23 */ | |
24 | |
1972 | 25 #ifndef SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP |
26 #define SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP | |
27 | |
28 #include "ci/compilerInterface.hpp" | |
29 | |
0 | 30 typedef void (*initializer)(void); |
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 | 43 class AbstractCompiler : public CHeapObj<mtCompiler> { |
0 | 44 private: |
45 bool _is_initialized; // Mark whether compiler object is initialized | |
46 | |
47 protected: | |
48 // Used for tracking global state of compiler runtime initialization | |
49 enum { uninitialized, initializing, initialized }; | |
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 | 56 // This method will call the initialization method "f" once (per compiler class/subclass) |
57 // and do so without holding any locks | |
58 void initialize_runtimes(initializer f, volatile int* state); | |
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 | 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 | 69 |
70 // Name of this compiler | |
71 virtual const char* name() = 0; | |
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 | 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 | 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 | 84 |
85 void mark_initialized() { _is_initialized = true; } | |
86 bool is_initialized() { return _is_initialized; } | |
87 | |
88 virtual void initialize() = 0; | |
89 | |
90 // Compilation entry point for methods | |
91 virtual void compile_method(ciEnv* env, | |
92 ciMethod* target, | |
93 int entry_bci) { | |
94 ShouldNotReachHere(); | |
95 } | |
96 | |
97 | |
98 // Print compilation timers and statistics | |
99 virtual void print_timers() { | |
100 ShouldNotReachHere(); | |
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 | 106 }; |
1972 | 107 |
108 #endif // SHARE_VM_COMPILER_ABSTRACTCOMPILER_HPP |