added STIX_EBCFULL, remove unneeded items, changed data type of 'ip' in some functions
This commit is contained in:
parent
cf8957924e
commit
1960efb7e1
@ -122,5 +122,6 @@
|
||||
System logNl: KKK.
|
||||
System logNl: SRX.ABC.JJJ.
|
||||
System logNl: JJJ.
|
||||
System logNl: -200 asString.
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#define CLASS_BUFFER_ALIGN 64
|
||||
#define LITERAL_BUFFER_ALIGN 64
|
||||
#define CODE_BUFFER_ALIGN 64
|
||||
#define CODE_BUFFER_ALIGN 512
|
||||
#define BALIT_BUFFER_ALIGN 64
|
||||
#define ARLIT_BUFFER_ALIGN 64
|
||||
#define BLK_TMPRCNT_BUFFER_ALIGN 32
|
||||
@ -1655,20 +1655,29 @@ static int end_include (stix_t* stix)
|
||||
|
||||
static STIX_INLINE int emit_byte_instruction (stix_t* stix, stix_oob_t code)
|
||||
{
|
||||
stix_oow_t i;
|
||||
/* 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
|
||||
* at the max when incremented */
|
||||
if (stix->c->mth.code.len == STIX_SMOOI_MAX - 1)
|
||||
{
|
||||
stix->errnum = STIX_EBCFULL; /* byte code too big */
|
||||
return -1;
|
||||
}
|
||||
|
||||
i = stix->c->mth.code.len + 1;
|
||||
if (i > stix->c->mth.code_capa)
|
||||
if (stix->c->mth.code.len >= stix->c->mth.code_capa)
|
||||
{
|
||||
stix_oob_t* tmp;
|
||||
stix_oow_t newcapa;
|
||||
|
||||
i = STIX_ALIGN (i, CODE_BUFFER_ALIGN);
|
||||
newcapa = STIX_ALIGN (stix->c->mth.code.len + 1, CODE_BUFFER_ALIGN);
|
||||
|
||||
tmp = stix_reallocmem (stix, stix->c->mth.code.ptr, i * STIX_SIZEOF(*tmp));
|
||||
tmp = stix_reallocmem (stix, stix->c->mth.code.ptr, newcapa * STIX_SIZEOF(*tmp));
|
||||
if (!tmp) return -1;
|
||||
|
||||
stix->c->mth.code.ptr = tmp;
|
||||
stix->c->mth.code_capa = i;
|
||||
stix->c->mth.code_capa = newcapa;
|
||||
}
|
||||
|
||||
stix->c->mth.code.ptr[stix->c->mth.code.len++] = code;
|
||||
|
@ -35,23 +35,23 @@
|
||||
#define LOG_INST_3(stix,fmt,a1,a2,a3) STIX_LOG3(stix, DECODE_LOG_MASK, "\t" fmt "\n", a1, a2, a3)
|
||||
|
||||
#define FETCH_BYTE_CODE(stix) (cdptr[ip++])
|
||||
#define FETCH_BYTE_CODE_TO(stix,v_ooi) (v_ooi = FETCH_BYTE_CODE(stix))
|
||||
#define FETCH_BYTE_CODE_TO(stix,v_oow) (v_oow = FETCH_BYTE_CODE(stix))
|
||||
#if (STIX_BCODE_LONG_PARAM_SIZE == 2)
|
||||
# define FETCH_PARAM_CODE_TO(stix,v_ooi) \
|
||||
# define FETCH_PARAM_CODE_TO(stix,v_oow) \
|
||||
do { \
|
||||
v_ooi = FETCH_BYTE_CODE(stix); \
|
||||
v_ooi = (v_ooi << 8) | FETCH_BYTE_CODE(stix); \
|
||||
v_oow = FETCH_BYTE_CODE(stix); \
|
||||
v_oow = (v_oow << 8) | FETCH_BYTE_CODE(stix); \
|
||||
} while (0)
|
||||
#else
|
||||
# define FETCH_PARAM_CODE_TO(stix,v_ooi) (v_ooi = FETCH_BYTE_CODE(stix))
|
||||
# define FETCH_PARAM_CODE_TO(stix,v_oow) (v_oow = FETCH_BYTE_CODE(stix))
|
||||
#endif
|
||||
|
||||
/* TODO: check if ip shoots beyond the maximum length in fetching code and parameters */
|
||||
int stix_decode (stix_t* stix, stix_oop_method_t mth, const stix_oocs_t* classfqn)
|
||||
{
|
||||
stix_oob_t bcode, * cdptr;
|
||||
stix_oow_t ip = 0, cdlen;
|
||||
stix_ooi_t b1, b2;
|
||||
stix_ooi_t ip = 0, cdlen; /* byte code length is limited by the compiler. so stix_ooi_t is good enough */
|
||||
stix_oow_t b1, b2;
|
||||
|
||||
cdptr = STIX_METHOD_GET_CODE_BYTE(mth);
|
||||
cdlen = STIX_METHOD_GET_CODE_SIZE(mth);
|
||||
@ -61,7 +61,7 @@ int stix_decode (stix_t* stix, stix_oop_method_t mth, const stix_oocs_t* classfq
|
||||
else
|
||||
STIX_LOG2 (stix, DECODE_LOG_MASK, "%O>>%O\n", mth->owner, mth->name);
|
||||
|
||||
/* TODO: check if ip increases beyon bcode when fetching parameters too */
|
||||
/* TODO: check if ip increases beyond bcode when fetching parameters too */
|
||||
while (ip < cdlen)
|
||||
{
|
||||
FETCH_BYTE_CODE_TO(stix, bcode);
|
||||
@ -81,7 +81,7 @@ int stix_decode (stix_t* stix, stix_oop_method_t mth, const stix_oocs_t* classfq
|
||||
case BCODE_PUSH_INSTVAR_7:
|
||||
b1 = bcode & 0x7; /* low 3 bits */
|
||||
push_instvar:
|
||||
LOG_INST_1 (stix, "push_instvar %zd", b1);
|
||||
LOG_INST_1 (stix, "push_instvar %zu", b1);
|
||||
break;
|
||||
|
||||
/* ------------------------------------------------- */
|
||||
@ -99,7 +99,7 @@ int stix_decode (stix_t* stix, stix_oop_method_t mth, const stix_oocs_t* classfq
|
||||
case BCODE_STORE_INTO_INSTVAR_7:
|
||||
b1 = bcode & 0x7; /* low 3 bits */
|
||||
store_instvar:
|
||||
LOG_INST_1 (stix, "store_into_instvar %zd", b1);
|
||||
LOG_INST_1 (stix, "store_into_instvar %zu", b1);
|
||||
break;
|
||||
|
||||
case BCODE_POP_INTO_INSTVAR_X:
|
||||
@ -115,7 +115,7 @@ int stix_decode (stix_t* stix, stix_oop_method_t mth, const stix_oocs_t* classfq
|
||||
case BCODE_POP_INTO_INSTVAR_7:
|
||||
b1 = bcode & 0x7; /* low 3 bits */
|
||||
pop_into_instvar:
|
||||
LOG_INST_1 (stix, "pop_into_instvar %zd", b1);
|
||||
LOG_INST_1 (stix, "pop_into_instvar %zu", b1);
|
||||
break;
|
||||
|
||||
/* ------------------------------------------------- */
|
||||
@ -155,7 +155,7 @@ int stix_decode (stix_t* stix, stix_oop_method_t mth, const stix_oocs_t* classfq
|
||||
if ((bcode >> 4) & 1)
|
||||
{
|
||||
/* push - bit 4 on */
|
||||
LOG_INST_1 (stix, "push_tempvar %zd", b1);
|
||||
LOG_INST_1 (stix, "push_tempvar %zu", b1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -163,11 +163,11 @@ int stix_decode (stix_t* stix, stix_oop_method_t mth, const stix_oocs_t* classfq
|
||||
if ((bcode >> 3) & 1)
|
||||
{
|
||||
/* pop - bit 3 on */
|
||||
LOG_INST_1 (stix, "pop_into_tempvar %zd", b1);
|
||||
LOG_INST_1 (stix, "pop_into_tempvar %zu", b1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INST_1 (stix, "store_into_tempvar %zd", b1);
|
||||
LOG_INST_1 (stix, "store_into_tempvar %zu", b1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -187,7 +187,7 @@ int stix_decode (stix_t* stix, stix_oop_method_t mth, const stix_oocs_t* classfq
|
||||
case BCODE_PUSH_LITERAL_7:
|
||||
b1 = bcode & 0x7; /* low 3 bits */
|
||||
push_literal:
|
||||
LOG_INST_1 (stix, "push_literal @%zd", b1);
|
||||
LOG_INST_1 (stix, "push_literal @%zu", b1);
|
||||
break;
|
||||
|
||||
/* ------------------------------------------------- */
|
||||
@ -215,16 +215,16 @@ int stix_decode (stix_t* stix, stix_oop_method_t mth, const stix_oocs_t* classfq
|
||||
{
|
||||
if ((bcode >> 2) & 1)
|
||||
{
|
||||
LOG_INST_1 (stix, "pop_into_object @%zd", b1);
|
||||
LOG_INST_1 (stix, "pop_into_object @%zu", b1);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INST_1 (stix, "store_into_object @%zd", b1);
|
||||
LOG_INST_1 (stix, "store_into_object @%zu", b1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INST_1 (stix, "push_object @%zd", b1);
|
||||
LOG_INST_1 (stix, "push_object @%zu", b1);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -232,19 +232,19 @@ int stix_decode (stix_t* stix, stix_oop_method_t mth, const stix_oocs_t* classfq
|
||||
|
||||
case BCODE_JUMP_FORWARD_X:
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "jump_forward %zd", b1);
|
||||
LOG_INST_1 (stix, "jump_forward %zu", b1);
|
||||
break;
|
||||
|
||||
case BCODE_JUMP_FORWARD_0:
|
||||
case BCODE_JUMP_FORWARD_1:
|
||||
case BCODE_JUMP_FORWARD_2:
|
||||
case BCODE_JUMP_FORWARD_3:
|
||||
LOG_INST_1 (stix, "jump_forward %zd", (bcode & 0x3)); /* low 2 bits */
|
||||
LOG_INST_1 (stix, "jump_forward %zu", (stix_oow_t)(bcode & 0x3)); /* low 2 bits */
|
||||
break;
|
||||
|
||||
case BCODE_JUMP_BACKWARD_X:
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "jump_backward %zd", b1);
|
||||
LOG_INST_1 (stix, "jump_backward %zu", b1);
|
||||
stix->ip += b1;
|
||||
break;
|
||||
|
||||
@ -252,7 +252,7 @@ int stix_decode (stix_t* stix, stix_oop_method_t mth, const stix_oocs_t* classfq
|
||||
case BCODE_JUMP_BACKWARD_1:
|
||||
case BCODE_JUMP_BACKWARD_2:
|
||||
case BCODE_JUMP_BACKWARD_3:
|
||||
LOG_INST_1 (stix, "jump_backward %zd", (bcode & 0x3)); /* low 2 bits */
|
||||
LOG_INST_1 (stix, "jump_backward %zu", (stix_oow_t)(bcode & 0x3)); /* low 2 bits */
|
||||
break;
|
||||
|
||||
case BCODE_JUMP_IF_TRUE_X:
|
||||
@ -271,12 +271,12 @@ return -1;
|
||||
|
||||
case BCODE_JUMP2_FORWARD:
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "jump2_forward %zd", b1);
|
||||
LOG_INST_1 (stix, "jump2_forward %zu", b1);
|
||||
break;
|
||||
|
||||
case BCODE_JUMP2_BACKWARD:
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "jump2_backward %zd", b1);
|
||||
LOG_INST_1 (stix, "jump2_backward %zu", b1);
|
||||
break;
|
||||
|
||||
/* -------------------------------------------------------- */
|
||||
@ -309,17 +309,17 @@ return -1;
|
||||
|
||||
if ((bcode >> 2) & 1)
|
||||
{
|
||||
LOG_INST_2 (stix, "pop_into_ctxtempvar %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "pop_into_ctxtempvar %zu %zu", b1, b2);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INST_2 (stix, "store_into_ctxtempvar %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "store_into_ctxtempvar %zu %zu", b1, b2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* push */
|
||||
LOG_INST_2 (stix, "push_ctxtempvar %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "push_ctxtempvar %zu %zu", b1, b2);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -355,16 +355,16 @@ return -1;
|
||||
/* store or pop */
|
||||
if ((bcode >> 2) & 1)
|
||||
{
|
||||
LOG_INST_2 (stix, "pop_into_objvar %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "pop_into_objvar %zu %zu", b1, b2);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INST_2 (stix, "store_into_objvar %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "store_into_objvar %zu %zu", b1, b2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INST_2 (stix, "push_objvar %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "push_objvar %zu %zu", b1, b2);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -390,7 +390,7 @@ return -1;
|
||||
FETCH_BYTE_CODE_TO (stix, b2);
|
||||
|
||||
handle_send_message:
|
||||
LOG_INST_3 (stix, "send_message%hs %zd @%zd", (((bcode >> 2) & 1)? "_to_super": ""), b1, b2);
|
||||
LOG_INST_3 (stix, "send_message%hs %zu @%zu", (((bcode >> 2) & 1)? "_to_super": ""), b1, b2);
|
||||
break;
|
||||
|
||||
/* -------------------------------------------------------- */
|
||||
@ -437,17 +437,17 @@ return -1;
|
||||
|
||||
case BCODE_PUSH_INTLIT:
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "push_intlit %zd", b1);
|
||||
LOG_INST_1 (stix, "push_intlit %zu", b1);
|
||||
break;
|
||||
|
||||
case BCODE_PUSH_NEGINTLIT:
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "push_negintlit %zd", -b1);
|
||||
LOG_INST_1 (stix, "push_negintlit %zu", b1);
|
||||
break;
|
||||
|
||||
case BCODE_PUSH_CHARLIT:
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "push_charlit %zd", b1);
|
||||
LOG_INST_1 (stix, "push_charlit %zu", b1);
|
||||
break;
|
||||
/* -------------------------------------------------------- */
|
||||
|
||||
@ -477,12 +477,11 @@ return -1;
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
FETCH_PARAM_CODE_TO (stix, b2);
|
||||
|
||||
LOG_INST_2 (stix, "make_block %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "make_block %zu %zu", b1, b2);
|
||||
|
||||
STIX_ASSERT (b1 >= 0);
|
||||
STIX_ASSERT (b2 >= b1);
|
||||
break;
|
||||
|
||||
|
||||
case BCODE_SEND_BLOCK_COPY:
|
||||
LOG_INST_0 (stix, "send_block_copy");
|
||||
@ -504,7 +503,7 @@ return -1;
|
||||
/* print literal frame contents */
|
||||
for (ip = 0; ip < STIX_OBJ_GET_SIZE(mth) - STIX_METHOD_NAMED_INSTVARS; ip++)
|
||||
{
|
||||
LOG_INST_2 (stix, " @%-3lu %O", (unsigned long int)ip, mth->slot[ip]);
|
||||
LOG_INST_2 (stix, " @%-3zd %O", ip, mth->slot[ip]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -290,15 +290,10 @@ static stix_oop_process_t make_process (stix_t* stix, stix_oop_context_t c)
|
||||
proc->current_context = c;
|
||||
proc->sp = STIX_SMOOI_TO_OOP(-1);
|
||||
|
||||
#if 0
|
||||
proc->eb_top = stix->_nil;
|
||||
proc->eb_count = STIX_SMOOI_TO_OOP(-1);
|
||||
#endif
|
||||
|
||||
STIX_ASSERT ((stix_oop_t)c->sender == stix->_nil);
|
||||
|
||||
#if defined(STIX_DEBUG_VM_PROCESSOR)
|
||||
STIX_LOG2 (stix, STIX_LOG_IC | STIX_LOG_DEBUG, "Processor - made process %O of size %zd\n", proc, STIX_OBJ_GET_SIZE(proc));
|
||||
STIX_LOG2 (stix, STIX_LOG_IC | STIX_LOG_DEBUG, "Processor - made process %O of size %zu\n", proc, STIX_OBJ_GET_SIZE(proc));
|
||||
#endif
|
||||
return proc;
|
||||
}
|
||||
@ -1723,7 +1718,7 @@ static int __block_value (stix_t* stix, stix_oop_context_t rcv_blkctx, stix_ooi_
|
||||
/* copy the arguments to the stack */
|
||||
for (i = 0; i < nargs; i++)
|
||||
{
|
||||
blkctx->slot[i] = STIX_STACK_GET(stix, stix->sp - nargs + i + 1);
|
||||
blkctx->slot[i] = STIX_STACK_GETARG(stix, nargs, i);
|
||||
}
|
||||
}
|
||||
STIX_STACK_POPS (stix, nargs + 1); /* pop arguments and receiver */
|
||||
@ -3146,7 +3141,7 @@ static int send_private_message (stix_t* stix, const stix_ooch_t* nameptr, stix_
|
||||
int stix_execute (stix_t* stix)
|
||||
{
|
||||
stix_oob_t bcode;
|
||||
stix_ooi_t b1, b2;
|
||||
stix_oow_t b1, b2;
|
||||
stix_oop_t return_value;
|
||||
int unwind_protect;
|
||||
stix_oop_context_t unwind_start;
|
||||
@ -3283,7 +3278,7 @@ if (there is semaphore awaited.... )
|
||||
case BCODE_PUSH_INSTVAR_7:
|
||||
b1 = bcode & 0x7; /* low 3 bits */
|
||||
push_instvar:
|
||||
LOG_INST_1 (stix, "push_instvar %zd", b1);
|
||||
LOG_INST_1 (stix, "push_instvar %zu", b1);
|
||||
STIX_ASSERT (STIX_OBJ_GET_FLAGS_TYPE(stix->active_context->origin->receiver_or_source) == STIX_OBJ_TYPE_OOP);
|
||||
STIX_STACK_PUSH (stix, ((stix_oop_oop_t)stix->active_context->origin->receiver_or_source)->slot[b1]);
|
||||
break;
|
||||
@ -3303,7 +3298,7 @@ if (there is semaphore awaited.... )
|
||||
case BCODE_STORE_INTO_INSTVAR_7:
|
||||
b1 = bcode & 0x7; /* low 3 bits */
|
||||
store_instvar:
|
||||
LOG_INST_1 (stix, "store_into_instvar %zd", b1);
|
||||
LOG_INST_1 (stix, "store_into_instvar %zu", b1);
|
||||
STIX_ASSERT (STIX_OBJ_GET_FLAGS_TYPE(stix->active_context->receiver_or_source) == STIX_OBJ_TYPE_OOP);
|
||||
((stix_oop_oop_t)stix->active_context->origin->receiver_or_source)->slot[b1] = STIX_STACK_GETTOP(stix);
|
||||
break;
|
||||
@ -3322,7 +3317,7 @@ if (there is semaphore awaited.... )
|
||||
case BCODE_POP_INTO_INSTVAR_7:
|
||||
b1 = bcode & 0x7; /* low 3 bits */
|
||||
pop_into_instvar:
|
||||
LOG_INST_1 (stix, "pop_into_instvar %zd", b1);
|
||||
LOG_INST_1 (stix, "pop_into_instvar %zu", b1);
|
||||
STIX_ASSERT (STIX_OBJ_GET_FLAGS_TYPE(stix->active_context->receiver_or_source) == STIX_OBJ_TYPE_OOP);
|
||||
((stix_oop_oop_t)stix->active_context->origin->receiver_or_source)->slot[b1] = STIX_STACK_GETTOP(stix);
|
||||
STIX_STACK_POP (stix);
|
||||
@ -3421,7 +3416,7 @@ if (there is semaphore awaited.... )
|
||||
if ((bcode >> 4) & 1)
|
||||
{
|
||||
/* push - bit 4 on */
|
||||
LOG_INST_1 (stix, "push_tempvar %zd", b1);
|
||||
LOG_INST_1 (stix, "push_tempvar %zu", b1);
|
||||
STIX_STACK_PUSH (stix, ctx->slot[bx]);
|
||||
}
|
||||
else
|
||||
@ -3432,12 +3427,12 @@ if (there is semaphore awaited.... )
|
||||
if ((bcode >> 3) & 1)
|
||||
{
|
||||
/* pop - bit 3 on */
|
||||
LOG_INST_1 (stix, "pop_into_tempvar %zd", b1);
|
||||
LOG_INST_1 (stix, "pop_into_tempvar %zu", b1);
|
||||
STIX_STACK_POP (stix);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INST_1 (stix, "store_into_tempvar %zd", b1);
|
||||
LOG_INST_1 (stix, "store_into_tempvar %zu", b1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3459,7 +3454,7 @@ if (there is semaphore awaited.... )
|
||||
case BCODE_PUSH_LITERAL_7:
|
||||
b1 = bcode & 0x7; /* low 3 bits */
|
||||
push_literal:
|
||||
LOG_INST_1 (stix, "push_literal @%zd", b1);
|
||||
LOG_INST_1 (stix, "push_literal @%zu", b1);
|
||||
STIX_STACK_PUSH (stix, stix->active_method->slot[b1]);
|
||||
break;
|
||||
|
||||
@ -3498,18 +3493,18 @@ if (there is semaphore awaited.... )
|
||||
if ((bcode >> 2) & 1)
|
||||
{
|
||||
/* pop */
|
||||
LOG_INST_1 (stix, "pop_into_object @%zd", b1);
|
||||
LOG_INST_1 (stix, "pop_into_object @%zu", b1);
|
||||
STIX_STACK_POP (stix);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INST_1 (stix, "store_into_object @%zd", b1);
|
||||
LOG_INST_1 (stix, "store_into_object @%zu", b1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* push */
|
||||
LOG_INST_1 (stix, "push_object @%zd", b1);
|
||||
LOG_INST_1 (stix, "push_object @%zu", b1);
|
||||
STIX_STACK_PUSH (stix, ass->value);
|
||||
}
|
||||
break;
|
||||
@ -3519,7 +3514,7 @@ if (there is semaphore awaited.... )
|
||||
|
||||
case BCODE_JUMP_FORWARD_X:
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "jump_forward %zd", b1);
|
||||
LOG_INST_1 (stix, "jump_forward %zu", b1);
|
||||
stix->ip += b1;
|
||||
break;
|
||||
|
||||
@ -3527,13 +3522,13 @@ if (there is semaphore awaited.... )
|
||||
case BCODE_JUMP_FORWARD_1:
|
||||
case BCODE_JUMP_FORWARD_2:
|
||||
case BCODE_JUMP_FORWARD_3:
|
||||
LOG_INST_1 (stix, "jump_forward %zd", (bcode & 0x3));
|
||||
LOG_INST_1 (stix, "jump_forward %zu", (stix_oow_t)(bcode & 0x3));
|
||||
stix->ip += (bcode & 0x3); /* low 2 bits */
|
||||
break;
|
||||
|
||||
case BCODE_JUMP_BACKWARD_X:
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "jump_backward %zd", b1);
|
||||
LOG_INST_1 (stix, "jump_backward %zu", b1);
|
||||
stix->ip += b1;
|
||||
break;
|
||||
|
||||
@ -3541,7 +3536,7 @@ if (there is semaphore awaited.... )
|
||||
case BCODE_JUMP_BACKWARD_1:
|
||||
case BCODE_JUMP_BACKWARD_2:
|
||||
case BCODE_JUMP_BACKWARD_3:
|
||||
LOG_INST_1 (stix, "jump_backward %zd", (bcode & 0x3));
|
||||
LOG_INST_1 (stix, "jump_backward %zu", (stix_oow_t)(bcode & 0x3));
|
||||
stix->ip -= (bcode & 0x3); /* low 2 bits */
|
||||
break;
|
||||
|
||||
@ -3561,13 +3556,13 @@ return -1;
|
||||
|
||||
case BCODE_JUMP2_FORWARD:
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "jump2_forward %zd", b1);
|
||||
LOG_INST_1 (stix, "jump2_forward %zu", b1);
|
||||
stix->ip += MAX_CODE_JUMP + b1;
|
||||
break;
|
||||
|
||||
case BCODE_JUMP2_BACKWARD:
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "jump2_backward %zd", b1);
|
||||
LOG_INST_1 (stix, "jump2_backward %zu", b1);
|
||||
stix->ip -= MAX_CODE_JUMP + b1;
|
||||
break;
|
||||
|
||||
@ -3616,18 +3611,18 @@ return -1;
|
||||
{
|
||||
/* pop */
|
||||
STIX_STACK_POP (stix);
|
||||
LOG_INST_2 (stix, "pop_into_ctxtempvar %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "pop_into_ctxtempvar %zu %zu", b1, b2);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INST_2 (stix, "store_into_ctxtempvar %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "store_into_ctxtempvar %zu %zu", b1, b2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* push */
|
||||
STIX_STACK_PUSH (stix, ctx->slot[b2]);
|
||||
LOG_INST_2 (stix, "push_ctxtempvar %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "push_ctxtempvar %zu %zu", b1, b2);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -3676,17 +3671,17 @@ return -1;
|
||||
{
|
||||
/* pop */
|
||||
STIX_STACK_POP (stix);
|
||||
LOG_INST_2 (stix, "pop_into_objvar %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "pop_into_objvar %zu %zu", b1, b2);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_INST_2 (stix, "store_into_objvar %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "store_into_objvar %zu %zu", b1, b2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* push */
|
||||
LOG_INST_2 (stix, "push_objvar %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "push_objvar %zu %zu", b1, b2);
|
||||
STIX_STACK_PUSH (stix, t->slot[b1]);
|
||||
}
|
||||
break;
|
||||
@ -3719,7 +3714,7 @@ return -1;
|
||||
/* get the selector from the literal frame */
|
||||
selector = (stix_oop_char_t)stix->active_method->slot[b2];
|
||||
|
||||
LOG_INST_3 (stix, "send_message%hs %zd @%zd", (((bcode >> 2) & 1)? "_to_super": ""), b1, b2);
|
||||
LOG_INST_3 (stix, "send_message%hs %zu @%zu", (((bcode >> 2) & 1)? "_to_super": ""), b1, b2);
|
||||
|
||||
if (send_message (stix, selector, ((bcode >> 2) & 1), b1) <= -1) goto oops;
|
||||
break; /* CMD_SEND_MESSAGE */
|
||||
@ -3779,19 +3774,23 @@ return -1;
|
||||
|
||||
case BCODE_PUSH_INTLIT:
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "push_intlit %zd", b1);
|
||||
LOG_INST_1 (stix, "push_intlit %zu", b1);
|
||||
STIX_STACK_PUSH (stix, STIX_SMOOI_TO_OOP(b1));
|
||||
break;
|
||||
|
||||
case BCODE_PUSH_NEGINTLIT:
|
||||
{
|
||||
stix_ooi_t num;
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "push_negintlit %zd", -b1);
|
||||
STIX_STACK_PUSH (stix, STIX_SMOOI_TO_OOP(-b1));
|
||||
num = b1;
|
||||
LOG_INST_1 (stix, "push_negintlit %zu", b1);
|
||||
STIX_STACK_PUSH (stix, STIX_SMOOI_TO_OOP(-num));
|
||||
break;
|
||||
}
|
||||
|
||||
case BCODE_PUSH_CHARLIT:
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
LOG_INST_1 (stix, "push_charlit %zd", b1);
|
||||
LOG_INST_1 (stix, "push_charlit %zu", b1);
|
||||
STIX_STACK_PUSH (stix, STIX_CHAR_TO_OOP(b1));
|
||||
break;
|
||||
/* -------------------------------------------------------- */
|
||||
@ -4049,7 +4048,7 @@ return -1;
|
||||
FETCH_PARAM_CODE_TO (stix, b1);
|
||||
FETCH_PARAM_CODE_TO (stix, b2);
|
||||
|
||||
LOG_INST_2 (stix, "make_block %zd %zd", b1, b2);
|
||||
LOG_INST_2 (stix, "make_block %zu %zu", b1, b2);
|
||||
|
||||
STIX_ASSERT (b1 >= 0);
|
||||
STIX_ASSERT (b2 >= b1);
|
||||
@ -4192,7 +4191,7 @@ return -1;
|
||||
default:
|
||||
STIX_LOG1 (stix, STIX_LOG_IC | STIX_LOG_FATAL, "Fatal error - unknown byte code 0x%zx\n", bcode);
|
||||
stix->errnum = STIX_EINTERN;
|
||||
break;
|
||||
goto oops;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -432,7 +432,7 @@ typedef struct stix_synerr_t stix_synerr_t;
|
||||
struct stix_code_t
|
||||
{
|
||||
stix_uint8_t* ptr;
|
||||
stix_oow_t len;
|
||||
stix_oow_t len;
|
||||
};
|
||||
typedef struct stix_code_t stix_code_t;
|
||||
|
||||
|
@ -56,6 +56,7 @@ enum stix_errnum_t
|
||||
STIX_EMSGSND, /**< message sending error. even doesNotUnderstand: is not found */
|
||||
STIX_ERANGE, /**< range error. overflow and underflow */
|
||||
STIX_ENOENT, /**< no matching entry */
|
||||
STIX_EBCFULL, /**< byte-code full */
|
||||
STIX_EDFULL, /**< dictionary full */
|
||||
STIX_EPFULL, /**< processor full */
|
||||
STIX_ESHFULL, /**< semaphore heap full */
|
||||
@ -607,10 +608,6 @@ struct stix_process_t
|
||||
|
||||
stix_oop_semaphore_t sem;
|
||||
|
||||
#if 0
|
||||
stix_oop_context_t eb_top; /* top ensure block */
|
||||
stix_oop_t eb_count; /* SmallInteger */
|
||||
#endif
|
||||
/* == variable indexed part == */
|
||||
stix_oop_t slot[1]; /* process stack */
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user