-
Notifications
You must be signed in to change notification settings - Fork 0
Class creation
- Called first
- Emits the Java class file magic number (
0xCAFEBABE). - Sets the class file version to Java 8 (
minor_version = 0,major_version = 52).
-
void fields_start()
Initializes the fields section. Reserves space for thefields_countand starts the counter at0. -
void field_info(uint16_t access_flags, uint16_t name_index, uint16_t descriptor_index)
Adds a field entry with the specified access flags, name, and descriptor index. Increments the counter and starts the attributes section for the field. -
void end_field_info()
Finalizes the attributes for the current field. -
void fields_end()
Finalizes the fields section by patching the total entry count at the reserved location.
-
void methods_start()
Initializes the methods section. Reserves space for themethods_countand starts the counter at0. -
void method_info(uint16_t access_flags, uint16_t name_index, uint16_t descriptor_index)
Adds a method entry with the specified access flags, name, and descriptor index. Increments the counter and starts the attributes section for the method. -
void end_method_info()
Finalizes the attributes for the current method. -
void methods_end()
Finalizes the methods section by patching the total entry count at the reserved location.
-
void bytecode_start()
Initializes the bytecode section. Reserves space for thebytecode_lengthand sets the offset for the bytecode. -
void ldc(1)Loads the first constant onto the stack -
void bytecode_end()
Finalizes the bytecode section by patching thebytecode_lengthat the reserved location.
- Starts a code attribute with the method's name and stack/locals limits.
- Begins bytecode emission with
bytecode_start().
- Ends bytecode emission with
bytecode_end(). - Emits
0for exception table length and attributes count. - Ends the attribute with
attribute_end().
- Called last
- Sets the access flags to the given flag integer.
- References the class and its superclass (
this_classandsuper_class).