Mercurial > hg > truffle
comparison src/share/vm/ci/ciEnv.cpp @ 18041:52b4284cb496
Merge with jdk8u20-b26
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Wed, 15 Oct 2014 16:02:50 +0200 |
parents | 4ca6dc0799b6 78bbf4d43a14 |
children | 7848fc12602b |
comparison
equal
deleted
inserted
replaced
17606:45d7b2c7029d | 18041:52b4284cb496 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
924 ExceptionHandlerTable* handler_table, | 924 ExceptionHandlerTable* handler_table, |
925 ImplicitExceptionTable* inc_table, | 925 ImplicitExceptionTable* inc_table, |
926 AbstractCompiler* compiler, | 926 AbstractCompiler* compiler, |
927 int comp_level, | 927 int comp_level, |
928 bool has_unsafe_access, | 928 bool has_unsafe_access, |
929 bool has_wide_vectors) { | 929 bool has_wide_vectors, |
930 RTMState rtm_state) { | |
930 VM_ENTRY_MARK; | 931 VM_ENTRY_MARK; |
931 nmethod* nm = NULL; | 932 nmethod* nm = NULL; |
932 { | 933 { |
933 // To prevent compile queue updates. | 934 // To prevent compile queue updates. |
934 MutexLocker locker(MethodCompileQueue_lock, THREAD); | 935 MutexLocker locker(MethodCompileQueue_lock, THREAD); |
971 validate_compile_task_dependencies(target); | 972 validate_compile_task_dependencies(target); |
972 } | 973 } |
973 | 974 |
974 methodHandle method(THREAD, target->get_Method()); | 975 methodHandle method(THREAD, target->get_Method()); |
975 | 976 |
977 #if INCLUDE_RTM_OPT | |
978 if (!failing() && (rtm_state != NoRTM) && | |
979 (method()->method_data() != NULL) && | |
980 (method()->method_data()->rtm_state() != rtm_state)) { | |
981 // Preemptive decompile if rtm state was changed. | |
982 record_failure("RTM state change invalidated rtm code"); | |
983 } | |
984 #endif | |
985 | |
976 if (failing()) { | 986 if (failing()) { |
977 // While not a true deoptimization, it is a preemptive decompile. | 987 // While not a true deoptimization, it is a preemptive decompile. |
978 MethodData* mdo = method()->method_data(); | 988 MethodData* mdo = method()->method_data(); |
979 if (mdo != NULL) { | 989 if (mdo != NULL) { |
980 mdo->inc_decompile_count(); | 990 mdo->inc_decompile_count(); |
997 orig_pc_offset, | 1007 orig_pc_offset, |
998 debug_info(), dependencies(), code_buffer, | 1008 debug_info(), dependencies(), code_buffer, |
999 frame_words, oop_map_set, | 1009 frame_words, oop_map_set, |
1000 handler_table, inc_table, | 1010 handler_table, inc_table, |
1001 compiler, comp_level); | 1011 compiler, comp_level); |
1002 | |
1003 // Free codeBlobs | 1012 // Free codeBlobs |
1004 code_buffer->free_blob(); | 1013 code_buffer->free_blob(); |
1005 | 1014 |
1006 if (nm != NULL) { | 1015 if (nm != NULL) { |
1007 nm->set_has_unsafe_access(has_unsafe_access); | 1016 nm->set_has_unsafe_access(has_unsafe_access); |
1008 nm->set_has_wide_vectors(has_wide_vectors); | 1017 nm->set_has_wide_vectors(has_wide_vectors); |
1018 #if INCLUDE_RTM_OPT | |
1019 nm->set_rtm_state(rtm_state); | |
1020 #endif | |
1009 | 1021 |
1010 // Record successful registration. | 1022 // Record successful registration. |
1011 // (Put nm into the task handle *before* publishing to the Java heap.) | 1023 // (Put nm into the task handle *before* publishing to the Java heap.) |
1012 if (task() != NULL) { | 1024 if (task() != NULL) { |
1013 task()->set_code(nm); | 1025 task()->set_code(nm); |
1145 // ------------------------------------------------------------------ | 1157 // ------------------------------------------------------------------ |
1146 // ciEnv::dump_replay_data* | 1158 // ciEnv::dump_replay_data* |
1147 | 1159 |
1148 // Don't change thread state and acquire any locks. | 1160 // Don't change thread state and acquire any locks. |
1149 // Safe to call from VM error reporter. | 1161 // Safe to call from VM error reporter. |
1162 | |
1163 void ciEnv::dump_compile_data(outputStream* out) { | |
1164 CompileTask* task = this->task(); | |
1165 Method* method = task->method(); | |
1166 int entry_bci = task->osr_bci(); | |
1167 int comp_level = task->comp_level(); | |
1168 out->print("compile %s %s %s %d %d", | |
1169 method->klass_name()->as_quoted_ascii(), | |
1170 method->name()->as_quoted_ascii(), | |
1171 method->signature()->as_quoted_ascii(), | |
1172 entry_bci, comp_level); | |
1173 if (compiler_data() != NULL) { | |
1174 if (is_c2_compile(comp_level)) { // C2 or Shark | |
1175 #ifdef COMPILER2 | |
1176 // Dump C2 inlining data. | |
1177 ((Compile*)compiler_data())->dump_inline_data(out); | |
1178 #endif | |
1179 } else if (is_c1_compile(comp_level)) { // C1 | |
1180 #ifdef COMPILER1 | |
1181 // Dump C1 inlining data. | |
1182 ((Compilation*)compiler_data())->dump_inline_data(out); | |
1183 #endif | |
1184 } | |
1185 } | |
1186 out->cr(); | |
1187 } | |
1188 | |
1150 void ciEnv::dump_replay_data_unsafe(outputStream* out) { | 1189 void ciEnv::dump_replay_data_unsafe(outputStream* out) { |
1151 ResourceMark rm; | 1190 ResourceMark rm; |
1152 #if INCLUDE_JVMTI | 1191 #if INCLUDE_JVMTI |
1153 out->print_cr("JvmtiExport can_access_local_variables %d", _jvmti_can_access_local_variables); | 1192 out->print_cr("JvmtiExport can_access_local_variables %d", _jvmti_can_access_local_variables); |
1154 out->print_cr("JvmtiExport can_hotswap_or_post_breakpoint %d", _jvmti_can_hotswap_or_post_breakpoint); | 1193 out->print_cr("JvmtiExport can_hotswap_or_post_breakpoint %d", _jvmti_can_hotswap_or_post_breakpoint); |
1158 GrowableArray<ciMetadata*>* objects = _factory->get_ci_metadata(); | 1197 GrowableArray<ciMetadata*>* objects = _factory->get_ci_metadata(); |
1159 out->print_cr("# %d ciObject found", objects->length()); | 1198 out->print_cr("# %d ciObject found", objects->length()); |
1160 for (int i = 0; i < objects->length(); i++) { | 1199 for (int i = 0; i < objects->length(); i++) { |
1161 objects->at(i)->dump_replay_data(out); | 1200 objects->at(i)->dump_replay_data(out); |
1162 } | 1201 } |
1163 CompileTask* task = this->task(); | 1202 dump_compile_data(out); |
1164 Method* method = task->method(); | |
1165 int entry_bci = task->osr_bci(); | |
1166 int comp_level = task->comp_level(); | |
1167 // Klass holder = method->method_holder(); | |
1168 out->print_cr("compile %s %s %s %d %d", | |
1169 method->klass_name()->as_quoted_ascii(), | |
1170 method->name()->as_quoted_ascii(), | |
1171 method->signature()->as_quoted_ascii(), | |
1172 entry_bci, comp_level); | |
1173 out->flush(); | 1203 out->flush(); |
1174 } | 1204 } |
1175 | 1205 |
1176 void ciEnv::dump_replay_data(outputStream* out) { | 1206 void ciEnv::dump_replay_data(outputStream* out) { |
1177 GUARDED_VM_ENTRY( | 1207 GUARDED_VM_ENTRY( |
1178 MutexLocker ml(Compile_lock); | 1208 MutexLocker ml(Compile_lock); |
1179 dump_replay_data_unsafe(out); | 1209 dump_replay_data_unsafe(out); |
1180 ) | 1210 ) |
1181 } | 1211 } |
1212 | |
1213 void ciEnv::dump_replay_data(int compile_id) { | |
1214 static char buffer[O_BUFLEN]; | |
1215 int ret = jio_snprintf(buffer, O_BUFLEN, "replay_pid%p_compid%d.log", os::current_process_id(), compile_id); | |
1216 if (ret > 0) { | |
1217 int fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); | |
1218 if (fd != -1) { | |
1219 FILE* replay_data_file = os::open(fd, "w"); | |
1220 if (replay_data_file != NULL) { | |
1221 fileStream replay_data_stream(replay_data_file, /*need_close=*/true); | |
1222 dump_replay_data(&replay_data_stream); | |
1223 tty->print_cr("# Compiler replay data is saved as: %s", buffer); | |
1224 } else { | |
1225 tty->print_cr("# Can't open file to dump replay data."); | |
1226 } | |
1227 } | |
1228 } | |
1229 } | |
1230 | |
1231 void ciEnv::dump_inline_data(int compile_id) { | |
1232 static char buffer[O_BUFLEN]; | |
1233 int ret = jio_snprintf(buffer, O_BUFLEN, "inline_pid%p_compid%d.log", os::current_process_id(), compile_id); | |
1234 if (ret > 0) { | |
1235 int fd = open(buffer, O_RDWR | O_CREAT | O_TRUNC, 0666); | |
1236 if (fd != -1) { | |
1237 FILE* inline_data_file = os::open(fd, "w"); | |
1238 if (inline_data_file != NULL) { | |
1239 fileStream replay_data_stream(inline_data_file, /*need_close=*/true); | |
1240 GUARDED_VM_ENTRY( | |
1241 MutexLocker ml(Compile_lock); | |
1242 dump_compile_data(&replay_data_stream); | |
1243 ) | |
1244 replay_data_stream.flush(); | |
1245 tty->print("# Compiler inline data is saved as: "); | |
1246 tty->print_cr("%s", buffer); | |
1247 } else { | |
1248 tty->print_cr("# Can't open file to dump inline data."); | |
1249 } | |
1250 } | |
1251 } | |
1252 } |