The current mechanism that maintains the scavenge roots in nmethods list is unsuitable for G1. The list implies that there are two types of collections: young (after which the list should be pruned) and full (during which we would scan the whole code cache). So, currently G1 doesn't prune this list at all, which means that the list can grow pretty big. We must have something more flexible. The best way I see to do that is that we would have Rset for each G1 region that would contains nmethods that point to this region. This would allow us to scan only the nmethods requried and also to parallelize the scanning process.