8223472: volatile long field corruption on x86_32

Reviewed-by: eosterlund, dholmes, shade, coleenp
This commit is contained in:
Boris Ulasevich 2019-05-17 11:44:44 +02:00
parent 00a7dce177
commit 5db94d085a

View File

@ -2986,7 +2986,8 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
__ jcc(Assembler::notEqual, notDouble);
#endif
// dtos
__ access_load_at(T_DOUBLE, IN_HEAP, noreg /* dtos */, field, noreg, noreg);
// MO_RELAXED: for the case of volatile field, in fact it adds no extra work for the underlying implementation
__ access_load_at(T_DOUBLE, IN_HEAP | MO_RELAXED, noreg /* dtos */, field, noreg, noreg);
__ push(dtos);
// Rewrite bytecode to be faster
if (!is_static && rc == may_rewrite) {
@ -3255,7 +3256,8 @@ void TemplateTable::putfield_or_static_helper(int byte_no, bool is_static, Rewri
{
__ pop(ltos);
if (!is_static) pop_and_check_object(obj);
__ access_store_at(T_LONG, IN_HEAP, field, noreg /* ltos*/, noreg, noreg);
// MO_RELAXED: generate atomic store for the case of volatile field (important for x86_32)
__ access_store_at(T_LONG, IN_HEAP | MO_RELAXED, field, noreg /* ltos*/, noreg, noreg);
#ifdef _LP64
if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_lputfield, bc, rbx, true, byte_no);
@ -3290,7 +3292,8 @@ void TemplateTable::putfield_or_static_helper(int byte_no, bool is_static, Rewri
{
__ pop(dtos);
if (!is_static) pop_and_check_object(obj);
__ access_store_at(T_DOUBLE, IN_HEAP, field, noreg /* dtos */, noreg, noreg);
// MO_RELAXED: for the case of volatile field, in fact it adds no extra work for the underlying implementation
__ access_store_at(T_DOUBLE, IN_HEAP | MO_RELAXED, field, noreg /* dtos */, noreg, noreg);
if (!is_static && rc == may_rewrite) {
patch_bytecode(Bytecodes::_fast_dputfield, bc, rbx, true, byte_no);
}