1691 Node* base = basic_plus_adr(ary, header);
1692 idx = Compile::conv_I2X_index(&_gvn, idx, sizetype, ctrl);
1693 Node* scale = _gvn.transform( new LShiftXNode(idx, intcon(shift)) );
1694 return basic_plus_adr(ary, base, scale);
1695 }
1696
1697 //-------------------------load_array_element-------------------------
1698 Node* GraphKit::load_array_element(Node* ctl, Node* ary, Node* idx, const TypeAryPtr* arytype) {
1699 const Type* elemtype = arytype->elem();
1700 BasicType elembt = elemtype->array_element_basic_type();
1701 Node* adr = array_element_address(ary, idx, elembt, arytype->size());
1702 Node* ld = make_load(ctl, adr, elemtype, elembt, arytype, MemNode::unordered);
1703 return ld;
1704 }
1705
1706 //-------------------------set_arguments_for_java_call-------------------------
1707 // Arguments (pre-popped from the stack) are taken from the JVMS.
1708 void GraphKit::set_arguments_for_java_call(CallJavaNode* call) {
1709 // Add the call arguments:
1710 uint nargs = call->method()->arg_size();
1711 for (uint i = 0; i < nargs; i++) {
1712 Node* arg = argument(i);
1713 if (arg->is_ValueType()) {
1714 // Pass value type argument via oop to callee
1715 arg = arg->as_ValueType()->store_to_memory(this);
1716 }
1717 call->init_req(i + TypeFunc::Parms, arg);
1718 }
1719 }
1720
1721 //---------------------------set_edges_for_java_call---------------------------
1722 // Connect a newly created call into the current JVMS.
1723 // A return value node (if any) is returned from set_edges_for_java_call.
1724 void GraphKit::set_edges_for_java_call(CallJavaNode* call, bool must_throw, bool separate_io_proj) {
1725
1726 // Add the predefined inputs:
1727 call->init_req( TypeFunc::Control, control() );
1728 call->init_req( TypeFunc::I_O , i_o() );
1729 call->init_req( TypeFunc::Memory , reset_memory() );
1730 call->init_req( TypeFunc::FramePtr, frameptr() );
1731 call->init_req( TypeFunc::ReturnAdr, top() );
1732
1733 add_safepoint_edges(call, must_throw);
1734
1735 Node* xcall = _gvn.transform(call);
1736
1737 if (xcall == top()) {
1738 set_control(top());
2101
2102 stop_and_kill_map();
2103 }
2104
2105
2106 //--------------------------just_allocated_object------------------------------
2107 // Report the object that was just allocated.
2108 // It must be the case that there are no intervening safepoints.
2109 // We use this to determine if an object is so "fresh" that
2110 // it does not require card marks.
2111 Node* GraphKit::just_allocated_object(Node* current_control) {
2112 if (C->recent_alloc_ctl() == current_control)
2113 return C->recent_alloc_obj();
2114 return NULL;
2115 }
2116
2117
2118 void GraphKit::round_double_arguments(ciMethod* dest_method) {
2119 // (Note: TypeFunc::make has a cache that makes this fast.)
2120 const TypeFunc* tf = TypeFunc::make(dest_method);
2121 int nargs = tf->domain()->cnt() - TypeFunc::Parms;
2122 for (int j = 0; j < nargs; j++) {
2123 const Type *targ = tf->domain()->field_at(j + TypeFunc::Parms);
2124 if( targ->basic_type() == T_DOUBLE ) {
2125 // If any parameters are doubles, they must be rounded before
2126 // the call, dstore_rounding does gvn.transform
2127 Node *arg = argument(j);
2128 arg = dstore_rounding(arg);
2129 set_argument(j, arg);
2130 }
2131 }
2132 }
2133
2134 /**
2135 * Record profiling data exact_kls for Node n with the type system so
2136 * that it can propagate it (speculation)
2137 *
2138 * @param n node that the type applies to
2139 * @param exact_kls type from profiling
2140 * @param maybe_null did profiling see null?
2141 *
2142 * @return node with improved type
2143 */
2205 java_bc() == Bytecodes::_aastore) {
2206 ciProfileData* data = method()->method_data()->bci_to_data(bci());
2207 bool maybe_null = data == NULL ? true : data->as_BitData()->null_seen();
2208 }
2209 return record_profile_for_speculation(n, exact_kls, maybe_null);
2210 return n;
2211 }
2212
2213 /**
2214 * Record profiling data from argument profiling at an invoke with the
2215 * type system so that it can propagate it (speculation)
2216 *
2217 * @param dest_method target method for the call
2218 * @param bc what invoke bytecode is this?
2219 */
2220 void GraphKit::record_profiled_arguments_for_speculation(ciMethod* dest_method, Bytecodes::Code bc) {
2221 if (!UseTypeSpeculation) {
2222 return;
2223 }
2224 const TypeFunc* tf = TypeFunc::make(dest_method);
2225 int nargs = tf->domain()->cnt() - TypeFunc::Parms;
2226 int skip = Bytecodes::has_receiver(bc) ? 1 : 0;
2227 for (int j = skip, i = 0; j < nargs && i < TypeProfileArgsLimit; j++) {
2228 const Type *targ = tf->domain()->field_at(j + TypeFunc::Parms);
2229 if (targ->basic_type() == T_OBJECT || targ->basic_type() == T_ARRAY) {
2230 bool maybe_null = true;
2231 ciKlass* better_type = NULL;
2232 if (method()->argument_profiled_type(bci(), i, better_type, maybe_null)) {
2233 record_profile_for_speculation(argument(j), better_type, maybe_null);
2234 }
2235 i++;
2236 }
2237 }
2238 }
2239
2240 /**
2241 * Record profiling data from parameter profiling at an invoke with
2242 * the type system so that it can propagate it (speculation)
2243 */
2244 void GraphKit::record_profiled_parameters_for_speculation() {
2245 if (!UseTypeSpeculation) {
2246 return;
2247 }
2248 for (int i = 0, j = 0; i < method()->arg_size() ; i++) {
|
1691 Node* base = basic_plus_adr(ary, header);
1692 idx = Compile::conv_I2X_index(&_gvn, idx, sizetype, ctrl);
1693 Node* scale = _gvn.transform( new LShiftXNode(idx, intcon(shift)) );
1694 return basic_plus_adr(ary, base, scale);
1695 }
1696
1697 //-------------------------load_array_element-------------------------
1698 Node* GraphKit::load_array_element(Node* ctl, Node* ary, Node* idx, const TypeAryPtr* arytype) {
1699 const Type* elemtype = arytype->elem();
1700 BasicType elembt = elemtype->array_element_basic_type();
1701 Node* adr = array_element_address(ary, idx, elembt, arytype->size());
1702 Node* ld = make_load(ctl, adr, elemtype, elembt, arytype, MemNode::unordered);
1703 return ld;
1704 }
1705
1706 //-------------------------set_arguments_for_java_call-------------------------
1707 // Arguments (pre-popped from the stack) are taken from the JVMS.
1708 void GraphKit::set_arguments_for_java_call(CallJavaNode* call) {
1709 // Add the call arguments:
1710 uint nargs = call->method()->arg_size();
1711 for (uint i = 0, idx = 0; i < nargs; i++) {
1712 Node* arg = argument(i);
1713 if (ValueTypePassFieldsAsArgs) {
1714 if (arg->is_ValueType()) {
1715 ValueTypeNode* vt = arg->as_ValueType();
1716 // We don't pass value type arguments by reference but instead
1717 // pass each field of the value type
1718 idx += vt->set_arguments_for_java_call(call, idx + TypeFunc::Parms, *this);
1719 } else {
1720 call->init_req(idx + TypeFunc::Parms, arg);
1721 idx++;
1722 }
1723 } else {
1724 if (arg->is_ValueType()) {
1725 // Pass value type argument via oop to callee
1726 arg = arg->as_ValueType()->store_to_memory(this);
1727 }
1728 call->init_req(i + TypeFunc::Parms, arg);
1729 }
1730 }
1731 }
1732
1733 //---------------------------set_edges_for_java_call---------------------------
1734 // Connect a newly created call into the current JVMS.
1735 // A return value node (if any) is returned from set_edges_for_java_call.
1736 void GraphKit::set_edges_for_java_call(CallJavaNode* call, bool must_throw, bool separate_io_proj) {
1737
1738 // Add the predefined inputs:
1739 call->init_req( TypeFunc::Control, control() );
1740 call->init_req( TypeFunc::I_O , i_o() );
1741 call->init_req( TypeFunc::Memory , reset_memory() );
1742 call->init_req( TypeFunc::FramePtr, frameptr() );
1743 call->init_req( TypeFunc::ReturnAdr, top() );
1744
1745 add_safepoint_edges(call, must_throw);
1746
1747 Node* xcall = _gvn.transform(call);
1748
1749 if (xcall == top()) {
1750 set_control(top());
2113
2114 stop_and_kill_map();
2115 }
2116
2117
2118 //--------------------------just_allocated_object------------------------------
2119 // Report the object that was just allocated.
2120 // It must be the case that there are no intervening safepoints.
2121 // We use this to determine if an object is so "fresh" that
2122 // it does not require card marks.
2123 Node* GraphKit::just_allocated_object(Node* current_control) {
2124 if (C->recent_alloc_ctl() == current_control)
2125 return C->recent_alloc_obj();
2126 return NULL;
2127 }
2128
2129
2130 void GraphKit::round_double_arguments(ciMethod* dest_method) {
2131 // (Note: TypeFunc::make has a cache that makes this fast.)
2132 const TypeFunc* tf = TypeFunc::make(dest_method);
2133 int nargs = tf->domain_sig()->cnt() - TypeFunc::Parms;
2134 for (int j = 0; j < nargs; j++) {
2135 const Type *targ = tf->domain_sig()->field_at(j + TypeFunc::Parms);
2136 if( targ->basic_type() == T_DOUBLE ) {
2137 // If any parameters are doubles, they must be rounded before
2138 // the call, dstore_rounding does gvn.transform
2139 Node *arg = argument(j);
2140 arg = dstore_rounding(arg);
2141 set_argument(j, arg);
2142 }
2143 }
2144 }
2145
2146 /**
2147 * Record profiling data exact_kls for Node n with the type system so
2148 * that it can propagate it (speculation)
2149 *
2150 * @param n node that the type applies to
2151 * @param exact_kls type from profiling
2152 * @param maybe_null did profiling see null?
2153 *
2154 * @return node with improved type
2155 */
2217 java_bc() == Bytecodes::_aastore) {
2218 ciProfileData* data = method()->method_data()->bci_to_data(bci());
2219 bool maybe_null = data == NULL ? true : data->as_BitData()->null_seen();
2220 }
2221 return record_profile_for_speculation(n, exact_kls, maybe_null);
2222 return n;
2223 }
2224
2225 /**
2226 * Record profiling data from argument profiling at an invoke with the
2227 * type system so that it can propagate it (speculation)
2228 *
2229 * @param dest_method target method for the call
2230 * @param bc what invoke bytecode is this?
2231 */
2232 void GraphKit::record_profiled_arguments_for_speculation(ciMethod* dest_method, Bytecodes::Code bc) {
2233 if (!UseTypeSpeculation) {
2234 return;
2235 }
2236 const TypeFunc* tf = TypeFunc::make(dest_method);
2237 int nargs = tf->domain_sig()->cnt() - TypeFunc::Parms;
2238 int skip = Bytecodes::has_receiver(bc) ? 1 : 0;
2239 for (int j = skip, i = 0; j < nargs && i < TypeProfileArgsLimit; j++) {
2240 const Type *targ = tf->domain_sig()->field_at(j + TypeFunc::Parms);
2241 if (targ->basic_type() == T_OBJECT || targ->basic_type() == T_ARRAY) {
2242 bool maybe_null = true;
2243 ciKlass* better_type = NULL;
2244 if (method()->argument_profiled_type(bci(), i, better_type, maybe_null)) {
2245 record_profile_for_speculation(argument(j), better_type, maybe_null);
2246 }
2247 i++;
2248 }
2249 }
2250 }
2251
2252 /**
2253 * Record profiling data from parameter profiling at an invoke with
2254 * the type system so that it can propagate it (speculation)
2255 */
2256 void GraphKit::record_profiled_parameters_for_speculation() {
2257 if (!UseTypeSpeculation) {
2258 return;
2259 }
2260 for (int i = 0, j = 0; i < method()->arg_size() ; i++) {
|