asm: improve alignment of on-disk structures

This commit is contained in:
2024-12-10 13:19:21 +00:00
parent 99cbcbaeb4
commit 06e12e4545

View File

@@ -3,53 +3,60 @@
#include <stdint.h> #include <stdint.h>
#define IVY_BIN_MAGIC 0x2E495659u #define IVY_BIN_MAGIC 0x2E495659u
#define IVY_TABLE_IMPORT 0x58494D50u #define IVY_TABLE_IMPORT 0x58494D50u
#define IVY_TABLE_CLASS 0x58434C53u #define IVY_TABLE_CLASS 0x58434C53u
#define IVY_TABLE_LAMBDA 0x4C424441u #define IVY_TABLE_LAMBDA 0x4C424441u
#define IVY_TABLE_MSGH 0x4D534748u #define IVY_TABLE_MSGH 0x4D534748u
#define IVY_TABLE_POOL 0x504F4F4Cu #define IVY_TABLE_POOL 0x504F4F4Cu
#define IVY_TABLE_XDAT 0x53544142u #define IVY_TABLE_XDAT 0x53544142u
#define IVY_CLASS_TABLE_MVAR 0x4D564152u #define IVY_CLASS_TABLE_MVAR 0x4D564152u
#define IVY_CLASS_TABLE_PROP 0x50524F50u #define IVY_CLASS_TABLE_PROP 0x50524F50u
#define IVY_CONSTPOOL_TABLE_NULL 0x00000000u #define IVY_CONSTPOOL_TABLE_NULL 0x00000000u
#define IVY_CONSTPOOL_TABLE_STRING 0x58535452u #define IVY_CONSTPOOL_TABLE_STRING 0x58535452u
#define IVY_CONSTPOOL_TABLE_INT 0x53494E54u #define IVY_CONSTPOOL_TABLE_INT 0x53494E54u
#define IVY_CONSTPOOL_TABLE_UINT 0x55494E54u #define IVY_CONSTPOOL_TABLE_UINT 0x55494E54u
#define IVY_CONSTPOOL_TABLE_ATOM 0x41544F4Du #define IVY_CONSTPOOL_TABLE_ATOM 0x41544F4Du
#define IVY_CONSTPOOL_TABLE_SELECTOR 0x5853454Cu #define IVY_CONSTPOOL_TABLE_SELECTOR 0x5853454Cu
#define IVY_CONSTPOOL_TABLE_IDENT 0x49444E54u #define IVY_CONSTPOOL_TABLE_IDENT 0x49444E54u
#define IVY_BIN_SELECTOR_OBJECT 0x00000001u #define IVY_BIN_SELECTOR_OBJECT 0x00000001u
#define IVY_BIN_SELECTOR_CLASS 0x00000002u #define IVY_BIN_SELECTOR_CLASS 0x00000002u
#define IVY_BIN_NULL_HANDLE ((ivy_bin_data_handle)0)
typedef uint32_t ivy_bin_data_handle;
struct ivy_bin_header { struct ivy_bin_header {
uint32_t h_magic; uint32_t h_magic;
uint16_t h_table_len; uint16_t h_table_len;
uint8_t h_reserved[2];
uint64_t h_table_offset; uint64_t h_table_offset;
}; };
struct ivy_bin_table_entry { struct ivy_bin_table_entry {
uint32_t e_type; uint32_t e_type;
uint64_t e_offset;
uint32_t e_size; uint32_t e_size;
uint64_t e_offset;
}; };
struct ivy_bin_class_table_entry { struct ivy_bin_class_table_entry {
uint32_t e_type; uint32_t e_type;
union { union {
struct { struct {
uint32_t p_ident; ivy_bin_data_handle p_ident;
uint32_t p_get; ivy_bin_data_handle p_get;
uint32_t p_set; ivy_bin_data_handle p_set;
uint32_t p_reserved;
} e_property; } e_property;
struct { struct {
uint32_t m_index; uint32_t m_index;
uint32_t m_ident; ivy_bin_data_handle m_ident;
uint8_t m_reserved[16];
} e_mvar; } e_mvar;
}; };
}; };
@@ -60,18 +67,19 @@ struct ivy_bin_class {
}; };
struct ivy_bin_lambda { struct ivy_bin_lambda {
uint32_t l_ident; ivy_bin_data_handle l_ident;
uint32_t l_instr[]; uint32_t l_instr[];
}; };
struct ivy_bin_msgh { struct ivy_bin_msgh {
uint32_t msg_recipient; ivy_bin_data_handle msg_recipient;
uint32_t msg_selector; ivy_bin_data_handle msg_selector;
uint32_t msg_instr[]; uint32_t msg_instr[];
}; };
struct ivy_bin_constpool_header { struct ivy_bin_constpool_header {
uint32_t c_nr_table_entries; uint32_t c_nr_table_entries;
uint8_t c_reserved[4];
uint64_t c_table_offset; uint64_t c_table_offset;
}; };
@@ -84,25 +92,25 @@ struct ivy_bin_string {
struct ivy_bin_selector { struct ivy_bin_selector {
uint8_t sel_flags; uint8_t sel_flags;
uint8_t sel_nr_args; uint8_t sel_nr_args;
uint8_t sel_reserved[2];
uint32_t sel_hash; uint32_t sel_hash;
uint32_t sel_name; ivy_bin_data_handle sel_name;
uint32_t sel_args[]; ivy_bin_data_handle sel_args[];
}; };
struct ivy_bin_ident { struct ivy_bin_ident {
uint32_t id_hash; uint32_t id_hash;
uint8_t id_nr_parts; uint8_t id_nr_parts;
uint32_t id_parts[]; uint8_t id_reserved[3];
ivy_bin_data_handle id_parts[];
}; };
struct ivy_bin_constpool_table_entry { struct ivy_bin_constpool_table_entry {
uint32_t e_type; uint32_t e_type;
uint32_t e_reserved;
union { union {
uint32_t e_atom; ivy_bin_data_handle e_handle;
uint32_t e_string;
uint32_t e_ident;
uint32_t e_sel;
int64_t e_sint; int64_t e_sint;
uint64_t e_uint; uint64_t e_uint;
}; };