changed block-local variable access to use XXXX_CTXTEMPVAR instructions.
implemented simple global variable access using XXXX_OBJECT instructions
This commit is contained in:
parent
f33bbfe724
commit
3e0d6630f1
234
stix/lib/comp.c
234
stix/lib/comp.c
@ -32,6 +32,7 @@
|
|||||||
#define CODE_BUFFER_ALIGN 8 /* 256 */
|
#define CODE_BUFFER_ALIGN 8 /* 256 */
|
||||||
#define BALIT_BUFFER_ALIGN 8 /* 256 */
|
#define BALIT_BUFFER_ALIGN 8 /* 256 */
|
||||||
#define ARLIT_BUFFER_ALIGN 8 /* 256 */
|
#define ARLIT_BUFFER_ALIGN 8 /* 256 */
|
||||||
|
#define BLK_TMPRCNT_BUFFER_ALIGN 8
|
||||||
|
|
||||||
/* initial method dictionary size */
|
/* initial method dictionary size */
|
||||||
#define INSTANCE_METHOD_DICTIONARY_SIZE 256 /* TODO: choose the right size */
|
#define INSTANCE_METHOD_DICTIONARY_SIZE 256 /* TODO: choose the right size */
|
||||||
@ -66,9 +67,10 @@ typedef enum var_type_t var_type_t;
|
|||||||
|
|
||||||
struct var_info_t
|
struct var_info_t
|
||||||
{
|
{
|
||||||
var_type_t type;
|
var_type_t type;
|
||||||
stix_ssize_t pos;
|
stix_ssize_t pos; /* not used for VAR_GLOBAL */
|
||||||
stix_oop_class_t cls; /* useful if type is VAR_CLASS. note STIX_NULL indicates the self class. TODO: use it for GLOBAL?? */
|
stix_oop_class_t cls; /* useful if type is VAR_CLASS. note STIX_NULL indicates the self class. */
|
||||||
|
stix_oop_association_t gbl; /* used for VAR_GLOBAL only */
|
||||||
};
|
};
|
||||||
typedef struct var_info_t var_info_t;
|
typedef struct var_info_t var_info_t;
|
||||||
|
|
||||||
@ -1519,14 +1521,14 @@ write_short:
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
write_long:
|
write_long:
|
||||||
#if (STIX_BCODE_LONG_PARAM_SIZE == 2)
|
#if (STIX_BCODE_LONG_PARAM_SIZE == 2)
|
||||||
if (emit_byte_instruction(stix, bc) <= -1 ||
|
if (emit_byte_instruction(stix, bc) <= -1 ||
|
||||||
emit_byte_instruction(stix, param_1 >> 8) <= -1 ||
|
emit_byte_instruction(stix, param_1 >> 8) <= -1 ||
|
||||||
emit_byte_instruction(stix, param_1 & 0xFF) <= -1) return -1;
|
emit_byte_instruction(stix, param_1 & 0xFF) <= -1) return -1;
|
||||||
#else
|
#else
|
||||||
if (emit_byte_instruction(stix, bc) <= -1 ||
|
if (emit_byte_instruction(stix, bc) <= -1 ||
|
||||||
emit_byte_instruction(stix, param_1) <= -1) return -1;
|
emit_byte_instruction(stix, param_1) <= -1) return -1;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1568,17 +1570,17 @@ write_short:
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
write_long:
|
write_long:
|
||||||
#if (STIX_BCODE_LONG_PARAM_SIZE == 2)
|
#if (STIX_BCODE_LONG_PARAM_SIZE == 2)
|
||||||
if (emit_byte_instruction(stix, bc) <= -1 ||
|
if (emit_byte_instruction(stix, bc) <= -1 ||
|
||||||
emit_byte_instruction(stix, param_1 >> 8) <= -1 ||
|
emit_byte_instruction(stix, param_1 >> 8) <= -1 ||
|
||||||
emit_byte_instruction(stix, param_1 & 0xFF) <= -1 ||
|
emit_byte_instruction(stix, param_1 & 0xFF) <= -1 ||
|
||||||
emit_byte_instruction(stix, param_2 >> 8) <= -1 ||
|
emit_byte_instruction(stix, param_2 >> 8) <= -1 ||
|
||||||
emit_byte_instruction(stix, param_2 & 0xFF) <= -1) return -1;
|
emit_byte_instruction(stix, param_2 & 0xFF) <= -1) return -1;
|
||||||
#else
|
#else
|
||||||
if (emit_byte_instruction(stix, bc) <= -1 ||
|
if (emit_byte_instruction(stix, bc) <= -1 ||
|
||||||
emit_byte_instruction(stix, param_1) <= -1 ||
|
emit_byte_instruction(stix, param_1) <= -1 ||
|
||||||
emit_byte_instruction(stix, param_2) return -1;
|
emit_byte_instruction(stix, param_2) <= -1) return -1;
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2268,15 +2270,21 @@ static int get_variable_info (stix_t* stix, const stix_ucs_t* name, const stix_i
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* TODO
|
else
|
||||||
else if (find global variable... )
|
|
||||||
var->type = VAR_GLOBAL;
|
|
||||||
*/
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
/* undeclared identifier */
|
stix_oop_association_t ass;
|
||||||
set_syntax_error (stix, STIX_SYNERR_VARUNDCL, name_loc, name);
|
ass = stix_lookupsysdic (stix, name);
|
||||||
return -1;
|
if (ass)
|
||||||
|
{
|
||||||
|
var->type = VAR_GLOBAL;
|
||||||
|
var->gbl = ass;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* undeclared identifier */
|
||||||
|
set_syntax_error (stix, STIX_SYNERR_VARUNDCL, name_loc, name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2335,6 +2343,26 @@ static int compile_block_temporaries (stix_t* stix)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int store_tmpr_count_for_block (stix_t* stix, stix_size_t tmpr_count)
|
||||||
|
{
|
||||||
|
if (stix->c->mth.blk_depth >= stix->c->mth.blk_tmprcnt_capa)
|
||||||
|
{
|
||||||
|
stix_size_t* tmp;
|
||||||
|
stix_size_t new_capa;
|
||||||
|
|
||||||
|
new_capa = STIX_ALIGN (stix->c->mth.blk_depth + 1, BLK_TMPRCNT_BUFFER_ALIGN);
|
||||||
|
tmp = (stix_size_t*)stix_reallocmem (stix, stix->c->mth.blk_tmprcnt, new_capa * STIX_SIZEOF(*tmp));
|
||||||
|
if (!tmp) return -1;
|
||||||
|
|
||||||
|
stix->c->mth.blk_tmprcnt_capa = new_capa;
|
||||||
|
stix->c->mth.blk_tmprcnt = tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [NOTE] i don't increment blk_depth here */
|
||||||
|
stix->c->mth.blk_tmprcnt[stix->c->mth.blk_depth] = tmpr_count;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int compile_block_expression (stix_t* stix)
|
static int compile_block_expression (stix_t* stix)
|
||||||
{
|
{
|
||||||
stix_size_t jump_inst_pos;
|
stix_size_t jump_inst_pos;
|
||||||
@ -2356,6 +2384,8 @@ static int compile_block_expression (stix_t* stix)
|
|||||||
|
|
||||||
saved_tmprs_len = stix->c->mth.tmprs.len;
|
saved_tmprs_len = stix->c->mth.tmprs.len;
|
||||||
saved_tmpr_count = stix->c->mth.tmpr_count;
|
saved_tmpr_count = stix->c->mth.tmpr_count;
|
||||||
|
STIX_ASSERT (stix->c->mth.blk_depth > 0);
|
||||||
|
STIX_ASSERT (stix->c->mth.blk_tmprcnt[stix->c->mth.blk_depth - 1] == saved_tmpr_count);
|
||||||
|
|
||||||
if (stix->c->tok.type == STIX_IOTOK_COLON)
|
if (stix->c->tok.type == STIX_IOTOK_COLON)
|
||||||
{
|
{
|
||||||
@ -2415,7 +2445,7 @@ static int compile_block_expression (stix_t* stix)
|
|||||||
tmpr_loc = stix->c->tok.loc;
|
tmpr_loc = stix->c->tok.loc;
|
||||||
if (compile_block_temporaries(stix) <= -1) return -1;
|
if (compile_block_temporaries(stix) <= -1) return -1;
|
||||||
|
|
||||||
/* this is a block-local temporary count */
|
/* this is a block-local temporary count including arguments */
|
||||||
block_tmpr_count = stix->c->mth.tmpr_count - saved_tmpr_count;
|
block_tmpr_count = stix->c->mth.tmpr_count - saved_tmpr_count;
|
||||||
if (block_tmpr_count > MAX_CODE_NBLKTMPRS)
|
if (block_tmpr_count > MAX_CODE_NBLKTMPRS)
|
||||||
{
|
{
|
||||||
@ -2423,6 +2453,9 @@ static int compile_block_expression (stix_t* stix)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* store the accumulated number of temporaries for the current block */
|
||||||
|
if (store_tmpr_count_for_block (stix, stix->c->mth.tmpr_count) <= -1) return -1;
|
||||||
|
|
||||||
printf ("\tpush_context nargs %d ntmprs %d\n", (int)block_arg_count, (int)stix->c->mth.tmpr_count /*block_tmpr_count*/);
|
printf ("\tpush_context nargs %d ntmprs %d\n", (int)block_arg_count, (int)stix->c->mth.tmpr_count /*block_tmpr_count*/);
|
||||||
printf ("\tpush smint %d\n", (int)block_arg_count);
|
printf ("\tpush smint %d\n", (int)block_arg_count);
|
||||||
printf ("\tpush smint %d\n", (int)stix->c->mth.tmpr_count /*block_tmpr_count*/);
|
printf ("\tpush smint %d\n", (int)stix->c->mth.tmpr_count /*block_tmpr_count*/);
|
||||||
@ -2435,21 +2468,15 @@ printf ("\tsend_block_copy\n");
|
|||||||
printf ("\tjump\n");
|
printf ("\tjump\n");
|
||||||
/* insert dummy instructions before replacing them with a jump instruction */
|
/* insert dummy instructions before replacing them with a jump instruction */
|
||||||
jump_inst_pos = stix->c->mth.code.len;
|
jump_inst_pos = stix->c->mth.code.len;
|
||||||
#if (STIX_BCODE_LONG_PARAM_SIZE == 2)
|
/* specifying MAX_CODE_JUMP causes emit_single_param_instruction() to
|
||||||
if (emit_byte_instruction(stix, BCODE_JUMP_FORWARD_X) <= -1 ||
|
* produce the long jump instruction (BCODE_JUMP_FORWARD_X) */
|
||||||
emit_byte_instruction(stix, 0) <= -1 ||
|
if (emit_single_param_instruction (stix, BCODE_JUMP_FORWARD_0, MAX_CODE_JUMP) <= -1) return -1;
|
||||||
emit_byte_instruction(stix, 0) <= -1) return -1;
|
|
||||||
#else
|
|
||||||
if (emit_byte_instruction(stix, BCODE_JUMP_FORWARD_X) <= -1 ||
|
|
||||||
emit_byte_instruction(stix, 0) <= -1) return -1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* compile statements inside a block */
|
/* compile statements inside a block */
|
||||||
if (stix->c->tok.type == STIX_IOTOK_RBRACK)
|
if (stix->c->tok.type == STIX_IOTOK_RBRACK)
|
||||||
{
|
{
|
||||||
/* the block is empty */
|
/* the block is empty */
|
||||||
if (emit_byte_instruction (stix, BCODE_PUSH_NIL) <= -1) return -1;
|
if (emit_byte_instruction (stix, BCODE_PUSH_NIL) <= -1) return -1;
|
||||||
GET_TOKEN (stix);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2485,12 +2512,16 @@ printf ("\treturn_from_block\n");
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* note that the jump offset is a signed number */
|
/* note that the jump offset is a signed number */
|
||||||
|
#if (STIX_BCODE_LONG_PARAM_SIZE == 2)
|
||||||
stix->c->mth.code.ptr[jump_inst_pos + 1] = block_code_size >> 8;
|
stix->c->mth.code.ptr[jump_inst_pos + 1] = block_code_size >> 8;
|
||||||
stix->c->mth.code.ptr[jump_inst_pos + 2] = ((stix_int16_t)block_code_size & 0xFF);
|
stix->c->mth.code.ptr[jump_inst_pos + 2] = ((stix_int16_t)block_code_size & 0xFF);
|
||||||
|
#else
|
||||||
|
stix->c->mth.code.ptr[jump_inst_pos + 1] = block_code_size ;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* restore the temporary count */
|
/* restore the temporary count */
|
||||||
stix->c->mth.tmpr_count = saved_tmpr_count;
|
|
||||||
stix->c->mth.tmprs.len = saved_tmprs_len;
|
stix->c->mth.tmprs.len = saved_tmprs_len;
|
||||||
|
stix->c->mth.tmpr_count = saved_tmpr_count;
|
||||||
|
|
||||||
GET_TOKEN (stix);
|
GET_TOKEN (stix);
|
||||||
|
|
||||||
@ -2761,9 +2792,30 @@ static int compile_expression_primary (stix_t* stix, const stix_ucs_t* ident, co
|
|||||||
{
|
{
|
||||||
case VAR_ARGUMENT:
|
case VAR_ARGUMENT:
|
||||||
case VAR_TEMPORARY:
|
case VAR_TEMPORARY:
|
||||||
|
{
|
||||||
|
#if defined(STIX_USE_CTXTEMPVAR)
|
||||||
|
if (stix->c->mth.blk_depth > 0)
|
||||||
|
{
|
||||||
|
stix_size_t i;
|
||||||
|
|
||||||
|
STIX_ASSERT (var.pos < stix->c->mth.blk_tmprcnt[stix->c->mth.blk_depth]);
|
||||||
|
for (i = stix->c->mth.blk_depth; i > 0; i--)
|
||||||
|
{
|
||||||
|
if (var.pos >= stix->c->mth.blk_tmprcnt[i - 1])
|
||||||
|
{
|
||||||
|
printf ("\tpush ctxtempvar %d %d\n", (int)(stix->c->mth.blk_depth - i), (int)(var.pos - stix->c->mth.blk_tmprcnt[i - 1]));
|
||||||
|
if (emit_double_param_instruction(stix, BCODE_PUSH_CTXTEMPVAR_0, stix->c->mth.blk_depth - i, var.pos - stix->c->mth.blk_tmprcnt[i - 1]) <= -1) return -1;
|
||||||
|
goto temporary_done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (emit_single_param_instruction(stix, BCODE_PUSH_TEMPVAR_0, var.pos) <= -1) return -1;
|
if (emit_single_param_instruction(stix, BCODE_PUSH_TEMPVAR_0, var.pos) <= -1) return -1;
|
||||||
printf ("\tpush tempvar %d\n", (int)var.pos);
|
printf ("\tpush tempvar %d\n", (int)var.pos);
|
||||||
|
temporary_done:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case VAR_INSTANCE:
|
case VAR_INSTANCE:
|
||||||
case VAR_CLASSINST:
|
case VAR_CLASSINST:
|
||||||
@ -2778,10 +2830,19 @@ printf ("\tpush objvar %d %d\n", (int)var.pos, (int)index);
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VAR_GLOBAL:
|
case VAR_GLOBAL:
|
||||||
/* TODO: .............................. */
|
/* [NOTE]
|
||||||
printf ("GLOBAL NOT IMPLMENTED.... \n");
|
* the association object pointed to by a system dictionary
|
||||||
stix->errnum = STIX_ENOIMPL;
|
* is stored into the literal frame. so the system dictionary
|
||||||
return -1;
|
* must not migrate the value of the association to a new
|
||||||
|
* association when it rehashes the entire dictionary.
|
||||||
|
* If the association entry is deleted from the dictionary,
|
||||||
|
* the code compiled before the deletion will still access
|
||||||
|
* the deleted association
|
||||||
|
*/
|
||||||
|
if (add_literal(stix, (stix_oop_t)var.gbl, &index) <= -1 ||
|
||||||
|
emit_single_param_instruction(stix, BCODE_PUSH_OBJECT_0, index) <= -1) return -1;
|
||||||
|
printf ("\tpush object %d\n", (int)index);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
stix->errnum = STIX_EINTERN;
|
stix->errnum = STIX_EINTERN;
|
||||||
@ -2899,9 +2960,23 @@ printf ("\tpush int literal\n");
|
|||||||
/* TODO: dynamic array, non constant array #<> or #{} or what is a better bracket? */
|
/* TODO: dynamic array, non constant array #<> or #{} or what is a better bracket? */
|
||||||
|
|
||||||
case STIX_IOTOK_LBRACK: /* [ */
|
case STIX_IOTOK_LBRACK: /* [ */
|
||||||
|
{
|
||||||
|
int n;
|
||||||
|
|
||||||
/*GET_TOKEN (stix);*/
|
/*GET_TOKEN (stix);*/
|
||||||
if (compile_block_expression(stix) <= -1) return -1;
|
if (store_tmpr_count_for_block (stix, stix->c->mth.tmpr_count) <= -1) return -1;
|
||||||
|
stix->c->mth.blk_depth++;
|
||||||
|
/*
|
||||||
|
* stix->c->mth.tmpr_count[0] contains the number of temporaries for a method.
|
||||||
|
* stix->c->mth.tmpr_count[1] contains the number of temporaries for the block plus the containing method.
|
||||||
|
* ...
|
||||||
|
* stix->c->mth.tmpr_count[n] contains the number of temporaries for the block plus all containing method and block.
|
||||||
|
*/
|
||||||
|
n = compile_block_expression(stix);
|
||||||
|
stix->c->mth.blk_depth--;
|
||||||
|
if (n <= -1) return -1;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case STIX_IOTOK_LPAREN:
|
case STIX_IOTOK_LPAREN:
|
||||||
GET_TOKEN (stix);
|
GET_TOKEN (stix);
|
||||||
@ -3084,22 +3159,23 @@ static int compile_message_expression (stix_t* stix, int to_super)
|
|||||||
|
|
||||||
if (stix->c->tok.type == STIX_IOTOK_BINSEL)
|
if (stix->c->tok.type == STIX_IOTOK_BINSEL)
|
||||||
{
|
{
|
||||||
STIX_ASSERT (stix->c->mth.code.len > noop_pos);
|
STIX_ASSERT (stix->c->mth.code.len > noop_pos);
|
||||||
STIX_MEMMOVE (&stix->c->mth.code.ptr[noop_pos], &stix->c->mth.code.ptr[noop_pos + 1], stix->c->mth.code.len - noop_pos - 1);
|
STIX_MEMMOVE (&stix->c->mth.code.ptr[noop_pos], &stix->c->mth.code.ptr[noop_pos + 1], stix->c->mth.code.len - noop_pos - 1);
|
||||||
stix->c->mth.code.len--;
|
stix->c->mth.code.len--;
|
||||||
|
|
||||||
noop_pos = stix->c->mth.code.len;
|
noop_pos = stix->c->mth.code.len;
|
||||||
if (emit_byte_instruction(stix, BCODE_NOOP) <= -1) return -1;
|
if (emit_byte_instruction(stix, BCODE_NOOP) <= -1) return -1;
|
||||||
if (compile_binary_message(stix, to_super) <= -1) return -1;
|
if (compile_binary_message(stix, to_super) <= -1) return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stix->c->tok.type == STIX_IOTOK_KEYWORD)
|
if (stix->c->tok.type == STIX_IOTOK_KEYWORD)
|
||||||
{
|
{
|
||||||
STIX_ASSERT (stix->c->mth.code.len > noop_pos);
|
STIX_ASSERT (stix->c->mth.code.len > noop_pos);
|
||||||
STIX_MEMMOVE (&stix->c->mth.code.ptr[noop_pos], &stix->c->mth.code.ptr[noop_pos + 1], stix->c->mth.code.len - noop_pos - 1);
|
STIX_MEMMOVE (&stix->c->mth.code.ptr[noop_pos], &stix->c->mth.code.ptr[noop_pos + 1], stix->c->mth.code.len - noop_pos - 1);
|
||||||
stix->c->mth.code.len--;
|
stix->c->mth.code.len--;
|
||||||
|
|
||||||
noop_pos = stix->c->mth.code.len;
|
noop_pos = stix->c->mth.code.len;
|
||||||
if (emit_byte_instruction(stix, BCODE_NOOP) <= -1) return -1;
|
if (emit_byte_instruction(stix, BCODE_NOOP) <= -1) return -1;
|
||||||
if (compile_keyword_message(stix, to_super) <= -1) return -1;
|
if (compile_keyword_message(stix, to_super) <= -1) return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3111,13 +3187,12 @@ static int compile_message_expression (stix_t* stix, int to_super)
|
|||||||
if (compile_binary_message(stix, to_super) <= -1) return -1;
|
if (compile_binary_message(stix, to_super) <= -1) return -1;
|
||||||
if (stix->c->tok.type == STIX_IOTOK_KEYWORD)
|
if (stix->c->tok.type == STIX_IOTOK_KEYWORD)
|
||||||
{
|
{
|
||||||
STIX_ASSERT (stix->c->mth.code.len > noop_pos);
|
STIX_ASSERT (stix->c->mth.code.len > noop_pos);
|
||||||
STIX_MEMMOVE (&stix->c->mth.code.ptr[noop_pos], &stix->c->mth.code.ptr[noop_pos + 1], stix->c->mth.code.len - noop_pos - 1);
|
STIX_MEMMOVE (&stix->c->mth.code.ptr[noop_pos], &stix->c->mth.code.ptr[noop_pos + 1], stix->c->mth.code.len - noop_pos - 1);
|
||||||
stix->c->mth.code.len--;
|
stix->c->mth.code.len--;
|
||||||
|
|
||||||
noop_pos = stix->c->mth.code.len;
|
|
||||||
if (emit_byte_instruction(stix, BCODE_NOOP) <= -1) return -1;
|
|
||||||
|
|
||||||
|
noop_pos = stix->c->mth.code.len;
|
||||||
|
if (emit_byte_instruction(stix, BCODE_NOOP) <= -1) return -1;
|
||||||
if (compile_keyword_message(stix, to_super) <= -1) return -1;
|
if (compile_keyword_message(stix, to_super) <= -1) return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3234,11 +3309,32 @@ printf ("\n");
|
|||||||
goto oops;
|
goto oops;
|
||||||
|
|
||||||
case VAR_TEMPORARY:
|
case VAR_TEMPORARY:
|
||||||
|
{
|
||||||
|
#if defined(STIX_USE_CTXTEMPVAR)
|
||||||
|
if (stix->c->mth.blk_depth > 0)
|
||||||
|
{
|
||||||
|
stix_size_t i;
|
||||||
|
|
||||||
|
STIX_ASSERT (var.pos < stix->c->mth.blk_tmprcnt[stix->c->mth.blk_depth]);
|
||||||
|
for (i = stix->c->mth.blk_depth; i > 0; i--)
|
||||||
|
{
|
||||||
|
if (var.pos >= stix->c->mth.blk_tmprcnt[i - 1])
|
||||||
|
{
|
||||||
|
printf ("\t%s_into_ctxtempvar %d %d\n", (pop? "pop":"store"), (int)(stix->c->mth.blk_depth - i), (int)(var.pos - stix->c->mth.blk_tmprcnt[i - 1]));
|
||||||
|
if (emit_double_param_instruction(stix, (pop? BCODE_POP_INTO_CTXTEMPVAR_0: BCODE_STORE_INTO_CTXTEMPVAR_0), stix->c->mth.blk_depth - i, var.pos - stix->c->mth.blk_tmprcnt[i - 1]) <= -1) return -1;
|
||||||
|
goto temporary_done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
printf ("\t%s_into_tempvar %d\n", (pop? "pop":"store"), (int)var.pos);
|
printf ("\t%s_into_tempvar %d\n", (pop? "pop":"store"), (int)var.pos);
|
||||||
if (emit_single_param_instruction (stix, (pop? BCODE_POP_INTO_TEMPVAR_0: BCODE_STORE_INTO_TEMPVAR_0), var.pos) <= -1) goto oops;
|
if (emit_single_param_instruction (stix, (pop? BCODE_POP_INTO_TEMPVAR_0: BCODE_STORE_INTO_TEMPVAR_0), var.pos) <= -1) goto oops;
|
||||||
|
|
||||||
|
temporary_done:
|
||||||
ret = pop;
|
ret = pop;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case VAR_INSTANCE:
|
case VAR_INSTANCE:
|
||||||
case VAR_CLASSINST:
|
case VAR_CLASSINST:
|
||||||
@ -3256,9 +3352,11 @@ printf ("\t%s_into_objvar %d %d\n", (pop? "pop":"store"), (int)var.pos, (int)ind
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VAR_GLOBAL:
|
case VAR_GLOBAL:
|
||||||
/* TODO: .............................. */
|
if (add_literal(stix, (stix_oop_t)var.gbl, &index) <= -1 ||
|
||||||
printf ("\tSTORE_INTO_GLOBL NOT IMPLEMENTED YET\n");
|
emit_single_param_instruction(stix, (pop? BCODE_POP_INTO_OBJECT_0: BCODE_STORE_INTO_OBJECT_0), index) <= -1) return -1;
|
||||||
goto oops;
|
printf ("\t%s_into_object %d\n", (pop? "pop":"store"), (int)index);
|
||||||
|
ret = pop;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
stix->errnum = STIX_EINTERN;
|
stix->errnum = STIX_EINTERN;
|
||||||
@ -3495,8 +3593,9 @@ static int compile_method_definition (stix_t* stix)
|
|||||||
stix->c->mth.literal_count = 0;
|
stix->c->mth.literal_count = 0;
|
||||||
stix->c->mth.balit_count = 0;
|
stix->c->mth.balit_count = 0;
|
||||||
stix->c->mth.arlit_count = 0;
|
stix->c->mth.arlit_count = 0;
|
||||||
stix->c->mth.code.len = 0;
|
|
||||||
stix->c->mth.prim_no = -1;
|
stix->c->mth.prim_no = -1;
|
||||||
|
stix->c->mth.blk_depth = 0;
|
||||||
|
stix->c->mth.code.len = 0;
|
||||||
|
|
||||||
if (stix->c->tok.type == STIX_IOTOK_LPAREN)
|
if (stix->c->tok.type == STIX_IOTOK_LPAREN)
|
||||||
{
|
{
|
||||||
@ -4079,6 +4178,7 @@ static void fini_compiler (stix_t* stix)
|
|||||||
if (stix->c->mth.literals) stix_freemem (stix, stix->c->mth.literals);
|
if (stix->c->mth.literals) stix_freemem (stix, stix->c->mth.literals);
|
||||||
if (stix->c->mth.balit) stix_freemem (stix, stix->c->mth.balit);
|
if (stix->c->mth.balit) stix_freemem (stix, stix->c->mth.balit);
|
||||||
if (stix->c->mth.arlit) stix_freemem (stix, stix->c->mth.arlit);
|
if (stix->c->mth.arlit) stix_freemem (stix, stix->c->mth.arlit);
|
||||||
|
if (stix->c->mth.blk_tmprcnt) stix_freemem (stix, stix->c->mth.blk_tmprcnt);
|
||||||
|
|
||||||
stix_freemem (stix, stix->c);
|
stix_freemem (stix, stix->c);
|
||||||
stix->c = STIX_NULL;
|
stix->c = STIX_NULL;
|
||||||
|
107
stix/lib/exec.c
107
stix/lib/exec.c
@ -831,8 +831,6 @@ int stix_execute (stix_t* stix)
|
|||||||
{
|
{
|
||||||
stix_byte_t bcode;
|
stix_byte_t bcode;
|
||||||
stix_ooi_t b1, b2, bx;
|
stix_ooi_t b1, b2, bx;
|
||||||
stix_oop_context_t ctx;
|
|
||||||
stix_oop_oop_t t1;
|
|
||||||
stix_oop_t return_value;
|
stix_oop_t return_value;
|
||||||
|
|
||||||
stix_size_t inst_counter;
|
stix_size_t inst_counter;
|
||||||
@ -948,6 +946,41 @@ printf ("POP_INTO_INSTVAR %d\n", (int)b1);
|
|||||||
case BCODE_POP_INTO_TEMPVAR_5:
|
case BCODE_POP_INTO_TEMPVAR_5:
|
||||||
case BCODE_POP_INTO_TEMPVAR_6:
|
case BCODE_POP_INTO_TEMPVAR_6:
|
||||||
case BCODE_POP_INTO_TEMPVAR_7:
|
case BCODE_POP_INTO_TEMPVAR_7:
|
||||||
|
{
|
||||||
|
#if defined(STIX_USE_CTXTEMPVAR)
|
||||||
|
b1 = bcode & 0x7; /* low 3 bits */
|
||||||
|
|
||||||
|
handle_tempvar:
|
||||||
|
if ((bcode >> 4) & 1)
|
||||||
|
{
|
||||||
|
/* push - bit 4 on*/
|
||||||
|
printf ("PUSH_TEMPVAR %d - ", (int)b1);
|
||||||
|
|
||||||
|
ACTIVE_STACK_PUSH (stix, ACTIVE_STACK_GET(stix, b1]));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* store or pop - bit 5 off */
|
||||||
|
ACTIVE_STACK_SET(stix, b1, ACTIVE_STACK_GETTOP(stix));
|
||||||
|
|
||||||
|
if ((bcode >> 3) & 1)
|
||||||
|
{
|
||||||
|
/* pop - bit 3 on */
|
||||||
|
ACTIVE_STACK_POP (stix);
|
||||||
|
printf ("POP_INTO_TEMPVAR %d - ", (int)b1);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf ("STORE_INTO_TEMPVAR %d - ", (int)b1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print_object (stix, ctx->slot[bx]);
|
||||||
|
printf ("\n");
|
||||||
|
#else
|
||||||
|
stix_oop_context_t ctx;
|
||||||
|
|
||||||
b1 = bcode & 0x7; /* low 3 bits */
|
b1 = bcode & 0x7; /* low 3 bits */
|
||||||
handle_tempvar:
|
handle_tempvar:
|
||||||
if (stix->active_context->home != stix->_nil)
|
if (stix->active_context->home != stix->_nil)
|
||||||
@ -1012,7 +1045,9 @@ printf ("STORE_INTO_TEMPVAR %d - ", (int)b1);
|
|||||||
|
|
||||||
print_object (stix, ctx->slot[bx]);
|
print_object (stix, ctx->slot[bx]);
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------- */
|
/* ------------------------------------------------- */
|
||||||
case BCODE_PUSH_LITERAL_X:
|
case BCODE_PUSH_LITERAL_X:
|
||||||
@ -1054,24 +1089,38 @@ printf ("\n");
|
|||||||
case BCODE_POP_INTO_OBJECT_1:
|
case BCODE_POP_INTO_OBJECT_1:
|
||||||
case BCODE_POP_INTO_OBJECT_2:
|
case BCODE_POP_INTO_OBJECT_2:
|
||||||
case BCODE_POP_INTO_OBJECT_3:
|
case BCODE_POP_INTO_OBJECT_3:
|
||||||
|
{
|
||||||
|
stix_oop_association_t ass;
|
||||||
|
|
||||||
b1 = bcode & 0x3; /* low 2 bits */
|
b1 = bcode & 0x3; /* low 2 bits */
|
||||||
handle_object:
|
handle_object:
|
||||||
printf ("<<<<<<<<<<<<<< XXXXX_OBJECT NOT IMPLEMENTED YET >>>>>>>>>>>> \n");
|
ass = (stix_oop_association_t)stix->active_method->slot[b1];
|
||||||
stix->errnum = STIX_ENOIMPL;
|
STIX_ASSERT (STIX_CLASSOF(stix, ass) == stix->_association);
|
||||||
return -1;
|
|
||||||
if ((bcode >> 3) & 1)
|
if ((bcode >> 3) & 1)
|
||||||
{
|
{
|
||||||
/* store or pop */
|
/* store or pop */
|
||||||
|
ass->value = ACTIVE_STACK_GETTOP(stix);
|
||||||
|
|
||||||
if ((bcode >> 2) & 1)
|
if ((bcode >> 2) & 1)
|
||||||
{
|
{
|
||||||
/* pop */
|
/* pop */
|
||||||
|
ACTIVE_STACK_POP (stix);
|
||||||
|
printf ("POP_INTO_OBJECT %d - ", (int)b1);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf ("STORE_INTO_OBJECT %d - ", (int)b1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* push */
|
/* push */
|
||||||
|
ACTIVE_STACK_PUSH (stix, ass->value);
|
||||||
|
printf ("PUSH_OBJECT %d - ", (int)b1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------- */
|
/* -------------------------------------------------------- */
|
||||||
|
|
||||||
@ -1143,25 +1192,50 @@ return -1;
|
|||||||
case BCODE_POP_INTO_CTXTEMPVAR_1:
|
case BCODE_POP_INTO_CTXTEMPVAR_1:
|
||||||
case BCODE_POP_INTO_CTXTEMPVAR_2:
|
case BCODE_POP_INTO_CTXTEMPVAR_2:
|
||||||
case BCODE_POP_INTO_CTXTEMPVAR_3:
|
case BCODE_POP_INTO_CTXTEMPVAR_3:
|
||||||
|
{
|
||||||
|
stix_ooi_t i;
|
||||||
|
stix_oop_context_t ctx;
|
||||||
|
|
||||||
b1 = bcode & 0x3; /* low 2 bits */
|
b1 = bcode & 0x3; /* low 2 bits */
|
||||||
FETCH_BYTE_CODE_TO (stix, b2);
|
FETCH_BYTE_CODE_TO (stix, b2);
|
||||||
|
|
||||||
handle_ctxtempvar:
|
handle_ctxtempvar:
|
||||||
printf ("<<<<<<<<<<<<<< XXXXX_CTXTEMPVAR NOT IMPLEMENTED YET >>>>>>>>>>>> \n");
|
|
||||||
stix->errnum = STIX_ENOIMPL;
|
ctx = stix->active_context;
|
||||||
return -1;
|
STIX_ASSERT ((stix_oop_t)ctx != stix->_nil);
|
||||||
|
for (i = 0; i < b1; i++)
|
||||||
|
{
|
||||||
|
ctx = (stix_oop_context_t)ctx->home;
|
||||||
|
}
|
||||||
|
|
||||||
if ((bcode >> 3) & 1)
|
if ((bcode >> 3) & 1)
|
||||||
{
|
{
|
||||||
/* store or pop */
|
/* store or pop */
|
||||||
|
ctx->slot[b2] = ACTIVE_STACK_GETTOP(stix);
|
||||||
|
|
||||||
if ((bcode >> 2) & 1)
|
if ((bcode >> 2) & 1)
|
||||||
{
|
{
|
||||||
/* pop */
|
/* pop */
|
||||||
|
ACTIVE_STACK_POP (stix);
|
||||||
|
printf ("POP_INTO_CTXTEMPVAR %d %d - ", (int)b1, (int)b2);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf ("STORE_INTO_CTXTEMPVAR %d %d - ", (int)b1, (int)b2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* push */
|
/* push */
|
||||||
|
ACTIVE_STACK_PUSH (stix, ctx->slot[b2]);
|
||||||
|
|
||||||
|
printf ("PUSH_CTXTEMPVAR %d %d - ", (int)b1, (int)b2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print_object (stix, ctx->slot[b2]);
|
||||||
|
printf ("\n");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
/* -------------------------------------------------------- */
|
/* -------------------------------------------------------- */
|
||||||
|
|
||||||
case BCODE_PUSH_OBJVAR_X:
|
case BCODE_PUSH_OBJVAR_X:
|
||||||
@ -1183,22 +1257,24 @@ return -1;
|
|||||||
case BCODE_POP_INTO_OBJVAR_1:
|
case BCODE_POP_INTO_OBJVAR_1:
|
||||||
case BCODE_POP_INTO_OBJVAR_2:
|
case BCODE_POP_INTO_OBJVAR_2:
|
||||||
case BCODE_POP_INTO_OBJVAR_3:
|
case BCODE_POP_INTO_OBJVAR_3:
|
||||||
|
{
|
||||||
|
stix_oop_oop_t t;
|
||||||
|
|
||||||
/* b1 -> variable index to the object indicated by b2.
|
/* b1 -> variable index to the object indicated by b2.
|
||||||
* b2 -> object index stored in the literal frame. */
|
* b2 -> object index stored in the literal frame. */
|
||||||
b1 = bcode & 0x3; /* low 2 bits */
|
b1 = bcode & 0x3; /* low 2 bits */
|
||||||
FETCH_BYTE_CODE_TO (stix, b2);
|
FETCH_BYTE_CODE_TO (stix, b2);
|
||||||
|
|
||||||
handle_objvar:
|
handle_objvar:
|
||||||
printf ("XXXXXXXXXXXXXXXXXXXXX [%d]\n", (int)b2);
|
t = (stix_oop_oop_t)stix->active_method->slot[b2];
|
||||||
t1 = (stix_oop_oop_t)stix->active_method->slot[b2];
|
STIX_ASSERT (STIX_OBJ_GET_FLAGS_TYPE(t) == STIX_OBJ_TYPE_OOP);
|
||||||
STIX_ASSERT (STIX_OBJ_GET_FLAGS_TYPE(t1) == STIX_OBJ_TYPE_OOP);
|
STIX_ASSERT (b1 < STIX_OBJ_GET_SIZE(t));
|
||||||
STIX_ASSERT (b1 < STIX_OBJ_GET_SIZE(t1));
|
|
||||||
|
|
||||||
if ((bcode >> 3) & 1)
|
if ((bcode >> 3) & 1)
|
||||||
{
|
{
|
||||||
/* store or pop */
|
/* store or pop */
|
||||||
|
|
||||||
t1->slot[b1] = ACTIVE_STACK_GETTOP(stix);
|
t->slot[b1] = ACTIVE_STACK_GETTOP(stix);
|
||||||
|
|
||||||
if ((bcode >> 2) & 1)
|
if ((bcode >> 2) & 1)
|
||||||
{
|
{
|
||||||
@ -1215,12 +1291,13 @@ printf ("STORE_INTO_OBJVAR %d %d - ", (int)b1, (int)b2);
|
|||||||
{
|
{
|
||||||
/* push */
|
/* push */
|
||||||
printf ("PUSH_OBJVAR %d %d - ", (int)b1, (int)b2);
|
printf ("PUSH_OBJVAR %d %d - ", (int)b1, (int)b2);
|
||||||
ACTIVE_STACK_PUSH (stix, t1->slot[b1]);
|
ACTIVE_STACK_PUSH (stix, t->slot[b1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
print_object (stix, t1->slot[b1]);
|
print_object (stix, t->slot[b1]);
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------- */
|
/* -------------------------------------------------------- */
|
||||||
case BCODE_SEND_MESSAGE_X:
|
case BCODE_SEND_MESSAGE_X:
|
||||||
|
@ -30,15 +30,20 @@
|
|||||||
#include "stix.h"
|
#include "stix.h"
|
||||||
|
|
||||||
/* you can define this to either 1 or 2 */
|
/* you can define this to either 1 or 2 */
|
||||||
#define STIX_BCODE_LONG_PARAM_SIZE 2
|
#define STIX_BCODE_LONG_PARAM_SIZE 1
|
||||||
|
|
||||||
/* this is useful for debugging. stix_gc() can be called
|
/* this is useful for debugging. stix_gc() can be called
|
||||||
* while stix has not been fully initialized when this is defined*/
|
* while stix has not been fully initialized when this is defined*/
|
||||||
#define STIX_SUPPORT_GC_DURING_IGNITION
|
#define STIX_SUPPORT_GC_DURING_IGNITION
|
||||||
|
|
||||||
|
/* define this to generate CTXTEMVAR instructions */
|
||||||
|
#define STIX_USE_CTXTEMPVAR
|
||||||
|
|
||||||
/* this is for gc debugging */
|
/* this is for gc debugging */
|
||||||
#define STIX_DEBUG_GC_001
|
#define STIX_DEBUG_GC_001
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h> /* TODO: delete these header inclusion lines */
|
#include <stdio.h> /* TODO: delete these header inclusion lines */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -452,6 +457,11 @@ struct stix_compiler_t
|
|||||||
/* primitive number */
|
/* primitive number */
|
||||||
stix_ooi_t prim_no;
|
stix_ooi_t prim_no;
|
||||||
|
|
||||||
|
/* block depth */
|
||||||
|
stix_size_t blk_depth;
|
||||||
|
stix_size_t* blk_tmprcnt;
|
||||||
|
stix_size_t blk_tmprcnt_capa;
|
||||||
|
|
||||||
/* byte code */
|
/* byte code */
|
||||||
stix_code_t code;
|
stix_code_t code;
|
||||||
stix_size_t code_capa;
|
stix_size_t code_capa;
|
||||||
@ -659,41 +669,40 @@ enum stix_bcode_t
|
|||||||
BCODE_JUMP_BY_OFFSET_2 = 0x56,
|
BCODE_JUMP_BY_OFFSET_2 = 0x56,
|
||||||
BCODE_JUMP_BY_OFFSET_3 = 0x57,
|
BCODE_JUMP_BY_OFFSET_3 = 0x57,
|
||||||
|
|
||||||
BCODE_PUSH_CTXTEMPVAR_0 = 0x58,
|
BCODE_STORE_INTO_CTXTEMPVAR_0 = 0x58, /* 88 */
|
||||||
BCODE_PUSH_CTXTEMPVAR_1 = 0x59,
|
BCODE_STORE_INTO_CTXTEMPVAR_1 = 0x59, /* 89 */
|
||||||
BCODE_PUSH_CTXTEMPVAR_2 = 0x5A,
|
BCODE_STORE_INTO_CTXTEMPVAR_2 = 0x5A, /* 90 */
|
||||||
BCODE_PUSH_CTXTEMPVAR_3 = 0x5B,
|
BCODE_STORE_INTO_CTXTEMPVAR_3 = 0x5B, /* 91 */
|
||||||
|
|
||||||
BCODE_STORE_INTO_CTXTEMPVAR_0 = 0x5C,
|
BCODE_POP_INTO_CTXTEMPVAR_0 = 0x5C, /* 92 */
|
||||||
BCODE_STORE_INTO_CTXTEMPVAR_1 = 0x5D,
|
BCODE_POP_INTO_CTXTEMPVAR_1 = 0x5D, /* 93 */
|
||||||
BCODE_STORE_INTO_CTXTEMPVAR_2 = 0x5E,
|
BCODE_POP_INTO_CTXTEMPVAR_2 = 0x5E, /* 94 */
|
||||||
BCODE_STORE_INTO_CTXTEMPVAR_3 = 0x5F,
|
BCODE_POP_INTO_CTXTEMPVAR_3 = 0x5F, /* 95 */
|
||||||
|
|
||||||
BCODE_POP_INTO_CTXTEMPVAR_0 = 0x60,
|
BCODE_PUSH_CTXTEMPVAR_0 = 0x60, /* 96 */
|
||||||
BCODE_POP_INTO_CTXTEMPVAR_1 = 0x61,
|
BCODE_PUSH_CTXTEMPVAR_1 = 0x61, /* 97 */
|
||||||
BCODE_POP_INTO_CTXTEMPVAR_2 = 0x62,
|
BCODE_PUSH_CTXTEMPVAR_2 = 0x62, /* 98 */
|
||||||
BCODE_POP_INTO_CTXTEMPVAR_3 = 0x63,
|
BCODE_PUSH_CTXTEMPVAR_3 = 0x63, /* 99 */
|
||||||
|
|
||||||
BCODE_PUSH_OBJVAR_0 = 0x64,
|
BCODE_PUSH_OBJVAR_0 = 0x64,
|
||||||
BCODE_PUSH_OBJVAR_1 = 0x65,
|
BCODE_PUSH_OBJVAR_1 = 0x65,
|
||||||
BCODE_PUSH_OBJVAR_2 = 0x66,
|
BCODE_PUSH_OBJVAR_2 = 0x66,
|
||||||
BCODE_PUSH_OBJVAR_3 = 0x67,
|
BCODE_PUSH_OBJVAR_3 = 0x67,
|
||||||
|
|
||||||
BCODE_STORE_INTO_OBJVAR_0 = 0x68,
|
BCODE_STORE_INTO_OBJVAR_0 = 0x68,
|
||||||
BCODE_STORE_INTO_OBJVAR_1 = 0x69,
|
BCODE_STORE_INTO_OBJVAR_1 = 0x69,
|
||||||
BCODE_STORE_INTO_OBJVAR_2 = 0x6A,
|
BCODE_STORE_INTO_OBJVAR_2 = 0x6A,
|
||||||
BCODE_STORE_INTO_OBJVAR_3 = 0x6B,
|
BCODE_STORE_INTO_OBJVAR_3 = 0x6B,
|
||||||
|
|
||||||
BCODE_POP_INTO_OBJVAR_0 = 0x6C,
|
BCODE_POP_INTO_OBJVAR_0 = 0x6C,
|
||||||
BCODE_POP_INTO_OBJVAR_1 = 0x6D,
|
BCODE_POP_INTO_OBJVAR_1 = 0x6D,
|
||||||
BCODE_POP_INTO_OBJVAR_2 = 0x6E,
|
BCODE_POP_INTO_OBJVAR_2 = 0x6E,
|
||||||
BCODE_POP_INTO_OBJVAR_3 = 0x6F,
|
BCODE_POP_INTO_OBJVAR_3 = 0x6F,
|
||||||
|
|
||||||
|
BCODE_SEND_MESSAGE_0 = 0x70,
|
||||||
BCODE_SEND_MESSAGE_0 = 0x70,
|
BCODE_SEND_MESSAGE_1 = 0x71,
|
||||||
BCODE_SEND_MESSAGE_1 = 0x71,
|
BCODE_SEND_MESSAGE_2 = 0x72,
|
||||||
BCODE_SEND_MESSAGE_2 = 0x72,
|
BCODE_SEND_MESSAGE_3 = 0x73,
|
||||||
BCODE_SEND_MESSAGE_3 = 0x73,
|
|
||||||
|
|
||||||
BCODE_SEND_MESSAGE_TO_SUPER_0 = 0x74,
|
BCODE_SEND_MESSAGE_TO_SUPER_0 = 0x74,
|
||||||
BCODE_SEND_MESSAGE_TO_SUPER_1 = 0x75,
|
BCODE_SEND_MESSAGE_TO_SUPER_1 = 0x75,
|
||||||
|
@ -320,7 +320,8 @@
|
|||||||
self value ifFalse: [ ^nil "^self" ].
|
self value ifFalse: [ ^nil "^self" ].
|
||||||
aBlock value.
|
aBlock value.
|
||||||
##thisContext pc: pc - 3 sp: sp.
|
##thisContext pc: pc - 3 sp: sp.
|
||||||
thisContext pc: pc + 2 sp: sp.
|
##thisContext pc: pc + 2 sp: sp.
|
||||||
|
thisContext pc: pc + 1 sp: sp.
|
||||||
## this +2 or - 3 above is dependent on the byte code instruction size used for 'store'
|
## this +2 or - 3 above is dependent on the byte code instruction size used for 'store'
|
||||||
## +2 to skip STORE_INTO_TEMP(pc) and POP_STACKTOP.
|
## +2 to skip STORE_INTO_TEMP(pc) and POP_STACKTOP.
|
||||||
## TODO: make it independent of the byte code size
|
## TODO: make it independent of the byte code size
|
||||||
|
Loading…
Reference in New Issue
Block a user