[rvm-research] online turning on/off write barriers

Shoaib Akram <[email protected]> Wed, 9 Jan 2019 15:48:57 +0100
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <[email protected]>
Hi All,

Hello from Ghent University and happy new year!

As part of my research, I want to build a JVM prototype, which enables executing certain phases of the program using write barriers (both primitive and references), and other phases without write barriers. The write barrier will do some accounting, for example, set a special bit the object header. Generally, you can build the JVM with write barriers enabled or disabled. My idea is to use the benefit of the write barrier to online monitor certain activities, whereas not pay the penalty of having the barriers turned on during the entire program execution. Note that dividing the barrier into a fast path (check a flag and leave the barrier), and a slow path (check a flag and do the accounting) is not very helpful since the cost of the extra method call(s) when barriers are enabled is prohibiti
 ve. The cost of accounting (setting bit in header) is a fraction of the total cost of enabling the write barriers.

One way to accomplish this is to recompile all methods while informing the compiler(s) to insert or leave the write barrier code. Has anyone tried doing such a thing in the past? Any thoughts on alternative ways or challenges involved are welcome! 

Thanks,
Shoaib