8329726: Use non-short forward jumps in lightweight locking
Reviewed-by: shade, kvn, aboldtch
This commit is contained in:
parent
e75e1cb02c
commit
2e925f263d
@ -1022,15 +1022,18 @@ void C2_MacroAssembler::fast_lock_lightweight(Register obj, Register box, Regist
|
||||
#ifdef ASSERT
|
||||
// Check that locked label is reached with ZF set.
|
||||
Label zf_correct;
|
||||
jccb(Assembler::zero, zf_correct);
|
||||
stop("Fast Lock ZF != 1");
|
||||
Label zf_bad_zero;
|
||||
jcc(Assembler::zero, zf_correct);
|
||||
jmp(zf_bad_zero);
|
||||
#endif
|
||||
|
||||
bind(slow_path);
|
||||
#ifdef ASSERT
|
||||
// Check that slow_path label is reached with ZF not set.
|
||||
jccb(Assembler::notZero, zf_correct);
|
||||
jcc(Assembler::notZero, zf_correct);
|
||||
stop("Fast Lock ZF != 0");
|
||||
bind(zf_bad_zero);
|
||||
stop("Fast Lock ZF != 1");
|
||||
bind(zf_correct);
|
||||
#endif
|
||||
// C2 uses the value of ZF to determine the continuation.
|
||||
@ -1161,7 +1164,7 @@ void C2_MacroAssembler::fast_unlock_lightweight(Register obj, Register reg_rax,
|
||||
#ifdef ASSERT
|
||||
// Check that unlocked label is reached with ZF set.
|
||||
Label zf_correct;
|
||||
jccb(Assembler::zero, zf_correct);
|
||||
jcc(Assembler::zero, zf_correct);
|
||||
stop("Fast Unlock ZF != 1");
|
||||
#endif
|
||||
|
||||
|
38
test/hotspot/jtreg/compiler/c2/TestLWLockingCodeGen.java
Normal file
38
test/hotspot/jtreg/compiler/c2/TestLWLockingCodeGen.java
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @summary Tests correct code generation of lightweight locking when using -XX:+ShowMessageBoxOnError; times-out on failure
|
||||
* @bug 8329726
|
||||
* @run main/othervm -XX:+ShowMessageBoxOnError -Xcomp -XX:-TieredCompilation -XX:CompileOnly=TestLWLockingCodeGen::sync TestLWLockingCodeGen
|
||||
*/
|
||||
public class TestLWLockingCodeGen {
|
||||
private static int val = 0;
|
||||
public static void main(String[] args) {
|
||||
sync();
|
||||
}
|
||||
private static synchronized void sync() {
|
||||
val = val + (int)(Math.random() * 42);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user