Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/deoptimization.cpp @ 4978:99d3d8a72252
More ifdef GRAAL usage.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Mon, 27 Feb 2012 18:31:27 +0100 |
parents | 33df1aeaebbf |
children | 1b907994bf2d |
comparison
equal
deleted
inserted
replaced
4977:532be189cf09 | 4978:99d3d8a72252 |
---|---|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
18 * | 18 * |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 * | |
22 */ | 23 */ |
23 | 24 |
24 #include "precompiled.hpp" | 25 #include "precompiled.hpp" |
25 #include "classfile/systemDictionary.hpp" | 26 #include "classfile/systemDictionary.hpp" |
26 #include "code/debugInfoRec.hpp" | 27 #include "code/debugInfoRec.hpp" |
164 // decremented at the end of unpack_frames(). | 165 // decremented at the end of unpack_frames(). |
165 if (TraceDeoptimization) { | 166 if (TraceDeoptimization) { |
166 tty->print("Deoptimization "); | 167 tty->print("Deoptimization "); |
167 } | 168 } |
168 thread->inc_in_deopt_handler(); | 169 thread->inc_in_deopt_handler(); |
170 | |
169 return fetch_unroll_info_helper(thread); | 171 return fetch_unroll_info_helper(thread); |
170 JRT_END | 172 JRT_END |
171 | 173 |
172 | 174 |
173 // This is factored, since it is both called from a JRT_LEAF (deoptimization) and a JRT_ENTRY (uncommon_trap) | 175 // This is factored, since it is both called from a JRT_LEAF (deoptimization) and a JRT_ENTRY (uncommon_trap) |
207 vf = vf->sender(); | 209 vf = vf->sender(); |
208 } | 210 } |
209 assert(vf->is_compiled_frame(), "Wrong frame type"); | 211 assert(vf->is_compiled_frame(), "Wrong frame type"); |
210 chunk->push(compiledVFrame::cast(vf)); | 212 chunk->push(compiledVFrame::cast(vf)); |
211 | 213 |
212 // TODO(tw): Fix this hack after introducing GRAAL macro. | |
213 #if defined(COMPILER2) || defined(GRAAL) | 214 #if defined(COMPILER2) || defined(GRAAL) |
214 // Reallocate the non-escaping objects and restore their fields. Then | 215 // Reallocate the non-escaping objects and restore their fields. Then |
215 // relock objects if synchronization on them was eliminated. | 216 // relock objects if synchronization on them was eliminated. |
216 #ifdef COMPILER2 | 217 #ifdef COMPILER2 |
217 if (DoEscapeAnalysis || EliminateNestedLocks) { | 218 if (DoEscapeAnalysis || EliminateNestedLocks) { |
744 Threads::deoptimized_wrt_marked_nmethods(); | 745 Threads::deoptimized_wrt_marked_nmethods(); |
745 return 0; | 746 return 0; |
746 } | 747 } |
747 | 748 |
748 | 749 |
749 //#ifdef COMPILER2 | 750 #if defined(COMPILER2) || defined(GRAAL) |
750 bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS) { | 751 bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS) { |
751 Handle pending_exception(thread->pending_exception()); | 752 Handle pending_exception(thread->pending_exception()); |
752 const char* exception_file = thread->exception_file(); | 753 const char* exception_file = thread->exception_file(); |
753 int exception_line = thread->exception_line(); | 754 int exception_line = thread->exception_line(); |
754 thread->clear_pending_exception(); | 755 thread->clear_pending_exception(); |
989 k->oop_print_on(obj(), tty); | 990 k->oop_print_on(obj(), tty); |
990 } | 991 } |
991 } | 992 } |
992 } | 993 } |
993 #endif | 994 #endif |
994 //#endif // COMPILER2 | 995 #endif // COMPILER2 || GRAAL |
995 | 996 |
996 vframeArray* Deoptimization::create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk) { | 997 vframeArray* Deoptimization::create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk) { |
997 Events::log(thread, "DEOPT PACKING pc=" INTPTR_FORMAT " sp=" INTPTR_FORMAT, fr.pc(), fr.sp()); | 998 Events::log(thread, "DEOPT PACKING pc=" INTPTR_FORMAT " sp=" INTPTR_FORMAT, fr.pc(), fr.sp()); |
998 | 999 |
999 #ifndef PRODUCT | 1000 #ifndef PRODUCT |
1188 thread->popframe_preserve_args(in_ByteSize(bytes_to_save), start_address); | 1189 thread->popframe_preserve_args(in_ByteSize(bytes_to_save), start_address); |
1189 } | 1190 } |
1190 JRT_END | 1191 JRT_END |
1191 | 1192 |
1192 | 1193 |
1194 #if defined(COMPILER2) || defined(SHARK) || defined(GRAAL) | |
1193 void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int index, TRAPS) { | 1195 void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int index, TRAPS) { |
1194 // in case of an unresolved klass entry, load the class. | 1196 // in case of an unresolved klass entry, load the class. |
1195 if (constant_pool->tag_at(index).is_unresolved_klass()) { | 1197 if (constant_pool->tag_at(index).is_unresolved_klass()) { |
1196 klassOop tk = constant_pool->klass_at(index, CHECK); | 1198 klassOop tk = constant_pool->klass_at(index, CHECK); |
1197 return; | 1199 return; |
1962 } | 1964 } |
1963 #undef PRINT_STAT_LINE | 1965 #undef PRINT_STAT_LINE |
1964 if (xtty != NULL) xtty->tail("statistics"); | 1966 if (xtty != NULL) xtty->tail("statistics"); |
1965 } | 1967 } |
1966 } | 1968 } |
1969 #else // COMPILER2 || SHARK || GRAAL | |
1970 | |
1971 | |
1972 // Stubs for C1 only system. | |
1973 bool Deoptimization::trap_state_is_recompiled(int trap_state) { | |
1974 return false; | |
1975 } | |
1976 | |
1977 const char* Deoptimization::trap_reason_name(int reason) { | |
1978 return "unknown"; | |
1979 } | |
1980 | |
1981 void Deoptimization::print_statistics() { | |
1982 // no output | |
1983 } | |
1984 | |
1985 void | |
1986 Deoptimization::update_method_data_from_interpreter(methodDataHandle trap_mdo, int trap_bci, int reason) { | |
1987 // no udpate | |
1988 } | |
1989 | |
1990 int Deoptimization::trap_state_has_reason(int trap_state, int reason) { | |
1991 return 0; | |
1992 } | |
1993 | |
1994 void Deoptimization::gather_statistics(DeoptReason reason, DeoptAction action, | |
1995 Bytecodes::Code bc) { | |
1996 // no update | |
1997 } | |
1998 | |
1999 const char* Deoptimization::format_trap_state(char* buf, size_t buflen, | |
2000 int trap_state) { | |
2001 jio_snprintf(buf, buflen, "#%d", trap_state); | |
2002 return buf; | |
2003 } | |
2004 | |
2005 #endif // COMPILER2 || SHARK || GRAAL |