提交 534d157f 编写于 作者: T twisti

8005816: Shark: fix volatile float field access

Reviewed-by: twisti
Contributed-by: NRoman Kennke <rkennke@redhat.com>
上级 1339118f
...@@ -1044,10 +1044,17 @@ void SharkBlock::do_field_access(bool is_get, bool is_field) { ...@@ -1044,10 +1044,17 @@ void SharkBlock::do_field_access(bool is_get, bool is_field) {
BasicType basic_type = field->type()->basic_type(); BasicType basic_type = field->type()->basic_type();
Type *stack_type = SharkType::to_stackType(basic_type); Type *stack_type = SharkType::to_stackType(basic_type);
Type *field_type = SharkType::to_arrayType(basic_type); Type *field_type = SharkType::to_arrayType(basic_type);
Type *type = field_type;
if (field->is_volatile()) {
if (field_type == SharkType::jfloat_type()) {
type = SharkType::jint_type();
} else if (field_type == SharkType::jdouble_type()) {
type = SharkType::jlong_type();
}
}
Value *addr = builder()->CreateAddressOfStructEntry( Value *addr = builder()->CreateAddressOfStructEntry(
object, in_ByteSize(field->offset_in_bytes()), object, in_ByteSize(field->offset_in_bytes()),
PointerType::getUnqual(field_type), PointerType::getUnqual(type),
"addr"); "addr");
// Do the access // Do the access
...@@ -1055,6 +1062,7 @@ void SharkBlock::do_field_access(bool is_get, bool is_field) { ...@@ -1055,6 +1062,7 @@ void SharkBlock::do_field_access(bool is_get, bool is_field) {
Value* field_value; Value* field_value;
if (field->is_volatile()) { if (field->is_volatile()) {
field_value = builder()->CreateAtomicLoad(addr); field_value = builder()->CreateAtomicLoad(addr);
field_value = builder()->CreateBitCast(field_value, field_type);
} else { } else {
field_value = builder()->CreateLoad(addr); field_value = builder()->CreateLoad(addr);
} }
...@@ -1074,6 +1082,7 @@ void SharkBlock::do_field_access(bool is_get, bool is_field) { ...@@ -1074,6 +1082,7 @@ void SharkBlock::do_field_access(bool is_get, bool is_field) {
} }
if (field->is_volatile()) { if (field->is_volatile()) {
field_value = builder()->CreateBitCast(field_value, type);
builder()->CreateAtomicStore(field_value, addr); builder()->CreateAtomicStore(field_value, addr);
} else { } else {
builder()->CreateStore(field_value, addr); builder()->CreateStore(field_value, addr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册