#27 Primitive Write Barrier Debugging: A Non Writable Heap


The mechanism used to successfully debug and integrate primitive write barriers into trunk was a write protected heap. This mechanism was never included in trunk and is made available here in the research archive.

The MMTk side of the write barriers (primitive and reference) was modified to make the update into the heap via a mmaped page alias. Code that directly attempted to write to the heap caused a SIGSEGV and the resulting stack trace allowed for the correct barrier to be inserted. For more details of this approach see: http://www.cs.kent.ac.uk/people/rpg/lh243/conferences/index.html#MM-NET09

The major drawback of this approach is that it is an "all or nothing" approach protecting all fields within the heap. This means that the attached patches also includes barriers on TIB, lock, hash status and alignment gap writes - this is why the code was never included back into trunk.

The compiler and MMTk support in these patches is not exactly the same as that in trunk but does demonstrate the principles used.

These patches are based on r15761

  • 01-backportRVM834.patch - backported RVM-834 patch
  • 02-modifyCompilers.patch - primitive write barrier support for baseline and opt compilers. The compiler and MMTk support in this patch differs from the final version in trunk
  • 03-makeVMinternalsUseWriteBarriers.patch - this patch forces TIB, lock etc writes to go via a write barrier
  • 04-writeProtectHeap.patch - create 2 new build configs BaseBaseSSDebug and ExtremeAssertionsOptAdaptiveSSDebug, these configs use the new org.mmtk.plan.semispace.writeBarrierDebug.WriteBarrierDebug GC plan which is a semi-space collector that uses primitive write barriers. This final patch changes Mmapper.java to allocate the heap write protected and backed to a file store. All write barriers use this file store to create a mmap alias to write values into the actual heap.

If you have any questions or comments please feel free to ask


Log in to post a comment.