touching up code for ongoing gc enhancement

This commit is contained in:
hyunghwan.chung 2018-12-08 15:35:26 +00:00
parent a7fc55efac
commit 033c34f9b2
10 changed files with 131 additions and 120 deletions

View File

@ -358,12 +358,12 @@ static MOO_INLINE moo_oop_t make_bigint_with_oow (moo_t* moo, moo_oow_t w)
{
#if (MOO_LIW_BITS == MOO_OOW_BITS)
MOO_ASSERT (moo, MOO_SIZEOF(moo_oow_t) == MOO_SIZEOF(moo_liw_t));
return moo_instantiate (moo, moo->_large_positive_integer, &w, 1);
return moo_instantiate(moo, moo->_large_positive_integer, &w, 1);
#elif (MOO_LIW_BITS == MOO_OOHW_BITS)
moo_liw_t hw[2];
hw[0] = w /*& MOO_LBMASK(moo_oow_t,MOO_LIW_BITS)*/;
hw[1] = w >> MOO_LIW_BITS;
return moo_instantiate (moo, moo->_large_positive_integer, &hw, (hw[1] > 0? 2: 1));
return moo_instantiate(moo, moo->_large_positive_integer, &hw, (hw[1] > 0? 2: 1));
#else
# error UNSUPPORTED LIW BIT SIZE
#endif
@ -378,7 +378,7 @@ static MOO_INLINE moo_oop_t make_bigint_with_ooi (moo_t* moo, moo_ooi_t i)
if (i >= 0)
{
w = i;
return moo_instantiate (moo, moo->_large_positive_integer, &w, 1);
return moo_instantiate(moo, moo->_large_positive_integer, &w, 1);
}
else
{
@ -387,7 +387,7 @@ static MOO_INLINE moo_oop_t make_bigint_with_ooi (moo_t* moo, moo_ooi_t i)
* cannot be held in moo_ooi_t. */
MOO_ASSERT (moo, i > MOO_TYPE_MIN(moo_ooi_t));
w = -i;
return moo_instantiate (moo, moo->_large_negative_integer, &w, 1);
return moo_instantiate(moo, moo->_large_negative_integer, &w, 1);
}
#elif (MOO_LIW_BITS == MOO_OOHW_BITS)
moo_liw_t hw[2];
@ -398,7 +398,7 @@ static MOO_INLINE moo_oop_t make_bigint_with_ooi (moo_t* moo, moo_ooi_t i)
w = i;
hw[0] = w /*& MOO_LBMASK(moo_oow_t,MOO_LIW_BITS)*/;
hw[1] = w >> MOO_LIW_BITS;
return moo_instantiate (moo, moo->_large_positive_integer, &hw, (hw[1] > 0? 2: 1));
return moo_instantiate(moo, moo->_large_positive_integer, &hw, (hw[1] > 0? 2: 1));
}
else
{
@ -406,7 +406,7 @@ static MOO_INLINE moo_oop_t make_bigint_with_ooi (moo_t* moo, moo_ooi_t i)
w = -i;
hw[0] = w /*& MOO_LBMASK(moo_oow_t,MOO_LIW_BITS)*/;
hw[1] = w >> MOO_LIW_BITS;
return moo_instantiate (moo, moo->_large_negative_integer, &hw, (hw[1] > 0? 2: 1));
return moo_instantiate(moo, moo->_large_negative_integer, &hw, (hw[1] > 0? 2: 1));
}
#else
# error UNSUPPORTED LIW BIT SIZE
@ -424,13 +424,13 @@ static MOO_INLINE moo_oop_t make_bloated_bigint_with_ooi (moo_t* moo, moo_ooi_t
if (i >= 0)
{
w = i;
z = moo_instantiate (moo, moo->_large_positive_integer, MOO_NULL, 1 + extra);
z = moo_instantiate(moo, moo->_large_positive_integer, MOO_NULL, 1 + extra);
}
else
{
MOO_ASSERT (moo, i > MOO_TYPE_MIN(moo_ooi_t));
w = -i;
z = moo_instantiate (moo, moo->_large_negative_integer, MOO_NULL, 1 + extra);
z = moo_instantiate(moo, moo->_large_negative_integer, MOO_NULL, 1 + extra);
}
if (!z) return MOO_NULL;
@ -448,7 +448,7 @@ static MOO_INLINE moo_oop_t make_bloated_bigint_with_ooi (moo_t* moo, moo_ooi_t
w = i;
hw[0] = w /*& MOO_LBMASK(moo_oow_t,MOO_LIW_BITS)*/;
hw[1] = w >> MOO_LIW_BITS;
z = moo_instantiate (moo, moo->_large_positive_integer, MOO_NULL, (hw[1] > 0? 2: 1) + extra);
z = moo_instantiate(moo, moo->_large_positive_integer, MOO_NULL, (hw[1] > 0? 2: 1) + extra);
}
else
{
@ -456,7 +456,7 @@ static MOO_INLINE moo_oop_t make_bloated_bigint_with_ooi (moo_t* moo, moo_ooi_t
w = -i;
hw[0] = w /*& MOO_LBMASK(moo_oow_t,MOO_LIW_BITS)*/;
hw[1] = w >> MOO_LIW_BITS;
z = moo_instantiate (moo, moo->_large_negative_integer, MOO_NULL, (hw[1] > 0? 2: 1) + extra);
z = moo_instantiate(moo, moo->_large_negative_integer, MOO_NULL, (hw[1] > 0? 2: 1) + extra);
}
if (!z) return MOO_NULL;
@ -487,7 +487,7 @@ static MOO_INLINE moo_oop_t make_bigint_with_intmax (moo_t* moo, moo_intmax_t v)
}
while (ui > 0);
return moo_instantiate (moo, ((v >= 0)? moo->_large_positive_integer: moo->_large_negative_integer), buf, len);
return moo_instantiate(moo, ((v >= 0)? moo->_large_positive_integer: moo->_large_negative_integer), buf, len);
}
moo_oop_t moo_oowtoint (moo_t* moo, moo_oow_t w)
@ -512,7 +512,7 @@ moo_oop_t moo_ooitoint (moo_t* moo, moo_ooi_t i)
}
else
{
return make_bigint_with_ooi (moo, i);
return make_bigint_with_ooi(moo, i);
}
}
@ -532,7 +532,7 @@ static MOO_INLINE moo_oop_t expand_bigint (moo_t* moo, moo_oop_t oop, moo_oow_t
}
moo_pushtmp (moo, &oop);
z = moo_instantiate (moo, MOO_OBJ_GET_CLASS(oop), MOO_NULL, count + inc);
z = moo_instantiate(moo, MOO_OBJ_GET_CLASS(oop), MOO_NULL, count + inc);
moo_poptmp (moo);
if (!z) return MOO_NULL;
@ -553,7 +553,7 @@ static MOO_INLINE moo_oop_t _clone_bigint (moo_t* moo, moo_oop_t oop, moo_oow_t
if (count <= 0) count = MOO_OBJ_GET_SIZE(oop);
moo_pushtmp (moo, &oop);
z = moo_instantiate (moo, _class, MOO_NULL, count);
z = moo_instantiate(moo, _class, MOO_NULL, count);
moo_poptmp (moo);
if (!z) return MOO_NULL;
@ -712,11 +712,11 @@ static MOO_INLINE int is_less (moo_t* moo, moo_oop_t x, moo_oop_t y)
if (IS_PBIGINT(moo, x))
{
return is_less_unsigned (x, y);
return is_less_unsigned(x, y);
}
else
{
return is_less_unsigned (y, x);
return is_less_unsigned(y, x);
}
}
@ -736,7 +736,7 @@ static MOO_INLINE int is_greater_unsigned_array (const moo_liw_t* x, moo_oow_t x
static MOO_INLINE int is_greater_unsigned (moo_oop_t x, moo_oop_t y)
{
return is_greater_unsigned_array (
return is_greater_unsigned_array(
((moo_oop_liword_t)x)->slot, MOO_OBJ_GET_SIZE(x),
((moo_oop_liword_t)y)->slot, MOO_OBJ_GET_SIZE(y));
}
@ -750,11 +750,11 @@ static MOO_INLINE int is_greater (moo_t* moo, moo_oop_t x, moo_oop_t y)
if (IS_PBIGINT(moo, x))
{
return is_greater_unsigned (x, y);
return is_greater_unsigned(x, y);
}
else
{
return is_greater_unsigned (y, x);
return is_greater_unsigned(y, x);
}
}
@ -1505,7 +1505,7 @@ static moo_oop_t add_unsigned_integers (moo_t* moo, moo_oop_t x, moo_oop_t y)
moo_pushtmp (moo, &x);
moo_pushtmp (moo, &y);
z = moo_instantiate (moo, MOO_OBJ_GET_CLASS(x), MOO_NULL, zs);
z = moo_instantiate(moo, MOO_OBJ_GET_CLASS(x), MOO_NULL, zs);
moo_poptmps (moo, 2);
if (!z) return MOO_NULL;
@ -1526,7 +1526,7 @@ static moo_oop_t subtract_unsigned_integers (moo_t* moo, moo_oop_t x, moo_oop_t
moo_pushtmp (moo, &x);
moo_pushtmp (moo, &y);
z = moo_instantiate (moo, moo->_large_positive_integer, MOO_NULL, MOO_OBJ_GET_SIZE(x));
z = moo_instantiate(moo, moo->_large_positive_integer, MOO_NULL, MOO_OBJ_GET_SIZE(x));
moo_poptmps (moo, 2);
if (!z) return MOO_NULL;
@ -1553,7 +1553,7 @@ static moo_oop_t multiply_unsigned_integers (moo_t* moo, moo_oop_t x, moo_oop_t
moo_pushtmp (moo, &x);
moo_pushtmp (moo, &y);
z = moo_instantiate (moo, moo->_large_positive_integer, MOO_NULL, xs + ys);
z = moo_instantiate(moo, moo->_large_positive_integer, MOO_NULL, xs + ys);
moo_poptmps (moo, 2);
if (!z) return MOO_NULL;
@ -1587,7 +1587,7 @@ static moo_oop_t divide_unsigned_integers (moo_t* moo, moo_oop_t x, moo_oop_t y,
MOO_ASSERT (moo, !is_less_unsigned (x, y));
moo_pushtmp (moo, &x);
moo_pushtmp (moo, &y);
qq = moo_instantiate (moo, moo->_large_positive_integer, MOO_NULL, MOO_OBJ_GET_SIZE(x));
qq = moo_instantiate(moo, moo->_large_positive_integer, MOO_NULL, MOO_OBJ_GET_SIZE(x));
if (!qq)
{
moo_poptmps (moo, 2);
@ -1595,7 +1595,7 @@ static moo_oop_t divide_unsigned_integers (moo_t* moo, moo_oop_t x, moo_oop_t y,
}
moo_pushtmp (moo, &qq);
rr = moo_instantiate (moo, moo->_large_positive_integer, MOO_NULL, MOO_OBJ_GET_SIZE(x));
rr = moo_instantiate(moo, moo->_large_positive_integer, MOO_NULL, MOO_OBJ_GET_SIZE(x));
moo_poptmps (moo, 3);
if (!rr) return MOO_NULL;
@ -2437,7 +2437,7 @@ moo_oop_t moo_bitandints (moo_t* moo, moo_oop_t x, moo_oop_t y)
moo_pushtmp (moo, &x);
moo_pushtmp (moo, &y);
z = moo_instantiate (moo, moo->_large_positive_integer, MOO_NULL, zalloc);
z = moo_instantiate(moo, moo->_large_positive_integer, MOO_NULL, zalloc);
moo_poptmps (moo, 2);
if (!z) return MOO_NULL;
@ -2657,7 +2657,7 @@ moo_oop_t moo_bitorints (moo_t* moo, moo_oop_t x, moo_oop_t y)
moo_pushtmp (moo, &x);
moo_pushtmp (moo, &y);
z = moo_instantiate (moo, moo->_large_positive_integer, MOO_NULL, zalloc);
z = moo_instantiate(moo, moo->_large_positive_integer, MOO_NULL, zalloc);
moo_poptmps (moo, 2);
if (!z) return MOO_NULL;
@ -2875,7 +2875,7 @@ moo_oop_t moo_bitxorints (moo_t* moo, moo_oop_t x, moo_oop_t y)
moo_pushtmp (moo, &x);
moo_pushtmp (moo, &y);
z = moo_instantiate (moo, moo->_large_positive_integer, MOO_NULL, zalloc);
z = moo_instantiate(moo, moo->_large_positive_integer, MOO_NULL, zalloc);
moo_poptmps (moo, 2);
if (!z) return MOO_NULL;
@ -3033,7 +3033,7 @@ moo_oop_t moo_bitinvint (moo_t* moo, moo_oop_t x)
}
moo_pushtmp (moo, &x);
z = moo_instantiate (moo, moo->_large_positive_integer, MOO_NULL, zalloc);
z = moo_instantiate(moo, moo->_large_positive_integer, MOO_NULL, zalloc);
moo_poptmp (moo);
if (!z) return MOO_NULL;
@ -3105,7 +3105,7 @@ static MOO_INLINE moo_oop_t rshift_negative_bigint (moo_t* moo, moo_oop_t x, moo
moo_pushtmp (moo, &x);
/* +1 for the second inversion below */
z = moo_instantiate (moo, moo->_large_negative_integer, MOO_NULL, xs + 1);
z = moo_instantiate(moo, moo->_large_negative_integer, MOO_NULL, xs + 1);
moo_poptmp (moo);
if (!z) return MOO_NULL;
@ -3796,7 +3796,7 @@ moo_oop_t moo_strtoint (moo_t* moo, const moo_ooch_t* str, moo_oow_t len, int ra
# error UNSUPPORTED LIW BIT SIZE
#endif
res = moo_instantiate (moo, (sign < 0? moo->_large_negative_integer: moo->_large_positive_integer), hwp, hwlen);
res = moo_instantiate(moo, (sign < 0? moo->_large_negative_integer: moo->_large_positive_integer), hwp, hwlen);
if (hwp && hw != hwp) moo_freemem (moo, hwp);
return res;

View File

@ -79,7 +79,7 @@ static moo_oop_oop_t expand_bucket (moo_t* moo, moo_oop_oop_t oldbuc)
index = moo_hashoochars(key->slot, MOO_OBJ_GET_SIZE(key)) % newsz;
while (newbuc->slot[index] != moo->_nil) index = (index + 1) % newsz;
MOO_STORE_OOP_TO_ARRAY (moo, newbuc, index, (moo_oop_t)ass); /* newbuc->slot[index] = (moo_oop_t)ass; */
MOO_STORE_OOP (moo, &newbuc->slot[index], (moo_oop_t)ass); /* newbuc->slot[index] = (moo_oop_t)ass; */
}
}
@ -114,10 +114,10 @@ static moo_oop_association_t find_or_upsert (moo_t* moo, moo_oop_dic_t dic, moo_
if (MOO_OBJ_GET_CLASS(key) == MOO_OBJ_GET_CLASS(ass->key) &&
MOO_OBJ_GET_SIZE(key) == MOO_OBJ_GET_SIZE(ass->key) &&
moo_equal_oochars (key->slot, ((moo_oop_char_t)ass->key)->slot, MOO_OBJ_GET_SIZE(key)))
moo_equal_oochars(key->slot, ((moo_oop_char_t)ass->key)->slot, MOO_OBJ_GET_SIZE(key)))
{
/* the value of MOO_NULL indicates no insertion or update. */
if (value) ass->value = value; /* update */
if (value) MOO_STORE_OOP (moo, &ass->value, value); /*ass->value = value;*/ /* update */
return ass;
}
@ -163,7 +163,7 @@ static moo_oop_association_t find_or_upsert (moo_t* moo, moo_oop_dic_t dic, moo_
* make sure that it has at least one free slot left
* after having added a new symbol. this is to help
* traversal end at a _nil slot if no entry is found. */
bucket = expand_bucket (moo, dic->bucket);
bucket = expand_bucket(moo, dic->bucket);
if (!bucket) goto oops;
dic->bucket = bucket;
@ -180,14 +180,14 @@ static moo_oop_association_t find_or_upsert (moo_t* moo, moo_oop_dic_t dic, moo_
ass = (moo_oop_association_t)moo_instantiate(moo, moo->_association, MOO_NULL, 0);
if (!ass) goto oops;
ass->key = (moo_oop_t)key;
ass->value = value;
MOO_STORE_OOP (moo, &ass->key, (moo_oop_t)key); /*ass->key = (moo_oop_t)key; */
MOO_STORE_OOP (moo, &ass->value, value); /*ass->value = value;*/
/* the current tally must be less than the maximum value. otherwise,
* it overflows after increment below */
MOO_ASSERT (moo, tally < MOO_SMOOI_MAX);
dic->tally = MOO_SMOOI_TO_OOP(tally + 1);
MOO_STORE_OOP_TO_ARRAY (moo, dic->bucket, index, (moo_oop_t)ass); /*dic->bucket->slot[index] = (moo_oop_t)ass;*/
dic->tally = MOO_SMOOI_TO_OOP(tally + 1); /* no need to use MOO_STORE_OOP as the value is not a pointer object */
MOO_STORE_OOP (moo, &dic->bucket->slot[index], (moo_oop_t)ass); /*dic->bucket->slot[index] = (moo_oop_t)ass;*/
moo_poptmps (moo, tmp_count);
return ass;
@ -322,12 +322,12 @@ found:
if ((y > x && (z <= x || z > y)) ||
(y < x && (z <= x && z > y)))
{
MOO_STORE_OOP_TO_ARRAY (moo, dic->bucket, x, dic->bucket->slot[y]); /*dic->bucket->slot[x] = dic->bucket->slot[y];*/
MOO_STORE_OOP (moo, &dic->bucket->slot[x], dic->bucket->slot[y]); /*dic->bucket->slot[x] = dic->bucket->slot[y];*/
x = y;
}
}
MOO_STORE_OOP_TO_ARRAY (moo, dic->bucket, x, moo->_nil); /*dic->bucket->slot[x] = moo->_nil;*/
MOO_STORE_OOP (moo, &dic->bucket->slot[x], moo->_nil); /*dic->bucket->slot[x] = moo->_nil;*/
tally--;
dic->tally = MOO_SMOOI_TO_OOP(tally);

View File

@ -324,7 +324,7 @@ static moo_oop_process_t make_process (moo_t* moo, moo_oop_context_t c)
if (moo->proc_map_free_first <= -1 && prepare_to_alloc_pid(moo) <= -1) return MOO_NULL;
moo_pushtmp (moo, (moo_oop_t*)&c);
proc = (moo_oop_process_t)moo_instantiate (moo, moo->_process, MOO_NULL, moo->option.dfl_procstk_size);
proc = (moo_oop_process_t)moo_instantiate(moo, moo->_process, MOO_NULL, moo->option.dfl_procstk_size);
moo_poptmp (moo);
if (!proc) return MOO_NULL;
@ -1525,7 +1525,7 @@ static MOO_INLINE int activate_new_method (moo_t* moo, moo_oop_method_t mth, moo
else actual_ntmprs = ntmprs;
moo_pushtmp (moo, (moo_oop_t*)&mth);
ctx = (moo_oop_context_t)moo_instantiate (moo, moo->_method_context, MOO_NULL, actual_ntmprs);
ctx = (moo_oop_context_t)moo_instantiate(moo, moo->_method_context, MOO_NULL, actual_ntmprs);
moo_poptmp (moo);
if (!ctx) return -1;
@ -1584,14 +1584,14 @@ static MOO_INLINE int activate_new_method (moo_t* moo, moo_oop_method_t mth, moo
for (i = actual_nargs, j = ntmprs + (actual_nargs - nargs); i > nargs; i--)
{
/* place variadic arguments after local temporaries */
ctx->slot[--j] = MOO_STACK_GETTOP (moo);
ctx->slot[--j] = MOO_STACK_GETTOP(moo);
MOO_STACK_POP (moo);
}
MOO_ASSERT (moo, i == nargs);
while (i > 0)
{
/* place normal argument before local temporaries */
ctx->slot[--i] = MOO_STACK_GETTOP (moo);
ctx->slot[--i] = MOO_STACK_GETTOP(moo);
MOO_STACK_POP (moo);
}
}
@ -1812,7 +1812,7 @@ TODO: overcome this problem - accept parameters....
#endif
/* create a fake initial context. */
ctx = (moo_oop_context_t)moo_instantiate (moo, moo->_method_context, MOO_NULL, MOO_OOP_TO_SMOOI(mth->tmpr_nargs));
ctx = (moo_oop_context_t)moo_instantiate(moo, moo->_method_context, MOO_NULL, MOO_OOP_TO_SMOOI(mth->tmpr_nargs));
if (!ctx) goto oops;
moo_pushtmp (moo, (moo_oop_t*)&ctx); tmp_count++;
@ -1994,19 +1994,19 @@ static moo_pfrc_t pf_hash (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
switch (type)
{
case MOO_OBJ_TYPE_BYTE:
hv = moo_hash_bytes(((moo_oop_byte_t)rcv)->slot, MOO_OBJ_GET_SIZE(rcv));
hv = moo_hash_bytes(MOO_OBJ_GET_BYTE_SLOT(rcv), MOO_OBJ_GET_SIZE(rcv));
break;
case MOO_OBJ_TYPE_CHAR:
hv = moo_hashoochars (((moo_oop_char_t)rcv)->slot, MOO_OBJ_GET_SIZE(rcv));
hv = moo_hashoochars (MOO_OBJ_GET_CHAR_SLOT(rcv), MOO_OBJ_GET_SIZE(rcv));
break;
case MOO_OBJ_TYPE_HALFWORD:
hv = moo_hashhalfwords(((moo_oop_halfword_t)rcv)->slot, MOO_OBJ_GET_SIZE(rcv));
hv = moo_hashhalfwords(MOO_OBJ_GET_HALFWORD_SLOT(rcv), MOO_OBJ_GET_SIZE(rcv));
break;
case MOO_OBJ_TYPE_WORD:
hv = moo_hashwords(((moo_oop_word_t)rcv)->slot, MOO_OBJ_GET_SIZE(rcv));
hv = moo_hashwords(MOO_OBJ_GET_WORD_SLOT(rcv), MOO_OBJ_GET_SIZE(rcv));
break;
default:
@ -2148,7 +2148,7 @@ static moo_pfrc_t __block_value (moo_t* moo, moo_oop_context_t rcv_blkctx, moo_o
/* create a new block context to clone rcv_blkctx */
moo_pushtmp (moo, (moo_oop_t*)&rcv_blkctx);
blkctx = (moo_oop_context_t) moo_instantiate (moo, moo->_block_context, MOO_NULL, local_ntmprs);
blkctx = (moo_oop_context_t) moo_instantiate(moo, moo->_block_context, MOO_NULL, local_ntmprs);
moo_poptmp (moo);
if (!blkctx) return MOO_PF_FAILURE;
@ -4602,7 +4602,7 @@ static MOO_INLINE int make_block (moo_t* moo)
* clones a block context and activates the cloned context.
* this base block context is created with no stack for
* this reason */
blkctx = (moo_oop_context_t)moo_instantiate (moo, moo->_block_context, MOO_NULL, 0);
blkctx = (moo_oop_context_t)moo_instantiate(moo, moo->_block_context, MOO_NULL, 0);
if (!blkctx) return -1;
/* the long forward jump instruction has the format of
@ -5360,7 +5360,7 @@ static int __execute (moo_t* moo)
LOG_INST1 (moo, "make_array %zu", b1);
/* create an empty array */
t = moo_instantiate (moo, moo->_array, MOO_NULL, b1);
t = moo_instantiate(moo, moo->_array, MOO_NULL, b1);
if (!t) return -1;
MOO_STACK_PUSH (moo, t); /* push the array created */
@ -5387,7 +5387,7 @@ static int __execute (moo_t* moo)
LOG_INST1 (moo, "make_bytearray %zu", b1);
/* create an empty array */
t = moo_instantiate (moo, moo->_byte_array, MOO_NULL, b1);
t = moo_instantiate(moo, moo->_byte_array, MOO_NULL, b1);
if (!t) return -1;
MOO_STACK_PUSH (moo, t); /* push the array created */
@ -5408,7 +5408,7 @@ static int __execute (moo_t* moo)
else if (MOO_OOP_IS_ERROR(t1)) bv = MOO_OOP_TO_ERROR(t1);
else if (MOO_OOP_IS_SMPTR(t1)) bv = ((moo_oow_t)MOO_OOP_TO_SMPTR(t1) & 0xFF);
else bv = 0;
((moo_oop_byte_t)t2)->slot[b1] = bv;
MOO_OBJ_GET_BYTE_SLOT(t2)[b1] = bv;
NEXT_INST();
}
@ -5487,7 +5487,7 @@ static int __execute (moo_t* moo)
* context and activates the cloned context.
* this base block context is created with no
* stack for this reason. */
blkctx = (moo_oop_context_t)moo_instantiate (moo, moo->_block_context, MOO_NULL, 0);
blkctx = (moo_oop_context_t)moo_instantiate(moo, moo->_block_context, MOO_NULL, 0);
if (!blkctx) return -1;
/* get the receiver to the block copy message after block context instantiation

View File

@ -482,12 +482,12 @@ static int ignite_2 (moo_t* moo)
moo_oop_t tmp;
/* Create 'true' and 'false objects */
moo->_true = moo_instantiate (moo, moo->_true_class, MOO_NULL, 0);
moo->_false = moo_instantiate (moo, moo->_false_class, MOO_NULL, 0);
moo->_true = moo_instantiate(moo, moo->_true_class, MOO_NULL, 0);
moo->_false = moo_instantiate(moo, moo->_false_class, MOO_NULL, 0);
if (!moo->_true || !moo->_false) return -1;
/* Create the symbol table */
tmp = moo_instantiate (moo, moo->_symbol_table, MOO_NULL, 0);
tmp = moo_instantiate(moo, moo->_symbol_table, MOO_NULL, 0);
if (!tmp) return -1;
moo->symtab = (moo_oop_dic_t)tmp;
@ -517,7 +517,7 @@ static int ignite_2 (moo_t* moo)
moo->nil_process->perrmsg = moo->_nil;
/* Create a process scheduler */
tmp = (moo_oop_t)moo_instantiate (moo, moo->_process_scheduler, MOO_NULL, 0);
tmp = (moo_oop_t)moo_instantiate(moo, moo->_process_scheduler, MOO_NULL, 0);
if (!tmp) return -1;
moo->processor = (moo_oop_process_scheduler_t)tmp;
moo->processor->active = moo->nil_process;
@ -583,7 +583,7 @@ int moo_ignite (moo_t* moo, moo_oow_t heapsz)
moo->heap = moo_makeheap(moo, heapsz);
if (!moo->heap) return -1;
moo->_nil = moo_allocbytes (moo, MOO_SIZEOF(moo_obj_t));
moo->_nil = moo_allocpermbytes(moo, MOO_SIZEOF(moo_obj_t));
if (!moo->_nil) return -1;
moo->_nil->_flags = MOO_OBJ_MAKE_FLAGS (MOO_OBJ_TYPE_OOP, MOO_SIZEOF(moo_oop_t), 0, 1, 0, 0, 0);
@ -601,6 +601,7 @@ int moo_ignite (moo_t* moo, moo_oow_t heapsz)
static void compact_symbol_table (moo_t* moo, moo_oop_t _nil)
{
moo_oop_oop_t bucket;
moo_oop_char_t symbol;
moo_oow_t i, x, y, z;
moo_oow_t bucket_size, index;
@ -617,45 +618,46 @@ static void compact_symbol_table (moo_t* moo, moo_oop_t _nil)
MOO_ASSERT (moo, tally >= 0); /* it must not be less than 0 */
if (tally <= 0) return;
bucket = moo->symtab->bucket;
/* NOTE: in theory, the bucket size can be greater than MOO_SMOOI_MAX
* as it is an internal header field and is of an unsigned type */
bucket_size = MOO_OBJ_GET_SIZE(moo->symtab->bucket);
bucket_size = MOO_OBJ_GET_SIZE(bucket);
for (index = 0; index < bucket_size; )
{
if (MOO_OBJ_GET_FLAGS_MOVED(moo->symtab->bucket->slot[index]))
if (MOO_OBJ_GET_FLAGS_MOVED(bucket->slot[index]))
{
index++;
continue;
}
MOO_ASSERT (moo, moo->symtab->bucket->slot[index] != _nil);
MOO_ASSERT (moo, bucket->slot[index] != _nil);
for (i = 0, x = index, y = index; i < bucket_size; i++)
{
y = (y + 1) % bucket_size;
/* done if the slot at the current hash index is _nil */
if (moo->symtab->bucket->slot[y] == _nil) break;
if (bucket->slot[y] == _nil) break;
/* get the natural hash index for the data in the slot
* at the current hash index */
symbol = (moo_oop_char_t)moo->symtab->bucket->slot[y];
symbol = (moo_oop_char_t)bucket->slot[y];
MOO_ASSERT (moo, MOO_CLASSOF(moo,symbol) == moo->_symbol);
z = moo_hashoochars(symbol->slot, MOO_OBJ_GET_SIZE(symbol)) % bucket_size;
z = moo_hashoochars(MOO_OBJ_GET_CHAR_SLOT(symbol), MOO_OBJ_GET_SIZE(symbol)) % bucket_size;
/* move an element if necessary */
if ((y > x && (z <= x || z > y)) ||
(y < x && (z <= x && z > y)))
{
moo->symtab->bucket->slot[x] = moo->symtab->bucket->slot[y];
bucket->slot[x] = bucket->slot[y];
x = y;
}
}
moo->symtab->bucket->slot[x] = _nil;
bucket->slot[x] = _nil;
tally--;
}
@ -889,9 +891,9 @@ void moo_gc (moo_t* moo)
old_nil = moo->_nil;
/* move _nil and the root object table */
moo->_nil = moo_moveoop (moo, moo->_nil);
moo->_true = moo_moveoop (moo, moo->_true);
moo->_false = moo_moveoop (moo, moo->_false);
moo->_nil = moo_moveoop(moo, moo->_nil);
moo->_true = moo_moveoop(moo, moo->_true);
moo->_false = moo_moveoop(moo, moo->_false);
for (i = 0; i < MOO_COUNTOF(kernel_classes); i++)
{
@ -901,48 +903,48 @@ void moo_gc (moo_t* moo)
*(moo_oop_t*)((moo_uint8_t*)moo + kernel_classes[i].offset) = tmp;
}
moo->sysdic = (moo_oop_nsdic_t)moo_moveoop (moo, (moo_oop_t)moo->sysdic);
moo->processor = (moo_oop_process_scheduler_t)moo_moveoop (moo, (moo_oop_t)moo->processor);
moo->nil_process = (moo_oop_process_t)moo_moveoop (moo, (moo_oop_t)moo->nil_process);
moo->dicnewsym = (moo_oop_char_t)moo_moveoop (moo, (moo_oop_t)moo->dicnewsym);
moo->dicputassocsym = (moo_oop_char_t)moo_moveoop (moo, (moo_oop_t)moo->dicputassocsym);
moo->sysdic = (moo_oop_nsdic_t)moo_moveoop(moo, (moo_oop_t)moo->sysdic);
moo->processor = (moo_oop_process_scheduler_t)moo_moveoop(moo, (moo_oop_t)moo->processor);
moo->nil_process = (moo_oop_process_t)moo_moveoop(moo, (moo_oop_t)moo->nil_process);
moo->dicnewsym = (moo_oop_char_t)moo_moveoop(moo, (moo_oop_t)moo->dicnewsym);
moo->dicputassocsym = (moo_oop_char_t)moo_moveoop(moo, (moo_oop_t)moo->dicputassocsym);
for (i = 0; i < moo->sem_list_count; i++)
{
moo->sem_list[i] = (moo_oop_semaphore_t)moo_moveoop (moo, (moo_oop_t)moo->sem_list[i]);
moo->sem_list[i] = (moo_oop_semaphore_t)moo_moveoop(moo, (moo_oop_t)moo->sem_list[i]);
}
for (i = 0; i < moo->sem_heap_count; i++)
{
moo->sem_heap[i] = (moo_oop_semaphore_t)moo_moveoop (moo, (moo_oop_t)moo->sem_heap[i]);
moo->sem_heap[i] = (moo_oop_semaphore_t)moo_moveoop(moo, (moo_oop_t)moo->sem_heap[i]);
}
for (i = 0; i < moo->sem_io_tuple_count; i++)
{
if (moo->sem_io_tuple[i].sem[MOO_SEMAPHORE_IO_TYPE_INPUT])
moo->sem_io_tuple[i].sem[MOO_SEMAPHORE_IO_TYPE_INPUT] = (moo_oop_semaphore_t)moo_moveoop (moo, (moo_oop_t)moo->sem_io_tuple[i].sem[MOO_SEMAPHORE_IO_TYPE_INPUT]);
moo->sem_io_tuple[i].sem[MOO_SEMAPHORE_IO_TYPE_INPUT] = (moo_oop_semaphore_t)moo_moveoop(moo, (moo_oop_t)moo->sem_io_tuple[i].sem[MOO_SEMAPHORE_IO_TYPE_INPUT]);
if (moo->sem_io_tuple[i].sem[MOO_SEMAPHORE_IO_TYPE_OUTPUT])
moo->sem_io_tuple[i].sem[MOO_SEMAPHORE_IO_TYPE_OUTPUT] = (moo_oop_semaphore_t)moo_moveoop (moo, (moo_oop_t)moo->sem_io_tuple[i].sem[MOO_SEMAPHORE_IO_TYPE_OUTPUT]);
moo->sem_io_tuple[i].sem[MOO_SEMAPHORE_IO_TYPE_OUTPUT] = (moo_oop_semaphore_t)moo_moveoop(moo, (moo_oop_t)moo->sem_io_tuple[i].sem[MOO_SEMAPHORE_IO_TYPE_OUTPUT]);
}
moo->sem_gcfin = (moo_oop_semaphore_t)moo_moveoop (moo, (moo_oop_t)moo->sem_gcfin);
moo->sem_gcfin = (moo_oop_semaphore_t)moo_moveoop(moo, (moo_oop_t)moo->sem_gcfin);
for (i = 0; i < moo->proc_map_capa; i++)
{
moo->proc_map[i] = moo_moveoop (moo, moo->proc_map[i]);
moo->proc_map[i] = moo_moveoop(moo, moo->proc_map[i]);
}
for (i = 0; i < moo->tmp_count; i++)
{
*moo->tmp_stack[i] = moo_moveoop (moo, *moo->tmp_stack[i]);
*moo->tmp_stack[i] = moo_moveoop(moo, *moo->tmp_stack[i]);
}
if (moo->initial_context)
moo->initial_context = (moo_oop_context_t)moo_moveoop (moo, (moo_oop_t)moo->initial_context);
moo->initial_context = (moo_oop_context_t)moo_moveoop(moo, (moo_oop_t)moo->initial_context);
if (moo->active_context)
moo->active_context = (moo_oop_context_t)moo_moveoop (moo, (moo_oop_t)moo->active_context);
moo->active_context = (moo_oop_context_t)moo_moveoop(moo, (moo_oop_t)moo->active_context);
if (moo->active_method)
moo->active_method = (moo_oop_method_t)moo_moveoop (moo, (moo_oop_t)moo->active_method);
moo->active_method = (moo_oop_method_t)moo_moveoop(moo, (moo_oop_t)moo->active_method);
moo_rbt_walk (&moo->modtab, call_module_gc, moo);
@ -952,13 +954,13 @@ void moo_gc (moo_t* moo)
}
/* scan the new heap to move referenced objects */
scan_ptr = scan_new_heap (moo, scan_ptr);
scan_ptr = scan_new_heap(moo, scan_ptr);
/* check finalizable objects registered and scan the heap again.
* symbol table compation is placed after this phase assuming that
* no symbol is added to be finalized. */
gcfin_count = move_finalizable_objects (moo);
scan_ptr = scan_new_heap (moo, scan_ptr);
gcfin_count = move_finalizable_objects(moo);
scan_ptr = scan_new_heap(moo, scan_ptr);
/* traverse the symbol table for unreferenced symbols.
* if the symbol has not moved to the new heap, the symbol
@ -967,12 +969,12 @@ void moo_gc (moo_t* moo)
compact_symbol_table (moo, old_nil);
/* move the symbol table itself */
moo->symtab = (moo_oop_dic_t)moo_moveoop (moo, (moo_oop_t)moo->symtab);
moo->symtab = (moo_oop_dic_t)moo_moveoop(moo, (moo_oop_t)moo->symtab);
/* scan the new heap again from the end position of
* the previous scan to move referenced objects by
* the symbol table. */
scan_ptr = scan_new_heap (moo, scan_ptr);
scan_ptr = scan_new_heap(moo, scan_ptr);
/* the contents of the current heap is not needed any more.
* reset the upper bound to the base. don't forget to align the heap
@ -1041,7 +1043,7 @@ moo_oop_t moo_shallowcopy (moo_t* moo, moo_oop_t oop)
c = MOO_OBJ_GET_CLASS(oop);
moo_pushtmp (moo, &oop);
z = moo_instantiate (moo, (moo_oop_t)c, MOO_NULL, MOO_OBJ_GET_SIZE(oop) - MOO_CLASS_SPEC_NAMED_INSTVARS(MOO_OOP_TO_SMOOI(c->spec)));
z = moo_instantiate(moo, (moo_oop_t)c, MOO_NULL, MOO_OBJ_GET_SIZE(oop) - MOO_CLASS_SPEC_NAMED_INSTVARS(MOO_OOP_TO_SMOOI(c->spec)));
moo_poptmp(moo);
if (!z) return z;

View File

@ -26,15 +26,18 @@
#include "moo-prv.h"
#define MIN_HEAP_SIZE 65536 /* TODO: adjust this value? */
#define PERM_SPACE_SIZE 2048 /* TODO: adjust perm space size depending on what's allocated in the permspace */
moo_heap_t* moo_makeheap (moo_t* moo, moo_oow_t size)
{
moo_heap_t* heap;
moo_oow_t half_size;
if (size < 65536) size = 65536; /* not really useful check as 65536 is too small */
if (size < MIN_HEAP_SIZE) size = MIN_HEAP_SIZE;
half_size = size / 2;
heap = (moo_heap_t*)moo->vmprim.alloc_heap(moo, MOO_SIZEOF(*heap) + size);
heap = (moo_heap_t*)moo->vmprim.alloc_heap(moo, MOO_SIZEOF(*heap) + PERM_SPACE_SIZE + size);
if (!heap)
{
const moo_ooch_t* oldmsg = moo_backuperrmsg(moo);
@ -46,16 +49,23 @@ moo_heap_t* moo_makeheap (moo_t* moo, moo_oow_t size)
heap->base = (moo_uint8_t*)(heap + 1);
heap->size = size;
heap->curspace.base= (moo_uint8_t*)(heap + 1);
/* TODO: consider placing permspace in a separate memory allocated block in case we have to grow
* other spaces. we may be able to realloc() the entire heap region without affecting the separately
* allocated block. */
heap->permspace.base = (moo_uint8_t*)(heap + 1);
heap->permspace.ptr = (moo_uint8_t*)MOO_ALIGN(((moo_uintptr_t)heap->permspace.base), MOO_SIZEOF(moo_oop_t));
heap->permspace.limit = heap->permspace.base + PERM_SPACE_SIZE;
heap->curspace.base = heap->permspace.limit;
heap->curspace.ptr = (moo_uint8_t*)MOO_ALIGN(((moo_uintptr_t)heap->curspace.base), MOO_SIZEOF(moo_oop_t));
heap->curspace.limit = heap->curspace.ptr + half_size;
heap->curspace.limit = heap->curspace.base + half_size;
heap->newspace.base = (moo_uint8_t*)(heap + 1) + half_size;
heap->newspace.base = heap->curspace.limit; /*(moo_uint8_t*)(heap + 1) + half_size;*/
heap->newspace.ptr = (moo_uint8_t*)MOO_ALIGN(((moo_uintptr_t)heap->newspace.base), MOO_SIZEOF(moo_oop_t));
heap->newspace.limit = heap->newspace.ptr + half_size;
heap->newspace.limit = heap->newspace.base + half_size;
/* if size is too small, space->ptr may go past space->limit even at
* this moment depending on the alignment of space->base. subsequent
/* if size is too small, space.ptr may go past space.limit even at
* this moment depending on the alignment of space.base. subsequent
* calls to moo_allocheapspace() are bound to fail. Make sure to
* pass a heap size large enough */

View File

@ -420,7 +420,7 @@ static int print_object (moo_t* moo, moo_bitmask_t mask, moo_oop_t oop, outbfmt_
if (outbfmt (moo, mask, "-16r") <= -1) return -1;
for (i = MOO_OBJ_GET_SIZE(oop); i > 0;)
{
if (outbfmt(moo, mask, "%0*lX", (int)(MOO_SIZEOF(moo_liw_t) * 2), (unsigned long)((moo_oop_liword_t)oop)->slot[--i]) <= -1) return -1;
if (outbfmt(moo, mask, "%0*lX", (int)(MOO_SIZEOF(moo_liw_t) * 2), (unsigned long int)(MOO_OBJ_GET_LIWORD_SLOT(oop)[--i])) <= -1) return -1;
}
}
else if (c == moo->_large_positive_integer)
@ -429,7 +429,7 @@ static int print_object (moo_t* moo, moo_bitmask_t mask, moo_oop_t oop, outbfmt_
if (outbfmt (moo, mask, "16r") <= -1) return -1;
for (i = MOO_OBJ_GET_SIZE(oop); i > 0;)
{
if (outbfmt(moo, mask, "%0*lX", (int)(MOO_SIZEOF(moo_liw_t) * 2), (unsigned long)((moo_oop_liword_t)oop)->slot[--i]) <= -1) return -1;
if (outbfmt(moo, mask, "%0*lX", (int)(MOO_SIZEOF(moo_liw_t) * 2), (unsigned long int)(MOO_OBJ_GET_LIWORD_SLOT(oop)[--i])) <= -1) return -1;
}
}
else if (MOO_OBJ_GET_FLAGS_TYPE(oop) == MOO_OBJ_TYPE_CHAR)
@ -445,7 +445,7 @@ static int print_object (moo_t* moo, moo_bitmask_t mask, moo_oop_t oop, outbfmt_
for (i = 0; i < MOO_OBJ_GET_SIZE(oop); i++)
{
ch = ((moo_oop_char_t)oop)->slot[i];
ch = MOO_OBJ_GET_CHAR_SLOT(oop)[i];
if (ch < ' ')
{
escape = 1;
@ -460,7 +460,7 @@ static int print_object (moo_t* moo, moo_bitmask_t mask, moo_oop_t oop, outbfmt_
if (outbfmt(moo, mask, "S'") <= -1) return -1;
for (i = 0; i < MOO_OBJ_GET_SIZE(oop); i++)
{
ch = ((moo_oop_char_t)oop)->slot[i];
ch = MOO_OBJ_GET_CHAR_SLOT(oop)[i];
if (ch < ' ')
{
switch (ch)
@ -523,10 +523,10 @@ static int print_object (moo_t* moo, moo_bitmask_t mask, moo_oop_t oop, outbfmt_
i = 0;
if (i < MOO_OBJ_GET_SIZE(oop))
{
if (outbfmt(moo, mask, "%d", ((moo_oop_byte_t)oop)->slot[i]) <= -1) return -1;
if (outbfmt(moo, mask, "%d", MOO_OBJ_GET_BYTE_SLOT(oop)[i]) <= -1) return -1;
for (++i; i < MOO_OBJ_GET_SIZE(oop); i++)
{
if (outbfmt(moo, mask, " %d", ((moo_oop_byte_t)oop)->slot[i]) <= -1) return -1;
if (outbfmt(moo, mask, " %d", MOO_OBJ_GET_BYTE_SLOT(oop)[i]) <= -1) return -1;
}
}
if (outbfmt(moo, mask, "]") <= -1) return -1;
@ -537,7 +537,7 @@ static int print_object (moo_t* moo, moo_bitmask_t mask, moo_oop_t oop, outbfmt_
if (outbfmt(moo, mask, "#[[") <= -1) return -1;; /* TODO: fix this symbol/notation */
for (i = 0; i < MOO_OBJ_GET_SIZE(oop); i++)
{
if (outbfmt(moo, mask, " %zX", (moo_oow_t)((moo_oop_halfword_t)oop)->slot[i]) <= -1) return -1;
if (outbfmt(moo, mask, " %zX", (moo_oow_t)(MOO_OBJ_GET_HALFWORD_SLOT(oop)[i])) <= -1) return -1;
}
outbfmt (moo, mask, "]]");
}
@ -546,7 +546,7 @@ static int print_object (moo_t* moo, moo_bitmask_t mask, moo_oop_t oop, outbfmt_
if (outbfmt(moo, mask, "#[[[") <= -1) return -1;; /* TODO: fix this symbol/notation */
for (i = 0; i < MOO_OBJ_GET_SIZE(oop); i++)
{
if (outbfmt(moo, mask, " %zX", ((moo_oop_word_t)oop)->slot[i]) <= -1) return -1;
if (outbfmt(moo, mask, " %zX", MOO_OBJ_GET_WORD_SLOT(oop)[i]) <= -1) return -1;
}
if (outbfmt(moo, mask, "]]]") <= -1) return -1;
}
@ -556,11 +556,11 @@ static int print_object (moo_t* moo, moo_bitmask_t mask, moo_oop_t oop, outbfmt_
i = 0;
if (i < MOO_OBJ_GET_SIZE(oop))
{
if (print_object(moo, mask, ((moo_oop_oop_t)oop)->slot[i], outbfmt) <= -1) return -1;
if (print_object(moo, mask, MOO_OBJ_GET_OOP_SLOT(oop)[i], outbfmt) <= -1) return -1;
for (++i; i < MOO_OBJ_GET_SIZE(oop); i++)
{
if (outbfmt(moo, mask, " ") <= -1) return -1;
if (print_object(moo, mask, ((moo_oop_oop_t)oop)->slot[i], outbfmt) <= -1) return -1;
if (print_object(moo, mask, MOO_OBJ_GET_OOP_SLOT(oop)[i], outbfmt) <= -1) return -1;
}
}
if (outbfmt(moo, mask, ")") <= -1) return -1;
@ -568,7 +568,7 @@ static int print_object (moo_t* moo, moo_bitmask_t mask, moo_oop_t oop, outbfmt_
else if (c == moo->_class)
{
/* print the class name */
if (outbfmt(moo, mask, "%.*js", MOO_OBJ_GET_SIZE(((moo_oop_class_t)oop)->name), ((moo_oop_class_t)oop)->name->slot) <= -1) return -1;
if (outbfmt(moo, mask, "%.*js", MOO_OBJ_GET_SIZE(((moo_oop_class_t)oop)->name), MOO_OBJ_GET_CHAR_SLOT(((moo_oop_class_t)oop)->name)) <= -1) return -1;
}
else if (c == moo->_association)
{
@ -576,7 +576,7 @@ static int print_object (moo_t* moo, moo_bitmask_t mask, moo_oop_t oop, outbfmt_
}
else
{
if (outbfmt(moo, mask, "<<%.*js:%p>>", MOO_OBJ_GET_SIZE(c->name), ((moo_oop_char_t)c->name)->slot, oop) <= -1) return -1;
if (outbfmt(moo, mask, "<<%.*js:%p>>", MOO_OBJ_GET_SIZE(c->name), MOO_OBJ_GET_CHAR_SLOT(c->name), oop) <= -1) return -1;
}
}

View File

@ -855,7 +855,7 @@ int moo_genpfmethod (moo_t* moo, moo_mod_t* mod, moo_oop_class_t _class, moo_met
#if defined(MOO_USE_METHOD_TRAILER)
mth = (moo_oop_method_t)moo_instantiatewithtrailer (moo, moo->_method, 1, MOO_NULL, 0);
#else
mth = (moo_oop_method_t)moo_instantiate (moo, moo->_method, MOO_NULL, 1);
mth = (moo_oop_method_t)moo_instantiate(moo, moo->_method, MOO_NULL, 1);
#endif
if (!mth)
{

View File

@ -493,6 +493,7 @@ struct moo_obj_word_t
#define MOO_OBJ_GET_BYTE_SLOT(oop) (((moo_oop_byte_t)(oop))->slot)
#define MOO_OBJ_GET_HALFWORD_SLOT(oop) (((moo_oop_halfword_t)(oop))->slot)
#define MOO_OBJ_GET_WORD_SLOT(oop) (((moo_oop_word_t)(oop))->slot)
#define MOO_OBJ_GET_LIWORD_SLOT(oop) (((moo_oop_liword_t)(oop))->slot)
typedef struct moo_trailer_t moo_trailer_t;
struct moo_trailer_t
@ -1840,10 +1841,8 @@ extern "C" {
#if defined(MOO_HAVE_INLINE)
static MOO_INLINE void MOO_STORE_OOP (moo_t* moo, moo_oop_t* rcvaddr, moo_oop_t val) { *rcvaddr = val; }
static MOO_INLINE void MOO_STORE_OOP_TO_ARRAY (moo_t* moo, moo_oop_oop_t rcv, moo_oow_t idx, moo_oop_t val) { MOO_STORE_OOP (moo, &rcv->slot[idx], val); }
#else
# define MOO_STORE_OOP(moo,rcvaddr,val) (*(rcvaddr) = val)
# define MOO_STORE_OOP_TO_ARRAY(moo,rcv,idx,val) MOO_STORE_OOP(moo, &((moo_oop_oop_t)rcv)->slot[idx], val)
#endif
MOO_EXPORT moo_t* moo_open (

View File

@ -441,7 +441,7 @@ moo_pfrc_t moo_pf_basic_at_put (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
}
case MOO_OBJ_TYPE_OOP:
MOO_STORE_OOP_TO_ARRAY (moo, (moo_oop_oop_t)rcv, idx, val); /*((moo_oop_oop_t)rcv)->slot[idx] = val;*/
MOO_STORE_OOP (moo, &((moo_oop_oop_t)rcv)->slot[idx], val); /*((moo_oop_oop_t)rcv)->slot[idx] = val;*/
break;
default:

View File

@ -622,7 +622,7 @@ moo_pfrc_t moo_pf_system_get_bytes (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
if (len_in_buffer > 0)
{
MOO_MEMCPY (&((moo_oop_byte_t)tmp)->slot[offset_in_buffer], &rawptr[offset], len_in_buffer);
MOO_MEMCPY (&MOO_OBJ_GET_BYTE_SLOT(tmp)[offset_in_buffer], &rawptr[offset], len_in_buffer);
}
MOO_STACK_SETRET (moo, nargs, MOO_SMOOI_TO_OOP(len_in_buffer));
@ -685,7 +685,7 @@ moo_pfrc_t moo_pf_system_put_bytes (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
if (len_in_buffer > 0)
{
MOO_MEMCPY (&rawptr[offset], &((moo_oop_byte_t)tmp)->slot[offset_in_buffer], len_in_buffer);
MOO_MEMCPY (&rawptr[offset], &MOO_OBJ_GET_BYTE_SLOT(tmp)[offset_in_buffer], len_in_buffer);
}
MOO_STACK_SETRET (moo, nargs, MOO_SMOOI_TO_OOP(len_in_buffer));
@ -941,7 +941,7 @@ moo_pfrc_t moo_pf_smptr_get_bytes (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
if (len_in_buffer > 0)
{
MOO_MEMCPY (&((moo_oop_byte_t)tmp)->slot[offset_in_buffer], &rawptr[offset], len_in_buffer);
MOO_MEMCPY (&MOO_OBJ_GET_BYTE_SLOT(tmp)[offset_in_buffer], &rawptr[offset], len_in_buffer);
}
MOO_STACK_SETRET (moo, nargs, MOO_SMOOI_TO_OOP(len_in_buffer));
@ -999,7 +999,7 @@ moo_pfrc_t moo_pf_smptr_put_bytes (moo_t* moo, moo_mod_t* mod, moo_ooi_t nargs)
if (len_in_buffer > 0)
{
MOO_MEMCPY (&rawptr[offset], &((moo_oop_byte_t)tmp)->slot[offset_in_buffer], len_in_buffer);
MOO_MEMCPY (&rawptr[offset], &MOO_OBJ_GET_BYTE_SLOT(tmp)[offset_in_buffer], len_in_buffer);
}
MOO_STACK_SETRET (moo, nargs, MOO_SMOOI_TO_OOP(len_in_buffer));