< prev index next >

src/share/vm/code/exceptionHandlerTable.cpp

Print this page




  85   assert(scope_depths_from_top_scope == NULL || handler_bcis->length() == scope_depths_from_top_scope->length(), "bci & scope_depths table have different length");
  86   if (handler_bcis->length() > 0) {
  87     // add subtable header
  88     add_entry(HandlerTableEntry(handler_bcis->length(), catch_pco, 0));
  89     // add individual entries
  90     for (int i = 0; i < handler_bcis->length(); i++) {
  91       intptr_t scope_depth = 0;
  92       if (scope_depths_from_top_scope != NULL) {
  93         scope_depth = scope_depths_from_top_scope->at(i);
  94       }
  95       add_entry(HandlerTableEntry(handler_bcis->at(i), handler_pcos->at(i), scope_depth));
  96       assert(entry_for(catch_pco, handler_bcis->at(i), scope_depth)->pco() == handler_pcos->at(i), "entry not added correctly (1)");
  97       assert(entry_for(catch_pco, handler_bcis->at(i), scope_depth)->scope_depth() == scope_depth, "entry not added correctly (2)");
  98     }
  99   }
 100 }
 101 
 102 
 103 void ExceptionHandlerTable::copy_to(nmethod* nm) {
 104   assert(size_in_bytes() == nm->handler_table_size(), "size of space allocated in nmethod incorrect");
 105   memmove(nm->handler_table_begin(), _table, size_in_bytes());
 106 }
 107 



 108 
 109 HandlerTableEntry* ExceptionHandlerTable::entry_for(int catch_pco, int handler_bci, int scope_depth) const {
 110   HandlerTableEntry* t = subtable_for(catch_pco);
 111   if (t != NULL) {
 112     int l = t->len();
 113     while (l-- > 0) {
 114       t++;
 115       if (t->bci() == handler_bci && t->scope_depth() == scope_depth) return t;
 116     }
 117   }
 118   return NULL;
 119 }
 120 
 121 
 122 void ExceptionHandlerTable::print_subtable(HandlerTableEntry* t) const {
 123   int l = t->len();
 124   tty->print_cr("catch_pco = %d (%d entries)", t->pco(), l);
 125   while (l-- > 0) {
 126     t++;
 127     tty->print_cr("  bci %d at scope depth %d -> pco %d", t->bci(), t->scope_depth(), t->pco());




  85   assert(scope_depths_from_top_scope == NULL || handler_bcis->length() == scope_depths_from_top_scope->length(), "bci & scope_depths table have different length");
  86   if (handler_bcis->length() > 0) {
  87     // add subtable header
  88     add_entry(HandlerTableEntry(handler_bcis->length(), catch_pco, 0));
  89     // add individual entries
  90     for (int i = 0; i < handler_bcis->length(); i++) {
  91       intptr_t scope_depth = 0;
  92       if (scope_depths_from_top_scope != NULL) {
  93         scope_depth = scope_depths_from_top_scope->at(i);
  94       }
  95       add_entry(HandlerTableEntry(handler_bcis->at(i), handler_pcos->at(i), scope_depth));
  96       assert(entry_for(catch_pco, handler_bcis->at(i), scope_depth)->pco() == handler_pcos->at(i), "entry not added correctly (1)");
  97       assert(entry_for(catch_pco, handler_bcis->at(i), scope_depth)->scope_depth() == scope_depth, "entry not added correctly (2)");
  98     }
  99   }
 100 }
 101 
 102 
 103 void ExceptionHandlerTable::copy_to(nmethod* nm) {
 104   assert(size_in_bytes() == nm->handler_table_size(), "size of space allocated in nmethod incorrect");
 105   copy_bytes_to(nm->handler_table_begin());
 106 }
 107 
 108 void ExceptionHandlerTable::copy_bytes_to(address addr) {
 109   memmove(addr, _table, size_in_bytes());
 110 }
 111 
 112 HandlerTableEntry* ExceptionHandlerTable::entry_for(int catch_pco, int handler_bci, int scope_depth) const {
 113   HandlerTableEntry* t = subtable_for(catch_pco);
 114   if (t != NULL) {
 115     int l = t->len();
 116     while (l-- > 0) {
 117       t++;
 118       if (t->bci() == handler_bci && t->scope_depth() == scope_depth) return t;
 119     }
 120   }
 121   return NULL;
 122 }
 123 
 124 
 125 void ExceptionHandlerTable::print_subtable(HandlerTableEntry* t) const {
 126   int l = t->len();
 127   tty->print_cr("catch_pco = %d (%d entries)", t->pco(), l);
 128   while (l-- > 0) {
 129     t++;
 130     tty->print_cr("  bci %d at scope depth %d -> pco %d", t->bci(), t->scope_depth(), t->pco());


< prev index next >