Mnemonics: type-safe bytecode generation at run time

  • Authors:
  • Johannes Rudolph;Peter Thiemann

  • Affiliations:
  • Albert-Ludwigs-Universität Freiburg, Freiburg, Germany;Albert-Ludwigs-Universität Freiburg, Freiburg, Germany

  • Venue:
  • Proceedings of the 2010 ACM SIGPLAN workshop on Partial evaluation and program manipulation
  • 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 can be 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.