4 ms·
No, safepoints are added to your code by the JVM automatically. When bytecode is being interpreted, every bytecode instruction has a safepoint after it. In com
by native_samples 4y ago
No, safepoints are added to your code by the JVM automatically.
When bytecode is being interpreted, every bytecode instruction has a safepoint after it. In compiled code polls are scattered thoughout the code, for example on method entries and loop back edges (so the comment above about needing to add code in tight loops to help the GC is wrong).
- papercrane 4y ago> so the comment above about needing to add code in tight loops to help the GC is wrong This is something where the answer is "it depends". Hotspot will omit the safe point poll in counted loops since it knows those loops will terminate.