# HG changeset patch # User twisti # Date 1357951643 28800 # Node ID f9bda35f42265ad528c4485e20980cebeded364b # Parent a3f92e6c0274558246376757fefd1f80d0c5afcc 8005816: Shark: fix volatile float field access Reviewed-by: twisti Contributed-by: Roman Kennke diff -r a3f92e6c0274 -r f9bda35f4226 src/share/vm/shark/sharkBlock.cpp --- a/src/share/vm/shark/sharkBlock.cpp Fri Jan 11 14:07:09 2013 -0800 +++ b/src/share/vm/shark/sharkBlock.cpp Fri Jan 11 16:47:23 2013 -0800 @@ -1044,10 +1044,17 @@ 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 @@ 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 @@ } if (field->is_volatile()) { + field_value = builder()->CreateBitCast(field_value, type); builder()->CreateAtomicStore(field_value, addr); } else { builder()->CreateStore(field_value, addr);