preparing to flatten byte code structure
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
291a999c2a
commit
af3abee6ca
@ -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);
|
||||
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;
|
||||
}
|
||||
|
@ -4586,8 +4586,8 @@ if (do_throw(hcl, hcl->_nil, fetched_instruction_pointer) <= -1)
|
||||
HCL_ASSERT (hcl, b1 >= 0);
|
||||
|
||||
/* the MAKE_FUNCTION instruction is followed by the long JUMP_FORWARD_X instruction.
|
||||
* i can decode the instruction and get the size of instructions
|
||||
* of the block context */
|
||||
* i can decode the instruction and get the size of instructions
|
||||
* of the block context */
|
||||
HCL_ASSERT (hcl, hcl->active_code[hcl->ip] == HCL_CODE_JUMP_FORWARD_X);
|
||||
joff = hcl->active_code[hcl->ip + 1];
|
||||
#if (HCL_CODE_LONG_PARAM_SIZE == 2)
|
||||
|
44
lib/hcl.h
44
lib/hcl.h
@ -1503,6 +1503,29 @@ typedef enum hcl_compile_flag_t hcl_compile_flag_t;
|
||||
|
||||
#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
|
||||
{
|
||||
hcl_oow_t _instsize;
|
||||
@ -1691,27 +1714,8 @@ struct hcl_t
|
||||
} xbuf; /* buffer to support sprintf */
|
||||
} sprintf;
|
||||
|
||||
struct
|
||||
{
|
||||
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;
|
||||
} code;
|
||||
hcl_code_t code;
|
||||
|
||||
/* == PRINTER to udo stream == */
|
||||
struct
|
||||
|
@ -158,7 +158,7 @@ static hcl_oop_t find_or_make_symbol (hcl_t* hcl, const hcl_ooch_t* ptr, hcl_oow
|
||||
}
|
||||
|
||||
/* create a new symbol since it isn't found in the symbol table */
|
||||
symbol = (hcl_oop_char_t)hcl_alloccharobj (hcl, HCL_BRAND_SYMBOL, ptr, len);
|
||||
symbol = (hcl_oop_char_t)hcl_alloccharobj(hcl, HCL_BRAND_SYMBOL, ptr, len);
|
||||
if (symbol)
|
||||
{
|
||||
HCL_ASSERT (hcl, tally < HCL_SMOOI_MAX);
|
||||
@ -171,10 +171,10 @@ static hcl_oop_t find_or_make_symbol (hcl_t* hcl, const hcl_ooch_t* ptr, hcl_oow
|
||||
|
||||
hcl_oop_t hcl_makesymbol (hcl_t* hcl, const hcl_ooch_t* ptr, hcl_oow_t len)
|
||||
{
|
||||
return find_or_make_symbol (hcl, ptr, len, 1);
|
||||
return find_or_make_symbol(hcl, ptr, len, 1);
|
||||
}
|
||||
|
||||
hcl_oop_t hcl_findsymbol (hcl_t* hcl, const hcl_ooch_t* ptr, hcl_oow_t len)
|
||||
{
|
||||
return find_or_make_symbol (hcl, ptr, len, 0);
|
||||
return find_or_make_symbol(hcl, ptr, len, 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user