x4e / classfile-rs

JVM classfile parser and writer for Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

classfile-rs

Speedy class file implementation for rust

This is a library for reading, manipulating, and writing class files.

Goals:

  • Simple, abstract AST
  • Stackmap frame generation
  • Resistant to malicious/malformed class files

The AST is designed to be more logical and intuitive to a Java developer than the official bytecode specification.

For example, iconst_0s are represented as ldc(0)s, invokestatic(...)s are represented as invoke(static, ...). Bytecode offsets are also transformed into labels. The constant pool is fully abstracted.

Todos:

  • Stackmap frame generation
  • Class writing (Feel free to contribute on these)

Speed

The library should take <1ms to read an averagely sized class file, but can take longer depending on the amount of control flow within the class (Label reading is not optimal at the moment).

Here is a benchmark: Throughput benchmark

Examples

Reading a class file

About

JVM classfile parser and writer for Rust

License:MIT License


Languages

Language:Rust 99.4%Language:Python 0.4%Language:Java 0.3%