removed unneeded code

This commit is contained in:
hyung-hwan 2021-01-03 17:58:57 +00:00
parent 6720640ed7
commit 75ecff7aca
4 changed files with 61 additions and 13 deletions

View File

@ -554,7 +554,7 @@ static HCL_INLINE int _insert_cframe (hcl_t* hcl, hcl_ooi_t index, int opcode, h
newcapa = HCL_ALIGN (hcl->c->cfs.top + 256, 256); /* TODO: adjust this capacity */ newcapa = HCL_ALIGN (hcl->c->cfs.top + 256, 256); /* TODO: adjust this capacity */
tmp = (hcl_cframe_t*)hcl_reallocmem (hcl, hcl->c->cfs.ptr, newcapa * HCL_SIZEOF(hcl_cframe_t)); tmp = (hcl_cframe_t*)hcl_reallocmem (hcl, hcl->c->cfs.ptr, newcapa * HCL_SIZEOF(hcl_cframe_t));
if (!tmp) if (HCL_UNLIKELY(!tmp))
{ {
hcl->c->cfs.top--; hcl->c->cfs.top--;
return -1; return -1;
@ -584,7 +584,7 @@ static int insert_cframe (hcl_t* hcl, hcl_ooi_t index, int opcode, hcl_oop_t ope
return -1; return -1;
} }
return _insert_cframe (hcl, index, opcode, operand); return _insert_cframe(hcl, index, opcode, operand);
} }
static int push_cframe (hcl_t* hcl, int opcode, hcl_oop_t operand) static int push_cframe (hcl_t* hcl, int opcode, hcl_oop_t operand)
@ -595,7 +595,7 @@ static int push_cframe (hcl_t* hcl, int opcode, hcl_oop_t operand)
return -1; return -1;
} }
return _insert_cframe (hcl, hcl->c->cfs.top + 1, opcode, operand); return _insert_cframe(hcl, hcl->c->cfs.top + 1, opcode, operand);
} }
static HCL_INLINE void pop_cframe (hcl_t* hcl) static HCL_INLINE void pop_cframe (hcl_t* hcl)
@ -643,7 +643,7 @@ static int push_subcframe (hcl_t* hcl, int opcode, hcl_oop_t operand)
cf->opcode = opcode; cf->opcode = opcode;
cf->operand = operand; cf->operand = operand;
return push_cframe (hcl, tmp.opcode, tmp.operand); return push_cframe(hcl, tmp.opcode, tmp.operand);
} }
static HCL_INLINE hcl_cframe_t* find_cframe_from_top (hcl_t* hcl, int opcode) static HCL_INLINE hcl_cframe_t* find_cframe_from_top (hcl_t* hcl, int opcode)
@ -1779,7 +1779,7 @@ static int compile_object (hcl_t* hcl)
return 0; return 0;
literal: literal:
if (emit_push_literal (hcl, cf->operand) <= -1) return -1; if (emit_push_literal(hcl, cf->operand) <= -1) return -1;
done: done:
POP_CFRAME (hcl); POP_CFRAME (hcl);

View File

@ -181,6 +181,60 @@ struct hcl_iolink_t
hcl_iolink_t* link; hcl_iolink_t* link;
}; };
typedef enum hcl_concode_t hcl_concode_t;
enum hcl_cnode_type_t
{
HCL_CNODE_CHARLIT,
HCL_CNODE_STRLIT,
HCL_CNODE_NUMLIT,
HCL_CNODE_RADNUMLIT,
HCL_CNODE_FPDECLIT,
HCL_CNODE_SMPTRLIT,
HCL_CNODE_ERRORLIT,
HCL_CNODE_NIL,
HCL_CNODE_TRUE,
HCL_CNODE_FALSE,
HCL_CNODE_AND = 1,
HCL_CNODE_BREAK,
HCL_CNODE_DEFUN,
HCL_CNODE_DO,
HCL_CNODE_ELIF,
HCL_CNODE_ELSE,
HCL_CNODE_IF,
HCL_CNODE_LAMBDA,
HCL_CNODE_OR,
HCL_CNODE_RETURN,
HCL_CNODE_RETURN_FROM_HOME,
HCL_CNODE_SET,
HCL_CNODE_UNTIL,
HCL_CNODE_WHILE,
HCL_CNODE_XLIST = 0, /* () - executable list */
HCL_CNODE_ARRAY, /* [] */
HCL_CNODE_BYTEARRAY, /* #[] */
HCL_CNODE_DIC, /* {} */
HCL_CNODE_QLIST /* #() - data list */
};
typedef enum hcl_cnode_type_t hcl_cnode_type_t;
/* NOTE: hcl_cnode_t used by the built-in compiler is not an OOP object */
struct hcl_cnode_t
{
hcl_cnode_type_t type;
hcl_ioloc_t loc;
union
{
struct
{
hcl_ooch_t* ptr;
hcl_oow_t len;
} strlit;
} u;
};
typedef struct hcl_cnode_t hcl_cnode_t;
/* NOTE: hcl_cframe_t used by the built-in compiler is not an OOP object */ /* NOTE: hcl_cframe_t used by the built-in compiler is not an OOP object */
struct hcl_cframe_t struct hcl_cframe_t
{ {
@ -221,7 +275,6 @@ struct hcl_cframe_t
} lambda; } lambda;
} u; } u;
}; };
typedef struct hcl_cframe_t hcl_cframe_t; typedef struct hcl_cframe_t hcl_cframe_t;
struct hcl_blk_info_t struct hcl_blk_info_t

View File

@ -1675,7 +1675,6 @@ enum hcl_brand_t
HCL_BRAND_DIC, HCL_BRAND_DIC,
HCL_BRAND_FPDEC, /* fixed-point decimal */ HCL_BRAND_FPDEC, /* fixed-point decimal */
HCL_BRAND_CFRAME,/* compiler frame */
HCL_BRAND_PRIM, HCL_BRAND_PRIM,
HCL_BRAND_FUNCTION, HCL_BRAND_FUNCTION,
@ -1691,6 +1690,7 @@ typedef enum hcl_brand_t hcl_brand_t;
enum hcl_syncode_t enum hcl_syncode_t
{ {
/* SYNCODE 0 means it's not a syncode object. so it begins with 1 */ /* SYNCODE 0 means it's not a syncode object. so it begins with 1 */
/* these enumerators can be set in the SYNCODE flags for a symbol */
HCL_SYNCODE_AND = 1, HCL_SYNCODE_AND = 1,
HCL_SYNCODE_BREAK, HCL_SYNCODE_BREAK,
HCL_SYNCODE_DEFUN, HCL_SYNCODE_DEFUN,
@ -1710,7 +1710,7 @@ typedef enum hcl_syncode_t hcl_syncode_t;
enum hcl_concode_t enum hcl_concode_t
{ {
/* these can be set in the SYNCODE flags for cons cells */ /* these can be set in the SYNCODE flags for a cons cell */
HCL_CONCODE_XLIST = 0, /* () - executable list */ HCL_CONCODE_XLIST = 0, /* () - executable list */
HCL_CONCODE_ARRAY, /* [] */ HCL_CONCODE_ARRAY, /* [] */
HCL_CONCODE_BYTEARRAY, /* #[] */ HCL_CONCODE_BYTEARRAY, /* #[] */

View File

@ -84,7 +84,6 @@ enum
WORD_FALSE, WORD_FALSE,
WORD_SET, WORD_SET,
WORD_CFRAME,
WORD_PRIM, WORD_PRIM,
WORD_FUNCTION, WORD_FUNCTION,
@ -655,10 +654,6 @@ next:
break; break;
} }
case HCL_BRAND_CFRAME:
word_index = WORD_CFRAME;
goto print_word;
case HCL_BRAND_PRIM: case HCL_BRAND_PRIM:
word_index = WORD_PRIM; word_index = WORD_PRIM;
goto print_word; goto print_word;