preparing to flatten byte code structure
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
hyung-hwan 2023-12-06 17:19:57 +09:00
parent 291a999c2a
commit af3abee6ca
4 changed files with 30 additions and 26 deletions

View File

@ -525,7 +525,7 @@ static int add_literal (hcl_t* hcl, hcl_oop_t obj, hcl_oow_t* index)
newcapa = HCL_ALIGN(capa + 1, HCL_LIT_BUFFER_ALIGN); newcapa = HCL_ALIGN(capa + 1, HCL_LIT_BUFFER_ALIGN);
tmp = hcl_remakengcarray(hcl, (hcl_oop_t)hcl->code.lit.arr, newcapa); tmp = hcl_remakengcarray(hcl, (hcl_oop_t)hcl->code.lit.arr, newcapa);
if (!tmp) return -1; if (HCL_UNLIKELY(!tmp)) return -1;
hcl->code.lit.arr = (hcl_oop_oop_t)tmp; hcl->code.lit.arr = (hcl_oop_oop_t)tmp;
} }

View File

@ -1503,6 +1503,29 @@ typedef enum hcl_compile_flag_t hcl_compile_flag_t;
#define HCL_ERRMSG_CAPA (2048) #define HCL_ERRMSG_CAPA (2048)
struct hcl_code_t
{
struct
{
hcl_oob_t* ptr; /* byte code array */
hcl_oow_t len;
hcl_oow_t capa;
} bc;
struct
{
hcl_oop_oop_t arr; /* literal array - not part of object memory */
hcl_oow_t len;
} lit;
/* the cumulative number of temporaries collected at the global(top-level) level */
hcl_oow_t ngtmprs;
/* array that holds the location of the byte code emitted */
hcl_dbgi_t* dbgi;
};
typedef struct hcl_code_t hcl_code_t;
struct hcl_t struct hcl_t
{ {
hcl_oow_t _instsize; hcl_oow_t _instsize;
@ -1691,27 +1714,8 @@ struct hcl_t
} xbuf; /* buffer to support sprintf */ } xbuf; /* buffer to support sprintf */
} sprintf; } sprintf;
struct
{
struct
{
hcl_oob_t* ptr; /* byte code array */
hcl_oow_t len;
hcl_oow_t capa;
} bc;
struct hcl_code_t code;
{
hcl_oop_oop_t arr; /* literal array - not part of object memory */
hcl_oow_t len;
} lit;
/* the cumulative number of temporaries collected at the global(top-level) level */
hcl_oow_t ngtmprs;
/* array that holds the location of the byte code emitted */
hcl_dbgi_t* dbgi;
} code;
/* == PRINTER to udo stream == */ /* == PRINTER to udo stream == */
struct struct