< prev index next >

src/share/vm/interpreter/rewriter.cpp

Print this page




 323       } else {
 324         (*bcp) = Bytecodes::_ldc;
 325         assert(pool_index == (u1)pool_index, "index overflow");
 326         (*p) = (u1)pool_index;
 327       }
 328     }
 329   }
 330 }
 331 
 332 
 333 // Rewrites a method given the index_map information
 334 void Rewriter::scan_method(Method* method, bool reverse, bool* invokespecial_error) {
 335 
 336   int nof_jsrs = 0;
 337   bool has_monitor_bytecodes = false;
 338 
 339   {
 340     // We cannot tolerate a GC in this block, because we've
 341     // cached the bytecodes in 'code_base'. If the Method*
 342     // moves, the bytecodes will also move.
 343     No_Safepoint_Verifier nsv;
 344     Bytecodes::Code c;
 345 
 346     // Bytecodes and their length
 347     const address code_base = method->code_base();
 348     const int code_length = method->code_size();
 349 
 350     int bc_length;
 351     for (int bci = 0; bci < code_length; bci += bc_length) {
 352       address bcp = code_base + bci;
 353       int prefix_length = 0;
 354       c = (Bytecodes::Code)(*bcp);
 355 
 356       // Since we have the code, see if we can get the length
 357       // directly. Some more complicated bytecodes will report
 358       // a length of zero, meaning we need to make another method
 359       // call to calculate the length.
 360       bc_length = Bytecodes::length_for(c);
 361       if (bc_length == 0) {
 362         bc_length = Bytecodes::length_at(method, bcp);
 363 




 323       } else {
 324         (*bcp) = Bytecodes::_ldc;
 325         assert(pool_index == (u1)pool_index, "index overflow");
 326         (*p) = (u1)pool_index;
 327       }
 328     }
 329   }
 330 }
 331 
 332 
 333 // Rewrites a method given the index_map information
 334 void Rewriter::scan_method(Method* method, bool reverse, bool* invokespecial_error) {
 335 
 336   int nof_jsrs = 0;
 337   bool has_monitor_bytecodes = false;
 338 
 339   {
 340     // We cannot tolerate a GC in this block, because we've
 341     // cached the bytecodes in 'code_base'. If the Method*
 342     // moves, the bytecodes will also move.
 343     NoSafepointVerifier nsv;
 344     Bytecodes::Code c;
 345 
 346     // Bytecodes and their length
 347     const address code_base = method->code_base();
 348     const int code_length = method->code_size();
 349 
 350     int bc_length;
 351     for (int bci = 0; bci < code_length; bci += bc_length) {
 352       address bcp = code_base + bci;
 353       int prefix_length = 0;
 354       c = (Bytecodes::Code)(*bcp);
 355 
 356       // Since we have the code, see if we can get the length
 357       // directly. Some more complicated bytecodes will report
 358       // a length of zero, meaning we need to make another method
 359       // call to calculate the length.
 360       bc_length = Bytecodes::length_for(c);
 361       if (bc_length == 0) {
 362         bc_length = Bytecodes::length_at(method, bcp);
 363 


< prev index next >