3428 case vmIntrinsics::_getFloat_raw : append_unsafe_get_raw(callee, T_FLOAT ); return; 3429 case vmIntrinsics::_getDouble_raw : append_unsafe_get_raw(callee, T_DOUBLE); return; 3430 case vmIntrinsics::_putByte_raw : append_unsafe_put_raw(callee, T_BYTE ); return; 3431 case vmIntrinsics::_putShort_raw : append_unsafe_put_raw(callee, T_SHORT ); return; 3432 case vmIntrinsics::_putChar_raw : append_unsafe_put_raw(callee, T_CHAR ); return; 3433 case vmIntrinsics::_putInt_raw : append_unsafe_put_raw(callee, T_INT ); return; 3434 case vmIntrinsics::_putLong_raw : append_unsafe_put_raw(callee, T_LONG ); return; 3435 case vmIntrinsics::_putFloat_raw : append_unsafe_put_raw(callee, T_FLOAT ); return; 3436 case vmIntrinsics::_putDouble_raw : append_unsafe_put_raw(callee, T_DOUBLE); return; 3437 case vmIntrinsics::_putOrderedObject : append_unsafe_put_obj(callee, T_OBJECT, true); return; 3438 case vmIntrinsics::_putOrderedInt : append_unsafe_put_obj(callee, T_INT, true); return; 3439 case vmIntrinsics::_putOrderedLong : append_unsafe_put_obj(callee, T_LONG, true); return; 3440 case vmIntrinsics::_compareAndSwapLong: 3441 case vmIntrinsics::_compareAndSwapInt: 3442 case vmIntrinsics::_compareAndSwapObject: append_unsafe_CAS(callee); return; 3443 case vmIntrinsics::_getAndAddInt: 3444 case vmIntrinsics::_getAndAddLong : append_unsafe_get_and_set_obj(callee, true); return; 3445 case vmIntrinsics::_getAndSetInt : 3446 case vmIntrinsics::_getAndSetLong : 3447 case vmIntrinsics::_getAndSetObject : append_unsafe_get_and_set_obj(callee, false); return; 3448 default: 3449 break; 3450 } 3451 3452 // create intrinsic node 3453 const bool has_receiver = !callee->is_static(); 3454 ValueType* result_type = as_ValueType(callee->return_type()); 3455 ValueStack* state_before = copy_state_for_exception(); 3456 3457 Values* args = state()->pop_arguments(callee->arg_size()); 3458 3459 if (is_profiling()) { 3460 // Don't profile in the special case where the root method 3461 // is the intrinsic 3462 if (callee != method()) { 3463 // Note that we'd collect profile data in this method if we wanted it. 3464 compilation()->set_would_profile(true); 3465 if (profile_calls()) { 3466 Value recv = NULL; 3467 if (has_receiver) { 4162 4163 #ifndef _LP64 4164 offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT))); 4165 #endif 4166 4167 args->push(src); 4168 args->push(offset); 4169 args->push(cmpval); 4170 args->push(newval); 4171 4172 // An unsafe CAS can alias with other field accesses, but we don't 4173 // know which ones so mark the state as no preserved. This will 4174 // cause CSE to invalidate memory across it. 4175 bool preserves_state = false; 4176 Intrinsic* result = new Intrinsic(result_type, callee->intrinsic_id(), args, false, state_before, preserves_state); 4177 append_split(result); 4178 push(result_type, result); 4179 compilation()->set_has_unsafe_access(true); 4180 } 4181 4182 4183 void GraphBuilder::print_inlining(ciMethod* callee, const char* msg, bool success) { 4184 CompileLog* log = compilation()->log(); 4185 if (log != NULL) { 4186 if (success) { 4187 if (msg != NULL) 4188 log->inline_success(msg); 4189 else 4190 log->inline_success("receiver is statically known"); 4191 } else { 4192 if (msg != NULL) 4193 log->inline_fail(msg); 4194 else 4195 log->inline_fail("reason unknown"); 4196 } 4197 } 4198 #if INCLUDE_TRACE 4199 EventCompilerInlining event; 4200 if (event.should_commit()) { 4201 event.set_compileID(compilation()->env()->task()->compile_id()); | 3428 case vmIntrinsics::_getFloat_raw : append_unsafe_get_raw(callee, T_FLOAT ); return; 3429 case vmIntrinsics::_getDouble_raw : append_unsafe_get_raw(callee, T_DOUBLE); return; 3430 case vmIntrinsics::_putByte_raw : append_unsafe_put_raw(callee, T_BYTE ); return; 3431 case vmIntrinsics::_putShort_raw : append_unsafe_put_raw(callee, T_SHORT ); return; 3432 case vmIntrinsics::_putChar_raw : append_unsafe_put_raw(callee, T_CHAR ); return; 3433 case vmIntrinsics::_putInt_raw : append_unsafe_put_raw(callee, T_INT ); return; 3434 case vmIntrinsics::_putLong_raw : append_unsafe_put_raw(callee, T_LONG ); return; 3435 case vmIntrinsics::_putFloat_raw : append_unsafe_put_raw(callee, T_FLOAT ); return; 3436 case vmIntrinsics::_putDouble_raw : append_unsafe_put_raw(callee, T_DOUBLE); return; 3437 case vmIntrinsics::_putOrderedObject : append_unsafe_put_obj(callee, T_OBJECT, true); return; 3438 case vmIntrinsics::_putOrderedInt : append_unsafe_put_obj(callee, T_INT, true); return; 3439 case vmIntrinsics::_putOrderedLong : append_unsafe_put_obj(callee, T_LONG, true); return; 3440 case vmIntrinsics::_compareAndSwapLong: 3441 case vmIntrinsics::_compareAndSwapInt: 3442 case vmIntrinsics::_compareAndSwapObject: append_unsafe_CAS(callee); return; 3443 case vmIntrinsics::_getAndAddInt: 3444 case vmIntrinsics::_getAndAddLong : append_unsafe_get_and_set_obj(callee, true); return; 3445 case vmIntrinsics::_getAndSetInt : 3446 case vmIntrinsics::_getAndSetLong : 3447 case vmIntrinsics::_getAndSetObject : append_unsafe_get_and_set_obj(callee, false); return; 3448 case vmIntrinsics::_getCharStringU : append_char_access(callee, false); return; 3449 case vmIntrinsics::_putCharStringU : append_char_access(callee, true); return; 3450 default: 3451 break; 3452 } 3453 3454 // create intrinsic node 3455 const bool has_receiver = !callee->is_static(); 3456 ValueType* result_type = as_ValueType(callee->return_type()); 3457 ValueStack* state_before = copy_state_for_exception(); 3458 3459 Values* args = state()->pop_arguments(callee->arg_size()); 3460 3461 if (is_profiling()) { 3462 // Don't profile in the special case where the root method 3463 // is the intrinsic 3464 if (callee != method()) { 3465 // Note that we'd collect profile data in this method if we wanted it. 3466 compilation()->set_would_profile(true); 3467 if (profile_calls()) { 3468 Value recv = NULL; 3469 if (has_receiver) { 4164 4165 #ifndef _LP64 4166 offset = append(new Convert(Bytecodes::_l2i, offset, as_ValueType(T_INT))); 4167 #endif 4168 4169 args->push(src); 4170 args->push(offset); 4171 args->push(cmpval); 4172 args->push(newval); 4173 4174 // An unsafe CAS can alias with other field accesses, but we don't 4175 // know which ones so mark the state as no preserved. This will 4176 // cause CSE to invalidate memory across it. 4177 bool preserves_state = false; 4178 Intrinsic* result = new Intrinsic(result_type, callee->intrinsic_id(), args, false, state_before, preserves_state); 4179 append_split(result); 4180 push(result_type, result); 4181 compilation()->set_has_unsafe_access(true); 4182 } 4183 4184 void GraphBuilder::append_char_access(ciMethod* callee, bool is_store) { 4185 // This intrinsic accesses byte[] array as char[] array. Computing the offsets 4186 // correctly requires matched array shapes. 4187 assert (arrayOopDesc::base_offset_in_bytes(T_CHAR) == arrayOopDesc::base_offset_in_bytes(T_BYTE), 4188 "sanity: byte[] and char[] bases agree"); 4189 assert (type2aelembytes(T_CHAR) == type2aelembytes(T_BYTE)*2, 4190 "sanity: byte[] and char[] scales agree"); 4191 4192 ValueStack* state_before = copy_state_indexed_access(); 4193 compilation()->set_has_access_indexed(true); 4194 Values* args = state()->pop_arguments(callee->arg_size()); 4195 Value array = args->at(0); 4196 Value index = args->at(1); 4197 if (is_store) { 4198 Value value = args->at(2); 4199 Instruction* store = append(new StoreIndexed(array, index, NULL, T_CHAR, value, state_before)); 4200 store->set_flag(Instruction::NeedsRangeCheckFlag, false); 4201 _memory->store_value(value); 4202 } else { 4203 Instruction* load = append(new LoadIndexed(array, index, NULL, T_CHAR, state_before)); 4204 load->set_flag(Instruction::NeedsRangeCheckFlag, false); 4205 push(load->type(), load); 4206 } 4207 } 4208 4209 void GraphBuilder::print_inlining(ciMethod* callee, const char* msg, bool success) { 4210 CompileLog* log = compilation()->log(); 4211 if (log != NULL) { 4212 if (success) { 4213 if (msg != NULL) 4214 log->inline_success(msg); 4215 else 4216 log->inline_success("receiver is statically known"); 4217 } else { 4218 if (msg != NULL) 4219 log->inline_fail(msg); 4220 else 4221 log->inline_fail("reason unknown"); 4222 } 4223 } 4224 #if INCLUDE_TRACE 4225 EventCompilerInlining event; 4226 if (event.should_commit()) { 4227 event.set_compileID(compilation()->env()->task()->compile_id()); |