关于g1 gc on pre write barrier的问题

Questions about g1 gc on pre write barrier

有人告诉我,当在 jvm 中更改引用时,使用 g1 gc 将插入预写屏障以相应地更改记忆集,但代码在哪里?我检查了诸如 putstatic 之类的字节码实现,但我找不到预屏障发生的位置? g1 gc 在哪里以及如何插入预写屏障?

从 Holger 的评论中可能已经很明显了,但这不会出现在字节码级别,而是由 JIT 生成。

最好的解释是源代码本身,在某些情况下excellent有时非常清楚:

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.

您还可以找到记忆集 are, for example 或它们的构造方式。

hereC2编译器使用的post_barrier方法。虽然有些东西我可以从源代码中理解,但有些东西对我来说太复杂了,因此,很高兴阅读代码:)