< prev index next >

src/share/vm/oops/generateOopMap.cpp

Print this page
rev 13265 : imported patch 8181917-refactor-ul-logstream


   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  *
  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
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "interpreter/bytecodeStream.hpp"
  27 #include "logging/log.hpp"

  28 #include "oops/generateOopMap.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "oops/symbol.hpp"
  31 #include "prims/jvm.h"
  32 #include "runtime/handles.inline.hpp"
  33 #include "runtime/java.hpp"
  34 #include "runtime/relocator.hpp"
  35 #include "runtime/timerTrace.hpp"
  36 #include "utilities/bitMap.inline.hpp"
  37 #include "utilities/ostream.hpp"
  38 
  39 //
  40 //
  41 // Compute stack layouts for each instruction in method.
  42 //
  43 //  Problems:
  44 //  - What to do about jsr with different types of local vars?
  45 //  Need maps that are conditional on jsr path?
  46 //  - Jsr and exceptions should be done more efficiently (the retAddr stuff)
  47 //


1247   }
1248 
1249   // We pessimistically assume that this exception can escape the
1250   // method. (It is possible that it will always be caught, but
1251   // we don't care to analyse the types of the catch clauses.)
1252 
1253   // We don't set _monitor_top to bad_monitors because there are no successors
1254   // to this exceptional exit.
1255 
1256   if (log_is_enabled(Info, monitormismatch) && _monitor_safe) {
1257     // We check _monitor_safe so that we only report the first mismatched
1258     // exceptional exit.
1259     report_monitor_mismatch("non-empty monitor stack at exceptional exit");
1260   }
1261   _monitor_safe = false;
1262 
1263 }
1264 
1265 void GenerateOopMap::report_monitor_mismatch(const char *msg) {
1266   ResourceMark rm;
1267   outputStream* out = Log(monitormismatch)::info_stream();
1268   out->print("Monitor mismatch in method ");
1269   method()->print_short_name(out);
1270   out->print_cr(": %s", msg);
1271 }
1272 
1273 void GenerateOopMap::print_states(outputStream *os,
1274                                   CellTypeState* vec, int num) {
1275   for (int i = 0; i < num; i++) {
1276     vec[i].print(tty);
1277   }
1278 }
1279 
1280 // Print the state values at the current bytecode.
1281 void GenerateOopMap::print_current_state(outputStream   *os,
1282                                          BytecodeStream *currentBC,
1283                                          bool            detailed) {
1284   if (detailed) {
1285     os->print("     %4d vars     = ", currentBC->bci());
1286     print_states(os, vars(), _max_locals);
1287     os->print("    %s", Bytecodes::name(currentBC->code()));
1288   } else {
1289     os->print("    %4d  vars = '%s' ", currentBC->bci(),  state_vec_to_string(vars(), _max_locals));
1290     os->print("     stack = '%s' ", state_vec_to_string(stack(), _stack_top));




   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  *
  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
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "interpreter/bytecodeStream.hpp"
  27 #include "logging/log.hpp"
  28 #include "logging/logStream.hpp"
  29 #include "oops/generateOopMap.hpp"
  30 #include "oops/oop.inline.hpp"
  31 #include "oops/symbol.hpp"
  32 #include "prims/jvm.h"
  33 #include "runtime/handles.inline.hpp"
  34 #include "runtime/java.hpp"
  35 #include "runtime/relocator.hpp"
  36 #include "runtime/timerTrace.hpp"
  37 #include "utilities/bitMap.inline.hpp"
  38 #include "utilities/ostream.hpp"
  39 
  40 //
  41 //
  42 // Compute stack layouts for each instruction in method.
  43 //
  44 //  Problems:
  45 //  - What to do about jsr with different types of local vars?
  46 //  Need maps that are conditional on jsr path?
  47 //  - Jsr and exceptions should be done more efficiently (the retAddr stuff)
  48 //


1248   }
1249 
1250   // We pessimistically assume that this exception can escape the
1251   // method. (It is possible that it will always be caught, but
1252   // we don't care to analyse the types of the catch clauses.)
1253 
1254   // We don't set _monitor_top to bad_monitors because there are no successors
1255   // to this exceptional exit.
1256 
1257   if (log_is_enabled(Info, monitormismatch) && _monitor_safe) {
1258     // We check _monitor_safe so that we only report the first mismatched
1259     // exceptional exit.
1260     report_monitor_mismatch("non-empty monitor stack at exceptional exit");
1261   }
1262   _monitor_safe = false;
1263 
1264 }
1265 
1266 void GenerateOopMap::report_monitor_mismatch(const char *msg) {
1267   ResourceMark rm;
1268   LogStream ls(Log(monitormismatch)::info());
1269   ls.print("Monitor mismatch in method ");
1270   method()->print_short_name(&ls);
1271   ls.print_cr(": %s", msg);
1272 }
1273 
1274 void GenerateOopMap::print_states(outputStream *os,
1275                                   CellTypeState* vec, int num) {
1276   for (int i = 0; i < num; i++) {
1277     vec[i].print(tty);
1278   }
1279 }
1280 
1281 // Print the state values at the current bytecode.
1282 void GenerateOopMap::print_current_state(outputStream   *os,
1283                                          BytecodeStream *currentBC,
1284                                          bool            detailed) {
1285   if (detailed) {
1286     os->print("     %4d vars     = ", currentBC->bci());
1287     print_states(os, vars(), _max_locals);
1288     os->print("    %s", Bytecodes::name(currentBC->code()));
1289   } else {
1290     os->print("    %4d  vars = '%s' ", currentBC->bci(),  state_vec_to_string(vars(), _max_locals));
1291     os->print("     stack = '%s' ", state_vec_to_string(stack(), _stack_top));


< prev index next >