Get Started

Beyond Native Code: Python, JVM, .NET, and WebAssembly Bytecode

A bytecode file is a program plus the compiler's notes about it, and this lesson builds the readers that show which notes each container keeps.

150 minutesBuildPython, Java, C#, WebAssembly textMembers

Learning Objectives

  • Read the 16-byte .pyc header from PEP 552 and unmarshal the code object without the marshal module, for files written by four interpreter versions.
  • Parse a JVM class file from JVMS Chapter 4: constant pool, fields, methods, the Code attribute, and the tables that javac -g adds.
  • Disassemble the JVM opcodes in Ledger.class and prove the listing against javap -c on four builds of the same source.
  • Read a WebAssembly module section by section, decode every function body, and prove the result against wasm-objdump -d.
  • Walk the ECMA-335 metadata of a .NET assembly from the PE data directory to the MethodDef rows and the CIL of each method, checked against the reader library that ILSpy uses.
  • Measure, for one function in five containers, which names, types, and control structure each format keeps and which it loses.