4951
4952 BasicType x_elem = x_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
4953 BasicType y_elem = y_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
4954 if (x_elem != T_INT || y_elem != T_INT) {
4955 return false;
4956 }
4957
4958 // Set the original stack and the reexecute bit for the interpreter to reexecute
4959 // the bytecode that invokes BigInteger.multiplyToLen() if deoptimization happens
4960 // on the return from z array allocation in runtime.
4961 { PreserveReexecuteState preexecs(this);
4962 jvms()->set_should_reexecute(true);
4963
4964 Node* x_start = array_element_address(x, intcon(0), x_elem);
4965 Node* y_start = array_element_address(y, intcon(0), y_elem);
4966 // 'x_start' points to x array + scaled xlen
4967 // 'y_start' points to y array + scaled ylen
4968
4969 // Allocate the result array
4970 Node* zlen = _gvn.transform(new AddINode(xlen, ylen));
4971 Node* klass_node = makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_INT)));
4972
4973 IdealKit ideal(this);
4974
4975 #define __ ideal.
4976 Node* one = __ ConI(1);
4977 Node* zero = __ ConI(0);
4978 IdealVariable need_alloc(ideal), z_alloc(ideal); __ declarations_done();
4979 __ set(need_alloc, zero);
4980 __ set(z_alloc, z);
4981 __ if_then(z, BoolTest::eq, null()); {
4982 __ increment (need_alloc, one);
4983 } __ else_(); {
4984 // Update graphKit memory and control from IdealKit.
4985 sync_kit(ideal);
4986 Node* zlen_arg = load_array_length(z);
4987 // Update IdealKit memory and control from graphKit.
4988 __ sync_kit(this);
4989 __ if_then(zlen_arg, BoolTest::lt, zlen); {
4990 __ increment (need_alloc, one);
4991 } __ end_if();
4992 } __ end_if();
4993
4994 __ if_then(__ value(need_alloc), BoolTest::ne, zero); {
4995 // Update graphKit memory and control from IdealKit.
4996 sync_kit(ideal);
4997 Node * narr = new_array(klass_node, zlen, 1);
4998 // Update IdealKit memory and control from graphKit.
4999 __ sync_kit(this);
5000 __ set(z_alloc, narr);
5001 } __ end_if();
5002
5003 sync_kit(ideal);
5004 z = __ value(z_alloc);
5005 _gvn.set_type(z, TypeAryPtr::INTS);
5006 // Final sync IdealKit and GraphKit.
5007 final_sync(ideal);
5008 #undef __
5009
5010 Node* z_start = array_element_address(z, intcon(0), T_INT);
5011
5012 Node* call = make_runtime_call(RC_LEAF|RC_NO_FP,
5013 OptoRuntime::multiplyToLen_Type(),
5014 stubAddr, stubName, TypePtr::BOTTOM,
5015 x_start, xlen, y_start, ylen, z_start, zlen);
5016 } // original reexecute is set back here
5017
5018 C->set_has_split_ifs(true); // Has chance for split-if optimization
5019 set_result(z);
5020 return true;
5021 }
5022
5023
5024 /**
5025 * Calculate CRC32 for byte.
|
4951
4952 BasicType x_elem = x_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
4953 BasicType y_elem = y_type->isa_aryptr()->klass()->as_array_klass()->element_type()->basic_type();
4954 if (x_elem != T_INT || y_elem != T_INT) {
4955 return false;
4956 }
4957
4958 // Set the original stack and the reexecute bit for the interpreter to reexecute
4959 // the bytecode that invokes BigInteger.multiplyToLen() if deoptimization happens
4960 // on the return from z array allocation in runtime.
4961 { PreserveReexecuteState preexecs(this);
4962 jvms()->set_should_reexecute(true);
4963
4964 Node* x_start = array_element_address(x, intcon(0), x_elem);
4965 Node* y_start = array_element_address(y, intcon(0), y_elem);
4966 // 'x_start' points to x array + scaled xlen
4967 // 'y_start' points to y array + scaled ylen
4968
4969 // Allocate the result array
4970 Node* zlen = _gvn.transform(new AddINode(xlen, ylen));
4971 ciKlass* klass = ciTypeArrayKlass::make(T_INT);
4972 Node* klass_node = makecon(TypeKlassPtr::make(klass));
4973
4974 IdealKit ideal(this);
4975
4976 #define __ ideal.
4977 Node* one = __ ConI(1);
4978 Node* zero = __ ConI(0);
4979 IdealVariable need_alloc(ideal), z_alloc(ideal); __ declarations_done();
4980 __ set(need_alloc, zero);
4981 __ set(z_alloc, z);
4982 __ if_then(z, BoolTest::eq, null()); {
4983 __ increment (need_alloc, one);
4984 } __ else_(); {
4985 // Update graphKit memory and control from IdealKit.
4986 sync_kit(ideal);
4987 Node* zlen_arg = load_array_length(z);
4988 // Update IdealKit memory and control from graphKit.
4989 __ sync_kit(this);
4990 __ if_then(zlen_arg, BoolTest::lt, zlen); {
4991 __ increment (need_alloc, one);
4992 } __ end_if();
4993 } __ end_if();
4994
4995 __ if_then(__ value(need_alloc), BoolTest::ne, zero); {
4996 // Update graphKit memory and control from IdealKit.
4997 sync_kit(ideal);
4998 Node * narr = new_array(klass_node, zlen, 1);
4999 // Update IdealKit memory and control from graphKit.
5000 __ sync_kit(this);
5001 __ set(z_alloc, narr);
5002 } __ end_if();
5003
5004 sync_kit(ideal);
5005 z = __ value(z_alloc);
5006 // Can't use TypeAryPtr::INTS which uses Bottom offset.
5007 _gvn.set_type(z, TypeOopPtr::make_from_klass(klass));
5008 // Final sync IdealKit and GraphKit.
5009 final_sync(ideal);
5010 #undef __
5011
5012 Node* z_start = array_element_address(z, intcon(0), T_INT);
5013
5014 Node* call = make_runtime_call(RC_LEAF|RC_NO_FP,
5015 OptoRuntime::multiplyToLen_Type(),
5016 stubAddr, stubName, TypePtr::BOTTOM,
5017 x_start, xlen, y_start, ylen, z_start, zlen);
5018 } // original reexecute is set back here
5019
5020 C->set_has_split_ifs(true); // Has chance for split-if optimization
5021 set_result(z);
5022 return true;
5023 }
5024
5025
5026 /**
5027 * Calculate CRC32 for byte.
|