src/share/vm/c1/c1_GraphBuilder.cpp

Print this page




1419 
1420   if (needs_check) {
1421     // Perform the registration of finalizable objects.
1422     ValueStack* state_before = copy_state_for_exception();
1423     load_local(objectType, 0);
1424     append_split(new Intrinsic(voidType, vmIntrinsics::_Object_init,
1425                                state()->pop_arguments(1),
1426                                true, state_before, true));
1427   }
1428 }
1429 
1430 
1431 void GraphBuilder::method_return(Value x) {
1432   if (RegisterFinalizersAtInit &&
1433       method()->intrinsic_id() == vmIntrinsics::_Object_init) {
1434     call_register_finalizer();
1435   }
1436 
1437   bool need_mem_bar = false;
1438   if (method()->name() == ciSymbol::object_initializer_name() &&
1439       scope()->wrote_final()) {
1440     need_mem_bar = true;
1441   }
1442 
1443   // Check to see whether we are inlining. If so, Return
1444   // instructions become Gotos to the continuation point.
1445   if (continuation() != NULL) {
1446     assert(!method()->is_synchronized() || InlineSynchronizedMethods, "can not inline synchronized methods yet");
1447 
1448     if (compilation()->env()->dtrace_method_probes()) {
1449       // Report exit from inline methods
1450       Values* args = new Values(1);
1451       args->push(append(new Constant(new MethodConstant(method()))));
1452       append(new RuntimeCall(voidType, "dtrace_method_exit", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), args));
1453     }
1454 
1455     // If the inlined method is synchronized, the monitor must be
1456     // released before we jump to the continuation block.
1457     if (method()->is_synchronized()) {
1458       assert(state()->locks_size() == 1, "receiver must be locked here");
1459       monitorexit(state()->lock_at(0), SynchronizationEntryBCI);


1531 
1532   ValueStack* state_before = NULL;
1533   if (!holder->is_initialized() || needs_patching) {
1534     // save state before instruction for debug info when
1535     // deoptimization happens during patching
1536     state_before = copy_state_before();
1537   }
1538 
1539   Value obj = NULL;
1540   if (code == Bytecodes::_getstatic || code == Bytecodes::_putstatic) {
1541     if (state_before != NULL) {
1542       // build a patching constant
1543       obj = new Constant(new InstanceConstant(holder->java_mirror()), state_before);
1544     } else {
1545       obj = new Constant(new InstanceConstant(holder->java_mirror()));
1546     }
1547   }
1548 
1549   if (field->is_final() && (code == Bytecodes::_putfield)) {
1550     scope()->set_wrote_final();




1551   }
1552 
1553   const int offset = !needs_patching ? field->offset() : -1;
1554   switch (code) {
1555     case Bytecodes::_getstatic: {
1556       // check for compile-time constants, i.e., initialized static final fields
1557       Instruction* constant = NULL;
1558       if (field->is_constant() && !PatchALot) {
1559         ciConstant field_val = field->constant_value();
1560         BasicType field_type = field_val.basic_type();
1561         switch (field_type) {
1562         case T_ARRAY:
1563         case T_OBJECT:
1564           if (field_val.as_object()->should_be_constant()) {
1565             constant = new Constant(as_ValueType(field_val));
1566           }
1567           break;
1568 
1569         default:
1570           constant = new Constant(as_ValueType(field_val));




1419 
1420   if (needs_check) {
1421     // Perform the registration of finalizable objects.
1422     ValueStack* state_before = copy_state_for_exception();
1423     load_local(objectType, 0);
1424     append_split(new Intrinsic(voidType, vmIntrinsics::_Object_init,
1425                                state()->pop_arguments(1),
1426                                true, state_before, true));
1427   }
1428 }
1429 
1430 
1431 void GraphBuilder::method_return(Value x) {
1432   if (RegisterFinalizersAtInit &&
1433       method()->intrinsic_id() == vmIntrinsics::_Object_init) {
1434     call_register_finalizer();
1435   }
1436 
1437   bool need_mem_bar = false;
1438   if (method()->name() == ciSymbol::object_initializer_name() &&
1439       (scope()->wrote_final() || (AlwaysSafeConstructors && scope()->wrote_fields()))) {
1440     need_mem_bar = true;
1441   }
1442 
1443   // Check to see whether we are inlining. If so, Return
1444   // instructions become Gotos to the continuation point.
1445   if (continuation() != NULL) {
1446     assert(!method()->is_synchronized() || InlineSynchronizedMethods, "can not inline synchronized methods yet");
1447 
1448     if (compilation()->env()->dtrace_method_probes()) {
1449       // Report exit from inline methods
1450       Values* args = new Values(1);
1451       args->push(append(new Constant(new MethodConstant(method()))));
1452       append(new RuntimeCall(voidType, "dtrace_method_exit", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), args));
1453     }
1454 
1455     // If the inlined method is synchronized, the monitor must be
1456     // released before we jump to the continuation block.
1457     if (method()->is_synchronized()) {
1458       assert(state()->locks_size() == 1, "receiver must be locked here");
1459       monitorexit(state()->lock_at(0), SynchronizationEntryBCI);


1531 
1532   ValueStack* state_before = NULL;
1533   if (!holder->is_initialized() || needs_patching) {
1534     // save state before instruction for debug info when
1535     // deoptimization happens during patching
1536     state_before = copy_state_before();
1537   }
1538 
1539   Value obj = NULL;
1540   if (code == Bytecodes::_getstatic || code == Bytecodes::_putstatic) {
1541     if (state_before != NULL) {
1542       // build a patching constant
1543       obj = new Constant(new InstanceConstant(holder->java_mirror()), state_before);
1544     } else {
1545       obj = new Constant(new InstanceConstant(holder->java_mirror()));
1546     }
1547   }
1548 
1549   if (field->is_final() && (code == Bytecodes::_putfield)) {
1550     scope()->set_wrote_final();
1551   }
1552 
1553   if (code == Bytecodes::_putfield) {
1554     scope()->set_wrote_fields();
1555   }
1556 
1557   const int offset = !needs_patching ? field->offset() : -1;
1558   switch (code) {
1559     case Bytecodes::_getstatic: {
1560       // check for compile-time constants, i.e., initialized static final fields
1561       Instruction* constant = NULL;
1562       if (field->is_constant() && !PatchALot) {
1563         ciConstant field_val = field->constant_value();
1564         BasicType field_type = field_val.basic_type();
1565         switch (field_type) {
1566         case T_ARRAY:
1567         case T_OBJECT:
1568           if (field_val.as_object()->should_be_constant()) {
1569             constant = new Constant(as_ValueType(field_val));
1570           }
1571           break;
1572 
1573         default:
1574           constant = new Constant(as_ValueType(field_val));