mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-23 16:55:09 +00:00
8005816: Shark: fix volatile float field access
Reviewed-by: twisti
This commit is contained in:
parent
6c57a4b9f8
commit
a42478ecf4
@ -1044,10 +1044,17 @@ void SharkBlock::do_field_access(bool is_get, bool is_field) {
|
||||
BasicType basic_type = field->type()->basic_type();
|
||||
Type *stack_type = SharkType::to_stackType(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(
|
||||
object, in_ByteSize(field->offset_in_bytes()),
|
||||
PointerType::getUnqual(field_type),
|
||||
PointerType::getUnqual(type),
|
||||
"addr");
|
||||
|
||||
// Do the access
|
||||
@ -1055,6 +1062,7 @@ void SharkBlock::do_field_access(bool is_get, bool is_field) {
|
||||
Value* field_value;
|
||||
if (field->is_volatile()) {
|
||||
field_value = builder()->CreateAtomicLoad(addr);
|
||||
field_value = builder()->CreateBitCast(field_value, field_type);
|
||||
} else {
|
||||
field_value = builder()->CreateLoad(addr);
|
||||
}
|
||||
@ -1074,6 +1082,7 @@ void SharkBlock::do_field_access(bool is_get, bool is_field) {
|
||||
}
|
||||
|
||||
if (field->is_volatile()) {
|
||||
field_value = builder()->CreateBitCast(field_value, type);
|
||||
builder()->CreateAtomicStore(field_value, addr);
|
||||
} else {
|
||||
builder()->CreateStore(field_value, addr);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user