src/share/vm/shark/sharkBlock.cpp

Print this page
rev 3850 : [mq]: shark.patch

*** 168,181 **** push(SharkValue::jint_constant(iter()->get_constant_u2())); break; case Bytecodes::_ldc: case Bytecodes::_ldc_w: ! case Bytecodes::_ldc2_w: ! push(SharkConstant::for_ldc(iter())->value(builder())); break; ! case Bytecodes::_iload_0: case Bytecodes::_lload_0: case Bytecodes::_fload_0: case Bytecodes::_dload_0: case Bytecodes::_aload_0: --- 168,183 ---- push(SharkValue::jint_constant(iter()->get_constant_u2())); break; case Bytecodes::_ldc: case Bytecodes::_ldc_w: ! case Bytecodes::_ldc2_w: { ! SharkConstant* constant = SharkConstant::for_ldc(iter()); ! assert(constant->is_loaded(), "trap should handle unloaded classes"); ! push(constant->value(builder())); break; ! } case Bytecodes::_iload_0: case Bytecodes::_lload_0: case Bytecodes::_fload_0: case Bytecodes::_dload_0: case Bytecodes::_aload_0:
*** 998,1010 **** builder()->CreateBr(done); builder()->SetInsertPoint(done); PHINode *result; if (is_long) ! result = builder()->CreatePHI(SharkType::jlong_type(), "result"); else ! result = builder()->CreatePHI(SharkType::jint_type(), "result"); result->addIncoming(special_result, special_case); result->addIncoming(general_result, general_case); if (is_long) push(SharkValue::create_jlong(result, false)); --- 1000,1012 ---- builder()->CreateBr(done); builder()->SetInsertPoint(done); PHINode *result; if (is_long) ! result = builder()->CreatePHI(SharkType::jlong_type(), 0, "result"); else ! result = builder()->CreatePHI(SharkType::jint_type(), 0, "result"); result->addIncoming(special_result, special_case); result->addIncoming(general_result, general_case); if (is_long) push(SharkValue::create_jlong(result, false));
*** 1034,1059 **** SharkConstant *constant = SharkConstant::for_field(iter()); if (constant->is_loaded()) value = constant->value(builder()); } if (!is_get || value == NULL) { ! if (!is_field) ! object = builder()->CreateInlineOop(field->holder()); ! BasicType basic_type = field->type()->basic_type(); ! const Type *stack_type = SharkType::to_stackType(basic_type); ! const Type *field_type = SharkType::to_arrayType(basic_type); Value *addr = builder()->CreateAddressOfStructEntry( object, in_ByteSize(field->offset_in_bytes()), PointerType::getUnqual(field_type), "addr"); // Do the access if (is_get) { ! Value *field_value = builder()->CreateLoad(addr); ! if (field_type != stack_type) { field_value = builder()->CreateIntCast( field_value, stack_type, basic_type != T_CHAR); } --- 1036,1065 ---- SharkConstant *constant = SharkConstant::for_field(iter()); if (constant->is_loaded()) value = constant->value(builder()); } if (!is_get || value == NULL) { ! if (!is_field) { ! object = builder()->CreateInlineOop(field->holder()->java_mirror()); ! } BasicType basic_type = field->type()->basic_type(); ! Type *stack_type = SharkType::to_stackType(basic_type); ! Type *field_type = SharkType::to_arrayType(basic_type); Value *addr = builder()->CreateAddressOfStructEntry( object, in_ByteSize(field->offset_in_bytes()), PointerType::getUnqual(field_type), "addr"); // Do the access if (is_get) { ! Value* field_value; ! if (field->is_volatile()) { ! field_value = builder()->CreateAtomicLoad(addr); ! } else { ! field_value = builder()->CreateLoad(addr); ! } if (field_type != stack_type) { field_value = builder()->CreateIntCast( field_value, stack_type, basic_type != T_CHAR); }
*** 1065,1081 **** if (field_type != stack_type) { field_value = builder()->CreateIntCast( field_value, field_type, basic_type != T_CHAR); } builder()->CreateStore(field_value, addr); ! if (!field->type()->is_primitive_type()) builder()->CreateUpdateBarrierSet(oopDesc::bs(), addr); ! ! if (field->is_volatile()) ! builder()->CreateMemoryBarrier(SharkBuilder::BARRIER_STORELOAD); } } // Push the value onto the stack where necessary if (is_get) --- 1071,1089 ---- if (field_type != stack_type) { field_value = builder()->CreateIntCast( field_value, field_type, basic_type != T_CHAR); } + if (field->is_volatile()) { + builder()->CreateAtomicStore(field_value, addr); + } else { builder()->CreateStore(field_value, addr); + } ! if (!field->type()->is_primitive_type()) { builder()->CreateUpdateBarrierSet(oopDesc::bs(), addr); ! } } } // Push the value onto the stack where necessary if (is_get)
*** 1103,1113 **** builder()->SetInsertPoint(gt); builder()->CreateBr(done); builder()->SetInsertPoint(done); ! PHINode *result = builder()->CreatePHI(SharkType::jint_type(), "result"); result->addIncoming(LLVMValue::jint_constant(-1), lt); result->addIncoming(LLVMValue::jint_constant(0), eq); result->addIncoming(LLVMValue::jint_constant(1), gt); push(SharkValue::create_jint(result, false)); --- 1111,1121 ---- builder()->SetInsertPoint(gt); builder()->CreateBr(done); builder()->SetInsertPoint(done); ! PHINode *result = builder()->CreatePHI(SharkType::jint_type(), 0, "result"); result->addIncoming(LLVMValue::jint_constant(-1), lt); result->addIncoming(LLVMValue::jint_constant(0), eq); result->addIncoming(LLVMValue::jint_constant(1), gt); push(SharkValue::create_jint(result, false));
*** 1150,1160 **** builder()->SetInsertPoint(eq); builder()->CreateBr(done); builder()->SetInsertPoint(done); ! PHINode *result = builder()->CreatePHI(SharkType::jint_type(), "result"); result->addIncoming(LLVMValue::jint_constant(-1), lt); result->addIncoming(LLVMValue::jint_constant(0), eq); result->addIncoming(LLVMValue::jint_constant(1), gt); push(SharkValue::create_jint(result, false)); --- 1158,1168 ---- builder()->SetInsertPoint(eq); builder()->CreateBr(done); builder()->SetInsertPoint(done); ! PHINode *result = builder()->CreatePHI(SharkType::jint_type(), 0, "result"); result->addIncoming(LLVMValue::jint_constant(-1), lt); result->addIncoming(LLVMValue::jint_constant(0), eq); result->addIncoming(LLVMValue::jint_constant(1), gt); push(SharkValue::create_jint(result, false));