1476 }
1477
1478 if (needs_check) {
1479 // Perform the registration of finalizable objects.
1480 ValueStack* state_before = copy_state_for_exception();
1481 load_local(objectType, 0);
1482 append_split(new Intrinsic(voidType, vmIntrinsics::_Object_init,
1483 state()->pop_arguments(1),
1484 true, state_before, true));
1485 }
1486 }
1487
1488
1489 void GraphBuilder::method_return(Value x, bool ignore_return) {
1490 if (RegisterFinalizersAtInit &&
1491 method()->intrinsic_id() == vmIntrinsics::_Object_init) {
1492 call_register_finalizer();
1493 }
1494
1495 bool need_mem_bar = false;
1496 if (method()->name() == ciSymbol::object_initializer_name() &&
1497 (scope()->wrote_final() || (AlwaysSafeConstructors && scope()->wrote_fields())
1498 || (support_IRIW_for_not_multiple_copy_atomic_cpu && scope()->wrote_volatile())
1499 )){
1500 need_mem_bar = true;
1501 }
1502
1503 BasicType bt = method()->return_type()->basic_type();
1504 switch (bt) {
1505 case T_BYTE:
1506 {
1507 Value shift = append(new Constant(new IntConstant(24)));
1508 x = append(new ShiftOp(Bytecodes::_ishl, x, shift));
1509 x = append(new ShiftOp(Bytecodes::_ishr, x, shift));
1510 break;
1511 }
1512 case T_SHORT:
1513 {
1514 Value shift = append(new Constant(new IntConstant(16)));
1515 x = append(new ShiftOp(Bytecodes::_ishl, x, shift));
1516 x = append(new ShiftOp(Bytecodes::_ishr, x, shift));
1952 ciKlass* holder = stream()->get_declared_method_holder();
1953 const Bytecodes::Code bc_raw = stream()->cur_bc_raw();
1954 assert(declared_signature != NULL, "cannot be null");
1955 assert(will_link == target->is_loaded(), "");
1956
1957 ciInstanceKlass* klass = target->holder();
1958 assert(!target->is_loaded() || klass->is_loaded(), "loaded target must imply loaded klass");
1959
1960 // check if CHA possible: if so, change the code to invoke_special
1961 ciInstanceKlass* calling_klass = method()->holder();
1962 ciInstanceKlass* callee_holder = ciEnv::get_instance_klass_for_declared_method_holder(holder);
1963 ciInstanceKlass* actual_recv = callee_holder;
1964
1965 CompileLog* log = compilation()->log();
1966 if (log != NULL)
1967 log->elem("call method='%d' instr='%s'",
1968 log->identify(target),
1969 Bytecodes::name(code));
1970
1971 // invoke-special-super
1972 if (bc_raw == Bytecodes::_invokespecial && !target->is_object_initializer()) {
1973 ciInstanceKlass* sender_klass =
1974 calling_klass->is_unsafe_anonymous() ? calling_klass->unsafe_anonymous_host() :
1975 calling_klass;
1976 if (sender_klass->is_interface()) {
1977 int index = state()->stack_size() - (target->arg_size_no_receiver() + 1);
1978 Value receiver = state()->stack_at(index);
1979 CheckCast* c = new CheckCast(sender_klass, receiver, copy_state_before());
1980 c->set_invokespecial_receiver_check();
1981 state()->stack_at_put(index, append_split(c));
1982 }
1983 }
1984
1985 // Some methods are obviously bindable without any type checks so
1986 // convert them directly to an invokespecial or invokestatic.
1987 if (target->is_loaded() && !target->is_abstract() && target->can_be_statically_bound()) {
1988 switch (bc_raw) {
1989 case Bytecodes::_invokevirtual:
1990 code = Bytecodes::_invokespecial;
1991 break;
1992 case Bytecodes::_invokehandle:
|
1476 }
1477
1478 if (needs_check) {
1479 // Perform the registration of finalizable objects.
1480 ValueStack* state_before = copy_state_for_exception();
1481 load_local(objectType, 0);
1482 append_split(new Intrinsic(voidType, vmIntrinsics::_Object_init,
1483 state()->pop_arguments(1),
1484 true, state_before, true));
1485 }
1486 }
1487
1488
1489 void GraphBuilder::method_return(Value x, bool ignore_return) {
1490 if (RegisterFinalizersAtInit &&
1491 method()->intrinsic_id() == vmIntrinsics::_Object_init) {
1492 call_register_finalizer();
1493 }
1494
1495 bool need_mem_bar = false;
1496 if (method()->is_object_constructor() &&
1497 (scope()->wrote_final() || (AlwaysSafeConstructors && scope()->wrote_fields())
1498 || (support_IRIW_for_not_multiple_copy_atomic_cpu && scope()->wrote_volatile())
1499 )){
1500 need_mem_bar = true;
1501 }
1502
1503 BasicType bt = method()->return_type()->basic_type();
1504 switch (bt) {
1505 case T_BYTE:
1506 {
1507 Value shift = append(new Constant(new IntConstant(24)));
1508 x = append(new ShiftOp(Bytecodes::_ishl, x, shift));
1509 x = append(new ShiftOp(Bytecodes::_ishr, x, shift));
1510 break;
1511 }
1512 case T_SHORT:
1513 {
1514 Value shift = append(new Constant(new IntConstant(16)));
1515 x = append(new ShiftOp(Bytecodes::_ishl, x, shift));
1516 x = append(new ShiftOp(Bytecodes::_ishr, x, shift));
1952 ciKlass* holder = stream()->get_declared_method_holder();
1953 const Bytecodes::Code bc_raw = stream()->cur_bc_raw();
1954 assert(declared_signature != NULL, "cannot be null");
1955 assert(will_link == target->is_loaded(), "");
1956
1957 ciInstanceKlass* klass = target->holder();
1958 assert(!target->is_loaded() || klass->is_loaded(), "loaded target must imply loaded klass");
1959
1960 // check if CHA possible: if so, change the code to invoke_special
1961 ciInstanceKlass* calling_klass = method()->holder();
1962 ciInstanceKlass* callee_holder = ciEnv::get_instance_klass_for_declared_method_holder(holder);
1963 ciInstanceKlass* actual_recv = callee_holder;
1964
1965 CompileLog* log = compilation()->log();
1966 if (log != NULL)
1967 log->elem("call method='%d' instr='%s'",
1968 log->identify(target),
1969 Bytecodes::name(code));
1970
1971 // invoke-special-super
1972 if (bc_raw == Bytecodes::_invokespecial && !target->is_object_constructor()) {
1973 ciInstanceKlass* sender_klass =
1974 calling_klass->is_unsafe_anonymous() ? calling_klass->unsafe_anonymous_host() :
1975 calling_klass;
1976 if (sender_klass->is_interface()) {
1977 int index = state()->stack_size() - (target->arg_size_no_receiver() + 1);
1978 Value receiver = state()->stack_at(index);
1979 CheckCast* c = new CheckCast(sender_klass, receiver, copy_state_before());
1980 c->set_invokespecial_receiver_check();
1981 state()->stack_at_put(index, append_split(c));
1982 }
1983 }
1984
1985 // Some methods are obviously bindable without any type checks so
1986 // convert them directly to an invokespecial or invokestatic.
1987 if (target->is_loaded() && !target->is_abstract() && target->can_be_statically_bound()) {
1988 switch (bc_raw) {
1989 case Bytecodes::_invokevirtual:
1990 code = Bytecodes::_invokespecial;
1991 break;
1992 case Bytecodes::_invokehandle:
|