Mnemonics: type-safe bytecode generation at run time

  • Authors:
  • Johannes Rudolph;Peter Thiemann

  • Affiliations:
  • University of Freiburg, Freiburg, Germany;University of Freiburg, Freiburg, Germany

  • Venue:
  • Higher-Order and Symbolic Computation
  • Year:
  • 2010

Quantified Score

Hi-index 0.00

Visualization

Abstract

Mnemonics is a Scala library for generating method bodies in JVM bytecode at run time. Mnemonics supports a large subset of the JVM instructions, for which the static typing of the generator guarantees the well-formedness of the generated bytecode.The library exploits a number of advanced features of Scala's type system (type inference with bounded polymorphism, implicit parameters, and reflection) to guarantee that the compiler only accepts legal combinations of instructions at compile time. Additional instructions are supported at the price of a check at run time of the generator. In either case, bytecode verification of generated code is guaranteed to succeed.