▲ | torginus 5 days ago | |||||||
From what he describes, he uses stack maps to tell which stack values are pointers. He can skip over everything that's not a pointer. On x86_64 you need about 10k function deep stack, all of them with the 14 GPs filled with pointers -to have an 1MB stack. | ||||||||
▲ | pizlonator 5 days ago | parent [-] | |||||||
To play devil's advocate, the suckiest part about stack scanning is that it's a linked list walk. It's not a linear scan. So it's all pointer chasing. And it's very likely to find previously unmarked pointers, which involves CAS and other work. (It would be a linear scan if I was just conservatively scanning, but then I'd have other problems.) This is one of the most counterintuitive parts of GC perf! You'd think that the stack scan had to be a bottleneck, and it might even be one in some corner cases. But it's just not the longest pole in the tent most of the time, because you're so unlikely to actually have a 1MB stack, and programs that do have a 1MB stack tend to also have ginormous heaps (like many gigabytes), which then means that even if the stack scan is a problem it's not the problem. | ||||||||
|