4562 // Object clone().
4563 if (is_virtual) {
4564 generate_virtual_guard(obj_klass, slow_region);
4565 }
4566
4567 // The object must be cloneable and must not have a finalizer.
4568 // Both of these conditions may be checked in a single test.
4569 // We could optimize the cloneable test further, but we don't care.
4570 generate_access_flags_guard(obj_klass,
4571 // Test both conditions:
4572 JVM_ACC_IS_CLONEABLE | JVM_ACC_HAS_FINALIZER,
4573 // Must be cloneable but not finalizer:
4574 JVM_ACC_IS_CLONEABLE,
4575 slow_region);
4576 }
4577
4578 if (!stopped()) {
4579 // It's an instance, and it passed the slow-path tests.
4580 PreserveJVMState pjvms(this);
4581 Node* obj_size = NULL;
4582 Node* alloc_obj = new_instance(obj_klass, NULL, &obj_size);
4583
4584 copy_to_clone(obj, alloc_obj, obj_size, false, !use_ReduceInitialCardMarks());
4585
4586 // Present the results of the slow call.
4587 result_reg->init_req(_instance_path, control());
4588 result_val->init_req(_instance_path, alloc_obj);
4589 result_i_o ->set_req(_instance_path, i_o());
4590 result_mem ->set_req(_instance_path, reset_memory());
4591 }
4592
4593 // Generate code for the slow case. We make a call to clone().
4594 set_control(_gvn.transform(slow_region));
4595 if (!stopped()) {
4596 PreserveJVMState pjvms(this);
4597 CallJavaNode* slow_call = generate_method_call(vmIntrinsics::_clone, is_virtual);
4598 Node* slow_result = set_results_for_java_call(slow_call);
4599 // this->control() comes from set_results_for_java_call
4600 result_reg->init_req(_slow_path, control());
4601 result_val->init_req(_slow_path, slow_result);
4602 result_i_o ->set_req(_slow_path, i_o());
|
4562 // Object clone().
4563 if (is_virtual) {
4564 generate_virtual_guard(obj_klass, slow_region);
4565 }
4566
4567 // The object must be cloneable and must not have a finalizer.
4568 // Both of these conditions may be checked in a single test.
4569 // We could optimize the cloneable test further, but we don't care.
4570 generate_access_flags_guard(obj_klass,
4571 // Test both conditions:
4572 JVM_ACC_IS_CLONEABLE | JVM_ACC_HAS_FINALIZER,
4573 // Must be cloneable but not finalizer:
4574 JVM_ACC_IS_CLONEABLE,
4575 slow_region);
4576 }
4577
4578 if (!stopped()) {
4579 // It's an instance, and it passed the slow-path tests.
4580 PreserveJVMState pjvms(this);
4581 Node* obj_size = NULL;
4582 // Need to deoptimize on exception from allocation since Object.clone intrinsic
4583 // is reexecuted if deoptimization occurs and there could be problems when merging
4584 // exception state between multiple Object.clone versions (reexecute=true vs reexecute=false).
4585 Node* alloc_obj = new_instance(obj_klass, NULL, &obj_size, /*deoptimize_on_exception=*/true);
4586
4587 copy_to_clone(obj, alloc_obj, obj_size, false, !use_ReduceInitialCardMarks());
4588
4589 // Present the results of the slow call.
4590 result_reg->init_req(_instance_path, control());
4591 result_val->init_req(_instance_path, alloc_obj);
4592 result_i_o ->set_req(_instance_path, i_o());
4593 result_mem ->set_req(_instance_path, reset_memory());
4594 }
4595
4596 // Generate code for the slow case. We make a call to clone().
4597 set_control(_gvn.transform(slow_region));
4598 if (!stopped()) {
4599 PreserveJVMState pjvms(this);
4600 CallJavaNode* slow_call = generate_method_call(vmIntrinsics::_clone, is_virtual);
4601 Node* slow_result = set_results_for_java_call(slow_call);
4602 // this->control() comes from set_results_for_java_call
4603 result_reg->init_req(_slow_path, control());
4604 result_val->init_req(_slow_path, slow_result);
4605 result_i_o ->set_req(_slow_path, i_o());
|