adding some experimental code

This commit is contained in:
hyung-hwan 2020-09-19 11:55:58 +00:00
parent e8ac460f59
commit e6be071a54
2 changed files with 36 additions and 16 deletions

View File

@ -164,7 +164,7 @@ static int emit_byte_instruction (hcl_t* hcl, hcl_oob_t bc)
/* the context object has the ip field. it should be representable
* in a small integer. for simplicity, limit the total byte code length
* to fit in a small integer. because 'ip' points to the next instruction
* to execute, he upper bound should be (max - 1) so that i stays
* to execute, the upper bound should be (max - 1) so that 'ip' stays
* at the max when incremented */
if (hcl->code.bc.len == HCL_SMOOI_MAX - 1)
{
@ -1264,7 +1264,7 @@ static int compile_while (hcl_t* hcl, hcl_oop_t src, int next_cop)
static int compile_cons_array_expression (hcl_t* hcl, hcl_oop_t obj)
{
/* #[ ] */
/* [ ] */
hcl_ooi_t nargs;
hcl_cframe_t* cf;
@ -1295,7 +1295,7 @@ static int compile_cons_array_expression (hcl_t* hcl, hcl_oop_t obj)
static int compile_cons_bytearray_expression (hcl_t* hcl, hcl_oop_t obj)
{
/* #[ ] */
/* #[ ] - e.g. #[1, 2, 3] or #[ 1 2 3 ] */
hcl_ooi_t nargs;
hcl_cframe_t* cf;
@ -1326,7 +1326,7 @@ static int compile_cons_bytearray_expression (hcl_t* hcl, hcl_oop_t obj)
static int compile_cons_dic_expression (hcl_t* hcl, hcl_oop_t obj)
{
/* #{ } */
/* { } - e.g. {1:2, 3:4,"abc":def, "hwaddr":"00:00:00:01"} or { 1 2 3 4 } */
hcl_ooi_t nargs;
hcl_cframe_t* cf;

View File

@ -2277,6 +2277,26 @@ static int execute (hcl_t* hcl)
HCL_ASSERT (hcl, b1 >= 0);
HCL_ASSERT (hcl, b2 >= b1);
#if 0
/* the MAKE_BLOCK 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 */
{
hcl_oow_t joff;
HCL_ASSERT (hcl, hcl->code.bc.arr->slot[hcl->ip] == HCL_CODE_JUMP_FORWARD_X);
joff = hcl->code.bc.arr->slot[hcl->ip + 1];
#if (HCL_BCODE_LONG_PARAM_SIZE == 2)
joff = (joff << 8) | hcl->code.bc.arr->slot[hcl->ip + 2];
#endif
HCL_DEBUG1(hcl, "**** MAKE BLOCK joff = %zu\n", joff);
}
#endif
/* the block context object created here is used as a base
* object for block context activation. activate_context()
* clones a block context and activates the cloned context.