stage1 将数组和聚合类型使用byte offset而不是slot idx
This commit is contained in:
@@ -96,7 +96,7 @@ spl_type_info_t *spl_type_clone(spl_type_info_t *t);
|
||||
typedef struct spl_var_info {
|
||||
char *name;
|
||||
spl_type_info_t *type;
|
||||
int slot; /* stack slot offset from fp */
|
||||
int offset; /* byte offset from fp */
|
||||
int is_const;
|
||||
int depth; /* scope depth */
|
||||
} spl_var_info_t;
|
||||
@@ -161,7 +161,7 @@ typedef struct {
|
||||
/* Current function context */
|
||||
int current_func_idx;
|
||||
spl_type_info_t *current_ret_type;
|
||||
int current_local_slot; /* next free local slot */
|
||||
int current_local_bytes; /* next free local byte offset */
|
||||
const char *current_type_name; /* name of type whose body we're parsing (for method short-name lookup) */
|
||||
|
||||
/* Loop context for break/continue */
|
||||
@@ -245,7 +245,7 @@ void spl_patch_to_here(spl_comp_t *ctx, spl_val_t addr);
|
||||
/* Variable management */
|
||||
int spl_declare_var(spl_comp_t *ctx, const char *name, spl_type_info_t *type, int is_const);
|
||||
spl_var_info_t *spl_lookup_var(spl_comp_t *ctx, const char *name);
|
||||
int spl_get_var_slot(spl_comp_t *ctx, const char *name);
|
||||
int spl_get_var_offset(spl_comp_t *ctx, const char *name);
|
||||
|
||||
/* Function management */
|
||||
int spl_declare_func(spl_comp_t *ctx, const char *name, spl_type_info_t *ret_type, int nparams, int is_extern, int is_pub);
|
||||
|
||||
Reference in New Issue
Block a user