NPEs from barrier code not working


I get failures when i trigger an NPE via SIGSEGV by attempting to write a reference field into a null object in a generational collector.

In summary I believe there are two issues, one covering the other in some situations.

1) The baseline compiler's call to the barrier code is not traversable by stack inspection routines. The CMID of the barrier stackframe will never match the current IP so attempting to traverse this will result in failure. I also assume triggering GC here is fragile.

2) The no NPE in uninterruptible code isn't compatible with the idea of using SIGSEGV within barriers. I think the solution here is to have another annotation that makes this 'ok' and stick it on the MM_Interface.XXXbarrier methods and allow the SIGSEGVs.

The problem does not appear to occur in development builds when initial_compiler=opt as the barrier is inlined. I wonder why the 'actual method' doesnt resolve to an uninterruptible method and trigger a failure in this case though.

This problem becomes much more significant when you start to use read barriers too .

I will try and fix this tomorrow, but any ideas on the easiest way to fix this could be useful.

This code:
public class Test
private static class X { String y; }
private static X x = null;
public static void main(String[] args) {
x.y = "hello";

Dies like this in a development build (without -X:aos:initial_compiler=opt) :

JikesRVM: internal error: recursive use of hardware exception registers (exiting)
– Stack –
at [0x67ab49f8] Lorg/jikesrvm/runtime/VM_Runtime; deliverHardwareException(II)V at line 682
at [0x67ab4a0c] <hardware trap>
at [0x67ae7e74] Lorg/jikesrvm/memorymanagers/mminterface/MM_Interface; putfieldWriteBarrier

And like this (and I assume in development once I fix the initial issue) in a prototype configuration

Fatal error: NullPointerException within uninterruptible region.
Exiting virtual machine due to uninterruptibility violation.

– Stack –
at [0x678e39bc] Lorg/jikesrvm/VM; sysFail(Ljava/lang/StringV at line 2024
at [0x678e39f8] Lorg/jikesrvm/runtime/VM_Runtime; deliverHardwareException(II)V at line 710
at [0x678e3a0c] <hardware trap>
at [0x67916e30] Lorg/jikesrvm/mm/mmtk/Barriers; performWriteInBarrier
at [0x67916e7c] Lorg/mmtk/plan/generational/GenMutator; writeBarrier
at [0x67916ec0] Lorg/jikesrvm/memorymanagers/mminterface/MM_Interface; putfieldWriteBarrier





Daniel Frampton


Daniel Frampton



Fix versions

Affects versions