Unrolling Java Loops at Runtime with Byte Buddy
blog.bramp.net
blog.bramp.net
With something like JavaPoet, it's fairly easy to do as well. It feels a lot safer than manually creating byte code like that. Let javac do that for you.
EDIT: If you're not familiar with JavaPoet, check it out here: https://corner.squareup.com/2015/01/javapoet.html
Does anyone know if Unsafe is indeed blacklisted for JIT optimisations?