Ka-Pi
A JVM Bytecode Manipulation Framework inspired by ASM.
Ka-Pi, known as coffee pronounced in Min Nan, which has multiple usages and an indispensable place in not only modern society, but also computer science.
Features
Ka-Pi offers several essential modules relates to JVM ecosystem:
asm
node
- Bytecode structure definition module, used by most of other modules.parse
- Bytecode parsing module used to resolve bytecode (or classfile) into structs.generate
(WIP) - Bytecode generation module used to generate bytecode.
Basic usages
Parse class file
use read_class;
use KapiResult;
Implementation Status
asm
- TODO
parse
- Magic Number (0xCAFEBABE)
- Constant Pool
- Utf8
- Integer
- Float
- Long
- Double
- Class
- String
- Fieldref
- Methodref
- InterfaceMethodref
- NameAndType
- MethodHandle
- MethodType
- InvokeDynamic
- Access Flags (Class)
- This Class
- Super Class
- Interfaces
- Field
- Access Flags (Field)
- Name Index
- Descriptor Index
- Attributes (See Class#Attributes)
- Method
- Access Flags (Method)
- Name Index
- Descriptor Index
- Attributes (See Class#Attributes)
- Attributes
- Attribute Info
- Critical for JVM
- ConstantValue
- Code
- StackMapTable
- BootstrapMethods
- NestHost
- NestMembers
- PermittedSubclasses
- Critical for Java SE
- Exceptions
- InnerClasses
- EnclosingMethod
- Synthetic
- Signature
- Record
- SourceFile
- LineNumberTable
- LocalVariableTable
- LocalVariableTypeTable
- Not critical
- SourceDebugExtension
- Deprecated
- RuntimeVisibleAnnotations
- RuntimeInvisibleAnnotations
- RuntimeVisibleParameterAnnotations
- RuntimeInvisibleParameterAnnotations
- RuntimeVisibleTypeAnnotations
- RuntimeInvisibleTypeAnnotations
- AnnotationDefault
- MethodParameters
- Module
- ModulePackages
- ModuleMainClass
- Custom Attribute (Not described in specification)
- Critical for JVM
- Attribute Info
See also
There are other related jvm projects developed by me may help the production of JVM projects along with Ka-Pi:
- frape - A direct interop bridge between Rust and Java reflection library in low communication cost. (No releases yet.)
- jars - A simple jar extraction library.
Author
Kyle Lin (ChAoS-UnItY)
License
Copyright © 2023, Kyle Lin (ChAoS-UnItY). Released under the MIT License.