4 ms·
You can write these little architectural parts in assembly rather than C, to avoid having to write undefined behaviour.
by chrisseaton 7y ago
You can write these little architectural parts in assembly rather than C, to avoid having to write undefined behaviour.
- saagarjha 7y agoDoes the JVM use assembly for this? I’d expect writing all of the VM code that handles Java objects in assembly for each platform would be a bit difficult, and I’m not sure I saw enough assembly files in the project for this…
- chrisseaton 7y agoNo I mean it is an option available to avoid undefined behaviour, not that this is what the JVM does. But moving more of the implementation of the JVM (or all of it!) to Java is the real solution to all this in my opinion.
- saagarjha 7y ago> No I mean it is an option available to avoid undefined behaviour, not that this is what the JVM does. Ah. > But moving more of the implementation of the JVM (or all of it!) to Java is the real solution to all this in my opinion. And what, ship a Graal binary to cut the bootstrapping/startup step?
- chrisseaton 7y agoYes, rewrite all of the JVM into Java and ship an AOT-compiled binary.
- pron 7y agoBTW, there's much more assembly code in OpenJDK than you'd find by looking for assembly files. There's a lot of code (all of the interpreter, for example) that's generated at startup time, and written in assmebly as a C++ DSL. E.g. https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/templateTable_x86.cpp https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x... and https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp https://github.com/openjdk/jdk/blob/master/src/hotspot/cpu/x...