I've been wondering where interpreted byte-code of methods are stored internally in the JVM (specifically HotSpot x64). I know that methods that are JIT-ed are stored and can be accessed in the Method structure but I'm trying to understand where the JVM stores the byte-code converted to assembly instructions (I assume it stores them, otherwise there would be a lot of memory usage to interpret every invocation) as I wasn't able to find it in the internals source code.
0
votes
1 Answers
2
votes
Interpreting bytecode is not as expensive as you would think. Why would the JVM spend time generating machine code for code that runs once? Best to wait until a certain method or block reaches the JIT threshold and only then spend time enabling the tracing JIT.
The src/share/vm/interpreter subdirectory seems to be what you're after:
bytecodeInterpreter.cppimplements the actual stack machine;bytecodes.cppdefines the shape and attributes of each opcode.bytecodes.hdeclares all bytecodes.templateTable.cppcontains machinery to map JVM opcodes to assembly.cpu/*/vm/templateTable*.cppcontains the actual code to generate assembly snippets for the given CPU.