hg: valhalla/valhalla: [lworld] test_value_is_not_buffered() must use cmpq instead of cmpl

Tobias Hartmann tobias.hartmann at oracle.com
Wed Mar 28 08:32:55 UTC 2018


Hi,

I've been seeing very intermittent errors of the following kind:
#  Internal Error (/oracle/valhallaL/open/src/hotspot/share/interpreter/interpreterRuntime.cpp:590),
pid=23955, tid=23956
#  assert(VTBuffer::is_in_vt_buffer(obj)) failed: Must only be called for buffered values

With some debugging code, it turned out that MacroAssembler::test_value_is_not_buffered() returns
the wrong result (false) for the following case:

VTBuffer top:  0x00007f6cd844a000
VTBuffer end:  0x00007f6cd84ca000
VTBuffer base: 0x00007f6cd844a000
Heap base:     0x00000006c9800000
oop:           0x00000006d844a008

I've discusses this with Frederic and we came to the conclusion that the problem is that the method
only compares 32 bits. The `cmpl` instruction corresponds to a `CMP r32, r32` because we are using
`prefix_and_encode` which does not set the `REX.W` prefix. On the other hand, the `cmpq` instruction
corresponds to a CMP r64, r64 because we are using `prefixq_and_encode` which sets the `REX.W`
prefix. We should use `cmpptr` which defaults to `cmpq` if `_LP64` is defined. See page 255 of the
Intel manual [1] for details.

I've verified that this solves the crashes (100 runs).

Best regards,
Tobias

[1]
https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf


On 28.03.2018 10:27, tobias.hartmann at oracle.com wrote:
> Changeset: ea3b767c7e1e
> Author:    thartmann
> Date:      2018-03-28 10:27 +0200
> URL:       http://hg.openjdk.java.net/valhalla/valhalla/rev/ea3b767c7e1e
> 
> [lworld] test_value_is_not_buffered() must use cmpq instead of cmpl
> 
> ! src/hotspot/cpu/x86/macroAssembler_x86.cpp
> 


More information about the valhalla-dev mailing list