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