News for hackers. Stuff that matters.
Re:Fury: 170x faster than JDK, blazing fast serialization by... by SpaghettiCthulu on Sunday October 08, 2023 @10:06PM (#37816219)
I would go for `MethodHandle`s and lambda metafactory over bytecode where possible. Much easier to avoid and debug bugs in the generation (better errors than those provided by Hotspot's verifier), and avoids needing to worry about constant dynamic at all. Of course, once you need to implement more than one method, you can no longer just use lambda metafactory.

A while back I actually implemented some utilities for generating classes at runtime and "linking" constants into them using constant dynamic. One day I might clean it up and release it as a library.

Re:Fury: 170x faster than JDK, blazing fast serialization by... by chaokunyang on Sunday October 08, 2023 @11:22PM (#37816602)
Good point, I used `lambda metafactory` too in fury, but only for some `constructor/getters`. I implements some Function utils to generate lambda function, see https://github.com/alipay/fury/blob/main/java/fury-core/src/...

I'm not sure whether `MethodHandle` can generate the most complicated code, since the serialization logic here are more complicated even than the manual written code.

Re:Fury: 170x faster than JDK, blazing fast serialization by... by chaokunyang on Sunday October 08, 2023 @11:22PM (#37816606)
Looking forward to your library