24 lines
446 B
C
24 lines
446 B
C
#include <stddef.h>
|
|
#include <stdint.h>
|
|
|
|
#pragma pack(1)
|
|
|
|
typedef enum {
|
|
ALOAD_0 = 0x2a,
|
|
INVOKESPECIAL = 0xb7,
|
|
RETURN = 0xb1,
|
|
GETSTATIC = 0xb2,
|
|
LDC = 0x12,
|
|
INVOKEVIRTUAL = 0xb6,
|
|
} OPCODE;
|
|
|
|
typedef struct Instruction {
|
|
OPCODE opcode;
|
|
uint8_t* operands;
|
|
struct Instruction* next;
|
|
} Instruction;
|
|
|
|
Instruction* Instruction_parse(uint32_t bytes_length, uint8_t* bytes);
|
|
void Instruction_print_code(Instruction* code);
|
|
|
|
#pragma pack() |