src/share/vm/opto/parse1.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6915557 Sdiff src/share/vm/opto

src/share/vm/opto/parse1.cpp

Print this page


   1 /*
   2  * Copyright 1997-2009 Sun Microsystems, Inc.  All Rights Reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *


 220     // Build a bogus FastLockNode (no code will be generated) and push the
 221     // monitor into our debug info.
 222     const FastLockNode *flock = _gvn.transform(new (C, 3) FastLockNode( 0, lock_object, box ))->as_FastLock();
 223     map()->push_monitor(flock);
 224 
 225     // If the lock is our method synchronization lock, tuck it away in
 226     // _sync_lock for return and rethrow exit paths.
 227     if (index == 0 && method()->is_synchronized()) {
 228       _synch_lock = flock;
 229     }
 230   }
 231 
 232   // Use the raw liveness computation to make sure that unexpected
 233   // values don't propagate into the OSR frame.
 234   MethodLivenessResult live_locals = method()->liveness_at_bci(osr_bci());
 235   if (!live_locals.is_valid()) {
 236     // Degenerate or breakpointed method.
 237     C->record_method_not_compilable("OSR in empty or breakpointed method");
 238     return;
 239   }
 240   MethodLivenessResult raw_live_locals = method()->raw_liveness_at_bci(osr_bci());
 241 
 242   // Extract the needed locals from the interpreter frame.
 243   Node *locals_addr = basic_plus_adr(osr_buf, osr_buf, (max_locals-1)*wordSize);
 244 
 245   // find all the locals that the interpreter thinks contain live oops
 246   const BitMap live_oops = method()->live_local_oops_at_bci(osr_bci());
 247   for (index = 0; index < max_locals; index++) {
 248 
 249     if (!live_locals.at(index)) {
 250       continue;
 251     }
 252 
 253     const Type *type = osr_block->local_type_at(index);
 254 
 255     if (type->isa_oopptr() != NULL) {
 256 
 257       // 6403625: Verify that the interpreter oopMap thinks that the oop is live
 258       // else we might load a stale oop if the MethodLiveness disagrees with the
 259       // result of the interpreter. If the interpreter says it is dead we agree
 260       // by making the value go to top.


 289   for (index = 0; index < sp(); index++) {
 290     const Type *type = osr_block->stack_type_at(index);
 291     if (type != Type::TOP) {
 292       // Currently the compiler bails out when attempting to on stack replace
 293       // at a bci with a non-empty stack.  We should not reach here.
 294       ShouldNotReachHere();
 295     }
 296   }
 297 
 298   // End the OSR migration
 299   make_runtime_call(RC_LEAF, OptoRuntime::osr_end_Type(),
 300                     CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_end),
 301                     "OSR_migration_end", TypeRawPtr::BOTTOM,
 302                     osr_buf);
 303 
 304   // Now that the interpreter state is loaded, make sure it will match
 305   // at execution time what the compiler is expecting now:
 306   SafePointNode* bad_type_exit = clone_map();
 307   bad_type_exit->set_control(new (C, 1) RegionNode(1));
 308 

 309   for (index = 0; index < max_locals; index++) {
 310     if (stopped())  break;
 311     Node* l = local(index);
 312     if (l->is_top())  continue;  // nothing here
 313     const Type *type = osr_block->local_type_at(index);
 314     if (type->isa_oopptr() != NULL) {
 315       if (!live_oops.at(index)) {
 316         // skip type check for dead oops
 317         continue;
 318       }
 319     }
 320     if (type->basic_type() == T_ADDRESS && !raw_live_locals.at(index)) {
 321       // Skip type check for dead address locals










 322       continue;
 323     }
 324     set_local(index, check_interpreter_type(l, type, bad_type_exit));
 325   }
 326 
 327   for (index = 0; index < sp(); index++) {
 328     if (stopped())  break;
 329     Node* l = stack(index);
 330     if (l->is_top())  continue;  // nothing here
 331     const Type *type = osr_block->stack_type_at(index);
 332     set_stack(index, check_interpreter_type(l, type, bad_type_exit));
 333   }
 334 
 335   if (bad_type_exit->control()->req() > 1) {
 336     // Build an uncommon trap here, if any inputs can be unexpected.
 337     bad_type_exit->set_control(_gvn.transform( bad_type_exit->control() ));
 338     record_for_igvn(bad_type_exit->control());
 339     SafePointNode* types_are_good = map();
 340     set_map(bad_type_exit);
 341     // The unexpected type happens because a new edge is active


   1 /*
   2  * Copyright 1997-2010 Sun Microsystems, Inc.  All Rights Reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
  20  * CA 95054 USA or visit www.sun.com if you need additional information or
  21  * have any questions.
  22  *


 220     // Build a bogus FastLockNode (no code will be generated) and push the
 221     // monitor into our debug info.
 222     const FastLockNode *flock = _gvn.transform(new (C, 3) FastLockNode( 0, lock_object, box ))->as_FastLock();
 223     map()->push_monitor(flock);
 224 
 225     // If the lock is our method synchronization lock, tuck it away in
 226     // _sync_lock for return and rethrow exit paths.
 227     if (index == 0 && method()->is_synchronized()) {
 228       _synch_lock = flock;
 229     }
 230   }
 231 
 232   // Use the raw liveness computation to make sure that unexpected
 233   // values don't propagate into the OSR frame.
 234   MethodLivenessResult live_locals = method()->liveness_at_bci(osr_bci());
 235   if (!live_locals.is_valid()) {
 236     // Degenerate or breakpointed method.
 237     C->record_method_not_compilable("OSR in empty or breakpointed method");
 238     return;
 239   }

 240 
 241   // Extract the needed locals from the interpreter frame.
 242   Node *locals_addr = basic_plus_adr(osr_buf, osr_buf, (max_locals-1)*wordSize);
 243 
 244   // find all the locals that the interpreter thinks contain live oops
 245   const BitMap live_oops = method()->live_local_oops_at_bci(osr_bci());
 246   for (index = 0; index < max_locals; index++) {
 247 
 248     if (!live_locals.at(index)) {
 249       continue;
 250     }
 251 
 252     const Type *type = osr_block->local_type_at(index);
 253 
 254     if (type->isa_oopptr() != NULL) {
 255 
 256       // 6403625: Verify that the interpreter oopMap thinks that the oop is live
 257       // else we might load a stale oop if the MethodLiveness disagrees with the
 258       // result of the interpreter. If the interpreter says it is dead we agree
 259       // by making the value go to top.


 288   for (index = 0; index < sp(); index++) {
 289     const Type *type = osr_block->stack_type_at(index);
 290     if (type != Type::TOP) {
 291       // Currently the compiler bails out when attempting to on stack replace
 292       // at a bci with a non-empty stack.  We should not reach here.
 293       ShouldNotReachHere();
 294     }
 295   }
 296 
 297   // End the OSR migration
 298   make_runtime_call(RC_LEAF, OptoRuntime::osr_end_Type(),
 299                     CAST_FROM_FN_PTR(address, SharedRuntime::OSR_migration_end),
 300                     "OSR_migration_end", TypeRawPtr::BOTTOM,
 301                     osr_buf);
 302 
 303   // Now that the interpreter state is loaded, make sure it will match
 304   // at execution time what the compiler is expecting now:
 305   SafePointNode* bad_type_exit = clone_map();
 306   bad_type_exit->set_control(new (C, 1) RegionNode(1));
 307 
 308   assert(osr_block->flow()->jsrs()->size() == 0, "should be no jsrs live at osr point");
 309   for (index = 0; index < max_locals; index++) {
 310     if (stopped())  break;
 311     Node* l = local(index);
 312     if (l->is_top())  continue;  // nothing here
 313     const Type *type = osr_block->local_type_at(index);
 314     if (type->isa_oopptr() != NULL) {
 315       if (!live_oops.at(index)) {
 316         // skip type check for dead oops
 317         continue;
 318       }
 319     }
 320     if (type->basic_type() == T_ADDRESS) {
 321       // In our current system it's illegal for jsr addresses to be
 322       // live into an OSR entry point because the compiler performs
 323       // inlining of jsrs.  ciTypeFlow has a bailout that detect this
 324       // case and aborts the compile if addresses are live into an OSR
 325       // entry point.  Because of that we can assume that any address
 326       // locals at the OSR entry point are dead.  Method liveness
 327       // isn't precise enought to figure out that they are dead in all
 328       // cases so simply skip checking address locals all
 329       // together. Any type check is guaranteed to fail since the
 330       // interpreter type is the result of a load which might have any
 331       // value and the expected type is a constant.
 332       continue;
 333     }
 334     set_local(index, check_interpreter_type(l, type, bad_type_exit));
 335   }
 336 
 337   for (index = 0; index < sp(); index++) {
 338     if (stopped())  break;
 339     Node* l = stack(index);
 340     if (l->is_top())  continue;  // nothing here
 341     const Type *type = osr_block->stack_type_at(index);
 342     set_stack(index, check_interpreter_type(l, type, bad_type_exit));
 343   }
 344 
 345   if (bad_type_exit->control()->req() > 1) {
 346     // Build an uncommon trap here, if any inputs can be unexpected.
 347     bad_type_exit->set_control(_gvn.transform( bad_type_exit->control() ));
 348     record_for_igvn(bad_type_exit->control());
 349     SafePointNode* types_are_good = map();
 350     set_map(bad_type_exit);
 351     // The unexpected type happens because a new edge is active


src/share/vm/opto/parse1.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File