src/share/vm/oops/generateOopMap.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -398,14 +398,13 @@
   initialize_bb();
 
   bool fellThrough = false;  // False to get first BB marked.
 
   // First mark all exception handlers as start of a basic-block
-  typeArrayOop excps = method()->exception_table();
-  for(int i = 0; i < excps->length(); i += 4) {
-    int handler_pc_idx = i+2;
-    bb_mark_fct(this, excps->int_at(handler_pc_idx), NULL);
+  ExceptionTable excps(method());
+  for(int i = 0; i < excps.length(); i ++) {
+    bb_mark_fct(this, excps.handler_pc(i), NULL);
   }
 
   // Then iterate through the code
   BytecodeStream bcs(_method);
   Bytecodes::Code bytecode;

@@ -448,14 +447,13 @@
 void GenerateOopMap::mark_reachable_code() {
   int change = 1; // int to get function pointers to work
 
   // Mark entry basic block as alive and all exception handlers
   _basic_blocks[0].mark_as_alive();
-  typeArrayOop excps = method()->exception_table();
-  for(int i = 0; i < excps->length(); i += 4) {
-    int handler_pc_idx = i+2;
-    BasicBlock *bb = get_basic_block_at(excps->int_at(handler_pc_idx));
+  ExceptionTable excps(method());
+  for(int i = 0; i < excps.length(); i++) {
+    BasicBlock *bb = get_basic_block_at(excps.handler_pc(i));
     // If block is not already alive (due to multiple exception handlers to same bb), then
     // make it alive
     if (bb->is_dead()) bb->mark_as_alive();
   }
 

@@ -1179,16 +1177,16 @@
       break;
   }
 
   if (_has_exceptions) {
     int bci = itr->bci();
-    typeArrayOop exct  = method()->exception_table();
-    for(int i = 0; i< exct->length(); i+=4) {
-      int start_pc   = exct->int_at(i);
-      int end_pc     = exct->int_at(i+1);
-      int handler_pc = exct->int_at(i+2);
-      int catch_type = exct->int_at(i+3);
+    ExceptionTable exct(method());
+    for(int i = 0; i< exct.length(); i++) {
+      int start_pc   = exct.start_pc(i);
+      int end_pc     = exct.end_pc(i);
+      int handler_pc = exct.handler_pc(i);
+      int catch_type = exct.catch_type_index(i);
 
       if (start_pc <= bci && bci < end_pc) {
         BasicBlock *excBB = get_basic_block_at(handler_pc);
         CellTypeState *excStk = excBB->stack();
         CellTypeState *cOpStck = stack();

@@ -2053,11 +2051,11 @@
   // Initialize values
   _got_error      = false;
   _conflict       = false;
   _max_locals     = method()->max_locals();
   _max_stack      = method()->max_stack();
-  _has_exceptions = (method()->exception_table()->length() > 0);
+  _has_exceptions = (method()->has_exception_handler());
   _nof_refval_conflicts = 0;
   _init_vars      = new GrowableArray<intptr_t>(5);  // There are seldom more than 5 init_vars
   _report_result  = false;
   _report_result_for_send = false;
   _new_var_map    = NULL;

@@ -2068,13 +2066,14 @@
   if (TraceNewOopMapGeneration) {
     tty->print("Method name: %s\n", method()->name()->as_C_string());
     if (Verbose) {
       _method->print_codes();
       tty->print_cr("Exception table:");
-      typeArrayOop excps = method()->exception_table();
-      for(int i = 0; i < excps->length(); i += 4) {
-        tty->print_cr("[%d - %d] -> %d", excps->int_at(i + 0), excps->int_at(i + 1), excps->int_at(i + 2));
+      ExceptionTable excps(method());
+      for(int i = 0; i < excps.length(); i ++) {
+        tty->print_cr("[%d - %d] -> %d",
+                      excps.start_pc(i), excps.end_pc(i), excps.handler_pc(i));
       }
     }
   }
 
   // if no code - do nothing