Skip to content

Add sanity checks to InsnList

When I was using ASM lib, sometimes I accidentally added instruction that already belongs to InsnList, to another InsnList. This was causing that most instructions were replaced with nulls in InsnList. Or when I remove instruction that does not belong to any InsnList, then it would delete all instructions.

Debugging it was always a big pain as I don't know which part of my code is introducing this undefined behaviour. Thats why I'm creating this PR to add sanity checks to avoid running into these undefined behaviours.

Also the tests were failing because the cloned LabelNode wasn't actually freshly cloned as it still belonged to InsnList. This PR also fixes it.

Merge request reports

Loading