Mercurial > hg > truffle
annotate src/share/vm/utilities/decoder.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 | 3b01d0321dfa |
children | 38f750491293 |
rev | line source |
---|---|
2022
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
1 /* |
4917 | 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
2022
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
4 * |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
8 * |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
13 * accompanied this code). |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
14 * |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
18 * |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
21 * questions. |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
22 * |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
23 */ |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
24 |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
25 |
4803 | 26 #ifndef SHARE_VM_UTILITIES_DECODER_HPP |
27 #define SHARE_VM_UTILITIES_DECODER_HPP | |
2022
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
28 |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
29 #include "memory/allocation.hpp" |
4803 | 30 #include "runtime/mutex.hpp" |
2022
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
31 |
6197 | 32 class AbstractDecoder : public CHeapObj<mtInternal> { |
4803 | 33 public: |
2022
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
34 // status code for decoding native C frame |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
35 enum decoder_status { |
4803 | 36 not_available = -10, // real decoder is not available |
37 no_error = 0, // successfully decoded frames | |
2022
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
38 out_of_memory, // out of memory |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
39 file_invalid, // invalid elf file |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
40 file_not_found, // could not found symbol file (on windows), such as jvm.pdb or jvm.map |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
41 helper_not_found, // could not load dbghelp.dll (Windows only) |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
42 helper_func_error, // decoding functions not found (Windows only) |
4803 | 43 helper_init_error // SymInitialize failed (Windows only) |
2022
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
44 }; |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
45 |
4917 | 46 // decode an pc address to corresponding function name and an offset from the beginning of |
47 // the function | |
48 virtual bool decode(address pc, char* buf, int buflen, int* offset, | |
49 const char* modulepath = NULL) = 0; | |
6258 | 50 virtual bool decode(address pc, char* buf, int buflen, int* offset, const void* base) = 0; |
51 | |
4917 | 52 // demangle a C++ symbol |
53 virtual bool demangle(const char* symbol, char* buf, int buflen) = 0; | |
54 // if the decoder can decode symbols in vm | |
55 virtual bool can_decode_C_frame_in_vm() const = 0; | |
56 | |
57 virtual decoder_status status() const { | |
58 return _decoder_status; | |
59 } | |
60 | |
61 virtual bool has_error() const { | |
62 return is_error(_decoder_status); | |
63 } | |
64 | |
65 static bool is_error(decoder_status status) { | |
66 return (status > 0); | |
67 } | |
68 | |
69 protected: | |
70 decoder_status _decoder_status; | |
71 }; | |
72 | |
73 // Do nothing decoder | |
74 class NullDecoder : public AbstractDecoder { | |
75 public: | |
4803 | 76 NullDecoder() { |
77 _decoder_status = not_available; | |
78 } | |
79 | |
80 ~NullDecoder() {}; | |
81 | |
82 virtual bool decode(address pc, char* buf, int buflen, int* offset, | |
83 const char* modulepath = NULL) { | |
84 return false; | |
85 } | |
86 | |
6258 | 87 virtual bool decode(address pc, char* buf, int buflen, int* offset, const void* base) { |
88 return false; | |
89 } | |
90 | |
4803 | 91 virtual bool demangle(const char* symbol, char* buf, int buflen) { |
92 return false; | |
93 } | |
94 | |
95 virtual bool can_decode_C_frame_in_vm() const { | |
96 return false; | |
97 } | |
98 }; | |
99 | |
100 | |
4917 | 101 class Decoder : AllStatic { |
4803 | 102 public: |
103 static bool decode(address pc, char* buf, int buflen, int* offset, const char* modulepath = NULL); | |
6258 | 104 static bool decode(address pc, char* buf, int buflen, int* offset, const void* base); |
4803 | 105 static bool demangle(const char* symbol, char* buf, int buflen); |
2022
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
106 static bool can_decode_C_frame_in_vm(); |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
107 |
4917 | 108 // shutdown shared instance |
4803 | 109 static void shutdown(); |
110 protected: | |
4917 | 111 // shared decoder instance, _shared_instance_lock is needed |
112 static AbstractDecoder* get_shared_instance(); | |
113 // a private instance for error handler. Error handler can be | |
114 // triggered almost everywhere, including signal handler, where | |
115 // no lock can be taken. So the shared decoder can not be used | |
116 // in this scenario. | |
117 static AbstractDecoder* get_error_handler_instance(); | |
2022
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
118 |
4917 | 119 static AbstractDecoder* create_decoder(); |
4803 | 120 private: |
4917 | 121 static AbstractDecoder* _shared_decoder; |
122 static AbstractDecoder* _error_handler_decoder; | |
123 static NullDecoder _do_nothing_decoder; | |
2022
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
124 |
4803 | 125 protected: |
4917 | 126 static Mutex* _shared_decoder_lock; |
2022
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
127 }; |
2d4762ec74af
7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff
changeset
|
128 |
4803 | 129 #endif // SHARE_VM_UTILITIES_DECODER_HPP |