Mercurial > hg > jdk9-shenandoah > hotspot
changeset 9617:cff0ec3d1627
Enable implicit null checks for write barriers.
author | rkennke |
---|---|
date | Wed, 16 Sep 2015 17:19:55 +0200 |
parents | 61530c614f13 |
children | 32062879e445 |
files | src/cpu/x86/vm/x86_64.ad src/share/vm/opto/lcm.cpp test/gc/shenandoah/TestImplicitNullChecks.java test/gc/shenandoah/TestImplicitNullChecks2.java |
diffstat | 4 files changed, 58 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/cpu/x86/vm/x86_64.ad Fri Sep 11 18:36:30 2015 +0200 +++ b/src/cpu/x86/vm/x86_64.ad Wed Sep 16 17:19:55 2015 +0200 @@ -6476,6 +6476,7 @@ assert(s == rdi, "need rdi"); assert(d == rax, "result in rax"); Address evacuation_in_progress = Address(r15_thread, in_bytes(JavaThread::evacuation_in_progress_offset())); + __ movptr(d, Address(s, -8)); __ cmpb(evacuation_in_progress, 0); __ movptr(d, Address(s, -8)); __ jcc(Assembler::equal, done);
--- a/src/share/vm/opto/lcm.cpp Fri Sep 11 18:36:30 2015 +0200 +++ b/src/share/vm/opto/lcm.cpp Wed Sep 16 17:19:55 2015 +0200 @@ -159,8 +159,6 @@ was_store = false; int iop = mach->ideal_Opcode(); switch( iop ) { - case Op_ShenandoahReadBarrier: - // TODO: Is this needed? case Op_LoadB: case Op_LoadUB: case Op_LoadUS: @@ -176,6 +174,8 @@ case Op_LoadRange: case Op_LoadD_unaligned: case Op_LoadL_unaligned: + case Op_ShenandoahReadBarrier: + case Op_ShenandoahWriteBarrier: assert(mach->in(2) == val, "should be address"); break; case Op_StoreB: @@ -382,7 +382,7 @@ // Should be DU safe because no edge updates. for (DUIterator_Fast jmax, j = best->fast_outs(jmax); j < jmax; j++) { Node* n = best->fast_out(j); - if( n->is_MachProj() ) { + if( n->is_MachProj() || n->Opcode() == Op_ShenandoahWBMemProj) { get_block_for_node(n)->find_remove(n); block->add_inst(n); map_node_to_block(n, block);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/gc/shenandoah/TestImplicitNullChecks.java Wed Sep 16 17:19:55 2015 +0200 @@ -0,0 +1,27 @@ + +/* + * @test TestImplicitNullChecks + * @run main/othervm -XX:+UseShenandoahGC -XX:-UseCompressedOops -XX:CompileOnly=TestImplicitNullChecks.test TestImplicitNullChecks + */ +public class TestImplicitNullChecks { + + public static class Test { + public int x; + } + + public static void main(String[] args) { + try { + for (int x = 0; x < 1000000; x++) { + Test t = new Test(); + test(t); + } + test(null); + } catch (NullPointerException ex) { + // Ok. + } + } + + private static void test(Test t) { + t.x = (int) (Math.random() * Integer.MAX_VALUE); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/gc/shenandoah/TestImplicitNullChecks2.java Wed Sep 16 17:19:55 2015 +0200 @@ -0,0 +1,27 @@ + +/* + * @test TestImplicitNullChecks2 + * @run main/othervm -XX:+UseShenandoahGC -XX:-UseCompressedOops -XX:CompileOnly=TestImplicitNullChecks2.test TestImplicitNullChecks2 + */ +public class TestImplicitNullChecks2 { + + public static class Test { + public int x; + } + + public static void main(String[] args) { + try { + for (int x = 0; x < 1000000; x++) { + Test t = new Test(); + test(t); + } + test(null); + } catch (NullPointerException ex) { + // Ok. + } + } + + private static int test(Test t) { + return t.x; + } +}