Reputation: 35
I was told when a reference has been changed in jvm , using g1 gc will insert pre write barrier to change the remember set accordingly ,but where is the code ? i check the byte code implementation such as putstatic ,but i can't find where the pre barrier occur ? where and how dose the g1 gc insert the pre write barrier?
Upvotes: 2
Views: 497
Reputation: 121008
Probably already obvious from Holger's comment, but this will not be present at the bytecode level, but generated by JIT
.
The best explanation is in the source code itself, which in some case is excellent and at times very clear:
G1 also requires to keep track of object references between different regions to enable evacuation of old regions, which is done as part of mixed collections. References are tracked in remembered sets and is continuously updated as reference are written to with the help of the post-barrier.
You can also find what remembered sets are, for example, or how they are constructed.
And here is the post_barrier
method that C2
compiler uses. Though some things I can understand from that source code, some are too complicated for me, as such, happy reading the code :)
Upvotes: 2