refactored the bytecode interpretation loop with computed jump tables

added incomplete code to support a semaphore group
This commit is contained in:
hyunghwan.chung 2017-09-21 07:56:51 +00:00
parent fb48e48889
commit 6711bc01fa
13 changed files with 1673 additions and 1145 deletions

6
moo/configure vendored
View File

@ -18687,8 +18687,8 @@ fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking computed goto usability" >&5
$as_echo_n "checking computed goto usability... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking labels as values" >&5
$as_echo_n "checking labels as values... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@ -18704,7 +18704,7 @@ if ac_fn_c_try_compile "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_COMPUTED_GOTO 1" >>confdefs.h
$as_echo "#define HAVE_LABELS_AS_VALUES 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5

View File

@ -140,11 +140,11 @@ AC_LINK_IFELSE(
[AC_MSG_RESULT(no)]
)
AC_MSG_CHECKING([computed goto usability])
AC_MSG_CHECKING([labels as values])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM( [], [[void *jp = &&jpt; goto *jp; 1; jpt: 2; ]])],
[AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_COMPUTED_GOTO, 1, [computed gotos])],
AC_DEFINE(HAVE_LABELS_AS_VALUES, 1, [labels as values])],
[AC_MSG_RESULT(no)]
)

View File

@ -113,7 +113,6 @@ class(#character) String(Array)
}
*)
(* The strlen method returns the number of characters before a terminating null.
* if no terminating null character exists, it returns the same value as the size method *)
method(#primitive,#lenient) _strlen.

View File

@ -47,15 +47,16 @@ class(#pointer,#final,#limited) Process(Object)
class Semaphore(Object)
{
var count := 0,
waiting_head := nil,
var waiting_head := nil,
waiting_tail := nil,
count := 0,
heapIndex := -1,
fireTimeSec := 0,
fireTimeNsec := 0,
ioIndex := -1,
ioHandle := nil,
ioMask := 0.
ioMask := 0,
group := nil.
method(#class) forMutualExclusion
{
@ -123,9 +124,72 @@ TODO: timed wait...
}
}
(*
xxx := Semaphore new.
xxx on: #signal do: [ ].
========= CASE 1 ====================
sg := SemaphoreGroup with (xxx, yyy, zzz).
Processor signal: xxx onInput: aaa.
Processor signal: yyy onInput: bbb.
Processor signal: zzz onOutput: ccc.
while (true)
{
sem := sg wait.
if (sem == xxx)
{
}
elsif (sem == yyy)
{
}
elsif (sem == zzz)
{
}
}
============ CASE 2====================
### ASSOCIATE CALLBACK WITH SEMAPHORE.
sg := SemaphoreGroup with (xxx, yyy, zzz).
oldaction := xxx signalAction: [ ... ]. ### similar interface like unix system call signal()???? method signalAction: block {} , method signalAction { ^self.signalAction }
yyy signalAction: [ ... ].
zzz signalAction: [ ... ].
Processor signal: xxx onInput: aaa.
Processor signal: yyy onInput: bbb.
Processor signal: zzz onOutput: ccc.
while (true)
{
sem := sg wait. ### the action associated with the semaphore must get executed. => wait may be a primitive. the primitive handler may return failure... if so, the actual primitive body can execute the action easily
}
Semaphore>>method wait
{
<primitive: #Semaphore_wait>
if (errorCode == NO ERROR)
{
self.signalAction value. ## which is better???
self.sginalAction value: self.
}
}
*)
class SemaphoreGroup(Object)
{
var arr, size := 0.
var waiting_head := nil,
waiting_tail := nil,
size := 0,
pos := 0,
semarr := nil.
(* TODO: good idea to a shortcut way to prohibit a certain method in the heirarchy chain?
@ -156,13 +220,13 @@ method(#class,#abstract) xxx. => method(#class) xxx { self subclassResponsibilit
method initialize
{
self.arr := Array new: 10.
self.semarr := Array new: 10.
}
method initialize: arr
{
self.size := arr size.
self.arr := arr.
self.semarr := arr.
}
method(#primitive) wait.

View File

@ -104,6 +104,19 @@ extend MyObject
{
## TODO: support import in extend??
method(#class) makeBlock(a,b)
{
^[:x | a * x + b]
}
method(#class) testMakeBlock
{
|a b |
a := self makeBlock (12, 22).
b := self makeBlock (99, 4).
^(a value: 5) * (b value: 6). ## (12 * 5 + 22) * (99 * 6 + 4) => 49036
}
method(#class) main
{
| tc limit |
@ -159,7 +172,8 @@ extend MyObject
[MyObject.System.System.System.System new kk == #KK],
## 35 - 39
[MyObject.System.System.System KING == #KING]
[MyObject.System.System.System KING == #KING],
[self testMakeBlock == 49036]
).
limit := tc size.

File diff suppressed because it is too large Load Diff

View File

@ -878,7 +878,6 @@ void moo_gc (moo_t* moo)
*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);
if (moo->active_context)
@ -953,7 +952,6 @@ void moo_gc (moo_t* moo)
moo->curheap->base, moo->curheap->ptr, moo->newheap->base, moo->newheap->ptr);
}
void moo_pushtmp (moo_t* moo, moo_oop_t* oop_ptr)
{
/* if you have too many temporaries pushed, something must be wrong.
@ -974,7 +972,6 @@ void moo_poptmps (moo_t* moo, moo_oow_t count)
moo->tmp_count -= count;
}
moo_oop_t moo_shallowcopy (moo_t* moo, moo_oop_t oop)
{
if (MOO_OOP_IS_POINTER(oop) && MOO_OBJ_GET_CLASS(oop) != moo->_symbol)
@ -1018,7 +1015,6 @@ int moo_regfinalizable (moo_t* moo, moo_oop_t oop)
{
moo_finalizable_t* x;
if (!MOO_OOP_IS_POINTER(oop) || (MOO_OBJ_GET_FLAGS_GCFIN(oop) & (MOO_GCFIN_FINALIZABLE | MOO_GCFIN_FINALIZED)))
{
moo_seterrnum (moo, MOO_EINVAL);

41
moo/lib/genbct.awk Normal file
View File

@ -0,0 +1,41 @@
# generate instruction dispatch table for VM.
# qseawk -f genbct.awk moo-prv.h
#
# TODO: rewrite this script in moo itself.
#
BEGIN {
on = 0;
for (i = 0; i < 255; i++) code_label[i] = "&&case_DEFAULT";
}
/^enum moo_bcode_t$/ { on = 1; }
/^enum moo_bcode_t {$/ { on = 2; }
/^{$/ { if (on == 1) on = 2; else on = 0; }
/^};$/ { on = 0; }
on == 2 && match($0, /^[[:space:]]*BCODE_([[:alnum:]_]+)[[:space:]]*=[[:space:]]*(0x[[:xdigit:]]+)/, 1, sm) >= 1 {
count = length(sm) \ 2;
if (count == 2)
{
name = substr ($0, sm[1,"start"], sm[1,"length"]);
code = substr ($0, sm[2,"start"], sm[2,"length"]);
code_label[int(code)] = "&&case_BCODE_" name;
}
}
END {
printf ("/* generated by genbct.awk */\n\n");
##printf ("\tstatic void* inst_jump_labels[] =\n");
##printf ("\t{\n");
for (i = 0; i < 255; i++)
{
printf ("\t\t/* %3d */ %s,\n", i, code_label[i]);
}
printf ("\t\t/* %3d */ %s\n", i, code_label[i]);
##printf ("\t};\n");
}

View File

@ -240,6 +240,7 @@ reswitch:
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if (flagc & FLAGC_LENMOD) goto invalid_format;
for (n = 0;; ++fmt)
{
n = n * 10 + ch - '0';
@ -359,6 +360,9 @@ reswitch:
case 'x':
base = 16;
goto handle_nosign;
case 'b':
base = 2;
goto handle_nosign;
/* end of unsigned integer conversions */
case 'p': /* pointer */
@ -889,6 +893,11 @@ number:
if ((flagc & FLAGC_SHARP) && num != 0)
{
if (base == 2)
{
PUT_OOCH ('0', 1);
PUT_OOCH ('b', 1);
}
if (base == 8)
{
PUT_OOCH ('0', 1);

258
moo/lib/moo-bct.h Normal file
View File

@ -0,0 +1,258 @@
/* generated by genbct.awk */
/* 0 */ &&case_BCODE_STORE_INTO_INSTVAR_0,
/* 1 */ &&case_BCODE_STORE_INTO_INSTVAR_1,
/* 2 */ &&case_BCODE_STORE_INTO_INSTVAR_2,
/* 3 */ &&case_BCODE_STORE_INTO_INSTVAR_3,
/* 4 */ &&case_BCODE_STORE_INTO_INSTVAR_4,
/* 5 */ &&case_BCODE_STORE_INTO_INSTVAR_5,
/* 6 */ &&case_BCODE_STORE_INTO_INSTVAR_6,
/* 7 */ &&case_BCODE_STORE_INTO_INSTVAR_7,
/* 8 */ &&case_BCODE_POP_INTO_INSTVAR_0,
/* 9 */ &&case_BCODE_POP_INTO_INSTVAR_1,
/* 10 */ &&case_BCODE_POP_INTO_INSTVAR_2,
/* 11 */ &&case_BCODE_POP_INTO_INSTVAR_3,
/* 12 */ &&case_BCODE_POP_INTO_INSTVAR_4,
/* 13 */ &&case_BCODE_POP_INTO_INSTVAR_5,
/* 14 */ &&case_BCODE_POP_INTO_INSTVAR_6,
/* 15 */ &&case_BCODE_POP_INTO_INSTVAR_7,
/* 16 */ &&case_BCODE_PUSH_INSTVAR_0,
/* 17 */ &&case_BCODE_PUSH_INSTVAR_1,
/* 18 */ &&case_BCODE_PUSH_INSTVAR_2,
/* 19 */ &&case_BCODE_PUSH_INSTVAR_3,
/* 20 */ &&case_BCODE_PUSH_INSTVAR_4,
/* 21 */ &&case_BCODE_PUSH_INSTVAR_5,
/* 22 */ &&case_BCODE_PUSH_INSTVAR_6,
/* 23 */ &&case_BCODE_PUSH_INSTVAR_7,
/* 24 */ &&case_BCODE_PUSH_TEMPVAR_0,
/* 25 */ &&case_BCODE_PUSH_TEMPVAR_1,
/* 26 */ &&case_BCODE_PUSH_TEMPVAR_2,
/* 27 */ &&case_BCODE_PUSH_TEMPVAR_3,
/* 28 */ &&case_BCODE_PUSH_TEMPVAR_4,
/* 29 */ &&case_BCODE_PUSH_TEMPVAR_5,
/* 30 */ &&case_BCODE_PUSH_TEMPVAR_6,
/* 31 */ &&case_BCODE_PUSH_TEMPVAR_7,
/* 32 */ &&case_BCODE_STORE_INTO_TEMPVAR_0,
/* 33 */ &&case_BCODE_STORE_INTO_TEMPVAR_1,
/* 34 */ &&case_BCODE_STORE_INTO_TEMPVAR_2,
/* 35 */ &&case_BCODE_STORE_INTO_TEMPVAR_3,
/* 36 */ &&case_BCODE_STORE_INTO_TEMPVAR_4,
/* 37 */ &&case_BCODE_STORE_INTO_TEMPVAR_5,
/* 38 */ &&case_BCODE_STORE_INTO_TEMPVAR_6,
/* 39 */ &&case_BCODE_STORE_INTO_TEMPVAR_7,
/* 40 */ &&case_BCODE_POP_INTO_TEMPVAR_0,
/* 41 */ &&case_BCODE_POP_INTO_TEMPVAR_1,
/* 42 */ &&case_BCODE_POP_INTO_TEMPVAR_2,
/* 43 */ &&case_BCODE_POP_INTO_TEMPVAR_3,
/* 44 */ &&case_BCODE_POP_INTO_TEMPVAR_4,
/* 45 */ &&case_BCODE_POP_INTO_TEMPVAR_5,
/* 46 */ &&case_BCODE_POP_INTO_TEMPVAR_6,
/* 47 */ &&case_BCODE_POP_INTO_TEMPVAR_7,
/* 48 */ &&case_BCODE_PUSH_LITERAL_0,
/* 49 */ &&case_BCODE_PUSH_LITERAL_1,
/* 50 */ &&case_BCODE_PUSH_LITERAL_2,
/* 51 */ &&case_BCODE_PUSH_LITERAL_3,
/* 52 */ &&case_BCODE_PUSH_LITERAL_4,
/* 53 */ &&case_BCODE_PUSH_LITERAL_5,
/* 54 */ &&case_BCODE_PUSH_LITERAL_6,
/* 55 */ &&case_BCODE_PUSH_LITERAL_7,
/* 56 */ &&case_BCODE_STORE_INTO_OBJECT_0,
/* 57 */ &&case_BCODE_STORE_INTO_OBJECT_1,
/* 58 */ &&case_BCODE_STORE_INTO_OBJECT_2,
/* 59 */ &&case_BCODE_STORE_INTO_OBJECT_3,
/* 60 */ &&case_BCODE_POP_INTO_OBJECT_0,
/* 61 */ &&case_BCODE_POP_INTO_OBJECT_1,
/* 62 */ &&case_BCODE_POP_INTO_OBJECT_2,
/* 63 */ &&case_BCODE_POP_INTO_OBJECT_3,
/* 64 */ &&case_BCODE_PUSH_OBJECT_0,
/* 65 */ &&case_BCODE_PUSH_OBJECT_1,
/* 66 */ &&case_BCODE_PUSH_OBJECT_2,
/* 67 */ &&case_BCODE_PUSH_OBJECT_3,
/* 68 */ &&case_BCODE_JUMP_FORWARD_0,
/* 69 */ &&case_BCODE_JUMP_FORWARD_1,
/* 70 */ &&case_BCODE_JUMP_FORWARD_2,
/* 71 */ &&case_BCODE_JUMP_FORWARD_3,
/* 72 */ &&case_BCODE_JUMP_BACKWARD_0,
/* 73 */ &&case_BCODE_JUMP_BACKWARD_1,
/* 74 */ &&case_BCODE_JUMP_BACKWARD_2,
/* 75 */ &&case_BCODE_JUMP_BACKWARD_3,
/* 76 */ &&case_BCODE_JUMP_BACKWARD_IF_FALSE_0,
/* 77 */ &&case_BCODE_JUMP_BACKWARD_IF_FALSE_1,
/* 78 */ &&case_BCODE_JUMP_BACKWARD_IF_FALSE_2,
/* 79 */ &&case_BCODE_JUMP_BACKWARD_IF_FALSE_3,
/* 80 */ &&case_BCODE_JUMP_BACKWARD_IF_TRUE_0,
/* 81 */ &&case_BCODE_JUMP_BACKWARD_IF_TRUE_1,
/* 82 */ &&case_BCODE_JUMP_BACKWARD_IF_TRUE_2,
/* 83 */ &&case_BCODE_JUMP_BACKWARD_IF_TRUE_3,
/* 84 */ &&case_DEFAULT,
/* 85 */ &&case_DEFAULT,
/* 86 */ &&case_DEFAULT,
/* 87 */ &&case_DEFAULT,
/* 88 */ &&case_BCODE_STORE_INTO_CTXTEMPVAR_0,
/* 89 */ &&case_BCODE_STORE_INTO_CTXTEMPVAR_1,
/* 90 */ &&case_BCODE_STORE_INTO_CTXTEMPVAR_2,
/* 91 */ &&case_BCODE_STORE_INTO_CTXTEMPVAR_3,
/* 92 */ &&case_BCODE_POP_INTO_CTXTEMPVAR_0,
/* 93 */ &&case_BCODE_POP_INTO_CTXTEMPVAR_1,
/* 94 */ &&case_BCODE_POP_INTO_CTXTEMPVAR_2,
/* 95 */ &&case_BCODE_POP_INTO_CTXTEMPVAR_3,
/* 96 */ &&case_BCODE_PUSH_CTXTEMPVAR_0,
/* 97 */ &&case_BCODE_PUSH_CTXTEMPVAR_1,
/* 98 */ &&case_BCODE_PUSH_CTXTEMPVAR_2,
/* 99 */ &&case_BCODE_PUSH_CTXTEMPVAR_3,
/* 100 */ &&case_BCODE_PUSH_OBJVAR_0,
/* 101 */ &&case_BCODE_PUSH_OBJVAR_1,
/* 102 */ &&case_BCODE_PUSH_OBJVAR_2,
/* 103 */ &&case_BCODE_PUSH_OBJVAR_3,
/* 104 */ &&case_BCODE_STORE_INTO_OBJVAR_0,
/* 105 */ &&case_BCODE_STORE_INTO_OBJVAR_1,
/* 106 */ &&case_BCODE_STORE_INTO_OBJVAR_2,
/* 107 */ &&case_BCODE_STORE_INTO_OBJVAR_3,
/* 108 */ &&case_BCODE_POP_INTO_OBJVAR_0,
/* 109 */ &&case_BCODE_POP_INTO_OBJVAR_1,
/* 110 */ &&case_BCODE_POP_INTO_OBJVAR_2,
/* 111 */ &&case_BCODE_POP_INTO_OBJVAR_3,
/* 112 */ &&case_BCODE_SEND_MESSAGE_0,
/* 113 */ &&case_BCODE_SEND_MESSAGE_1,
/* 114 */ &&case_BCODE_SEND_MESSAGE_2,
/* 115 */ &&case_BCODE_SEND_MESSAGE_3,
/* 116 */ &&case_BCODE_SEND_MESSAGE_TO_SUPER_0,
/* 117 */ &&case_BCODE_SEND_MESSAGE_TO_SUPER_1,
/* 118 */ &&case_BCODE_SEND_MESSAGE_TO_SUPER_2,
/* 119 */ &&case_BCODE_SEND_MESSAGE_TO_SUPER_3,
/* 120 */ &&case_DEFAULT,
/* 121 */ &&case_DEFAULT,
/* 122 */ &&case_DEFAULT,
/* 123 */ &&case_DEFAULT,
/* 124 */ &&case_DEFAULT,
/* 125 */ &&case_DEFAULT,
/* 126 */ &&case_DEFAULT,
/* 127 */ &&case_DEFAULT,
/* 128 */ &&case_BCODE_STORE_INTO_INSTVAR_X,
/* 129 */ &&case_BCODE_PUSH_RECEIVER,
/* 130 */ &&case_BCODE_PUSH_NIL,
/* 131 */ &&case_BCODE_PUSH_TRUE,
/* 132 */ &&case_BCODE_PUSH_FALSE,
/* 133 */ &&case_BCODE_PUSH_CONTEXT,
/* 134 */ &&case_BCODE_PUSH_PROCESS,
/* 135 */ &&case_BCODE_PUSH_RECEIVER_NS,
/* 136 */ &&case_BCODE_POP_INTO_INSTVAR_X,
/* 137 */ &&case_BCODE_PUSH_NEGONE,
/* 138 */ &&case_BCODE_PUSH_ZERO,
/* 139 */ &&case_BCODE_PUSH_ONE,
/* 140 */ &&case_BCODE_PUSH_TWO,
/* 141 */ &&case_DEFAULT,
/* 142 */ &&case_DEFAULT,
/* 143 */ &&case_DEFAULT,
/* 144 */ &&case_BCODE_PUSH_INSTVAR_X,
/* 145 */ &&case_DEFAULT,
/* 146 */ &&case_DEFAULT,
/* 147 */ &&case_DEFAULT,
/* 148 */ &&case_DEFAULT,
/* 149 */ &&case_DEFAULT,
/* 150 */ &&case_DEFAULT,
/* 151 */ &&case_DEFAULT,
/* 152 */ &&case_BCODE_PUSH_TEMPVAR_X,
/* 153 */ &&case_DEFAULT,
/* 154 */ &&case_DEFAULT,
/* 155 */ &&case_DEFAULT,
/* 156 */ &&case_DEFAULT,
/* 157 */ &&case_DEFAULT,
/* 158 */ &&case_DEFAULT,
/* 159 */ &&case_DEFAULT,
/* 160 */ &&case_BCODE_STORE_INTO_TEMPVAR_X,
/* 161 */ &&case_DEFAULT,
/* 162 */ &&case_DEFAULT,
/* 163 */ &&case_DEFAULT,
/* 164 */ &&case_DEFAULT,
/* 165 */ &&case_DEFAULT,
/* 166 */ &&case_DEFAULT,
/* 167 */ &&case_DEFAULT,
/* 168 */ &&case_BCODE_POP_INTO_TEMPVAR_X,
/* 169 */ &&case_DEFAULT,
/* 170 */ &&case_DEFAULT,
/* 171 */ &&case_DEFAULT,
/* 172 */ &&case_DEFAULT,
/* 173 */ &&case_DEFAULT,
/* 174 */ &&case_DEFAULT,
/* 175 */ &&case_DEFAULT,
/* 176 */ &&case_BCODE_PUSH_LITERAL_X,
/* 177 */ &&case_DEFAULT,
/* 178 */ &&case_BCODE_PUSH_INTLIT,
/* 179 */ &&case_BCODE_PUSH_NEGINTLIT,
/* 180 */ &&case_BCODE_PUSH_CHARLIT,
/* 181 */ &&case_DEFAULT,
/* 182 */ &&case_DEFAULT,
/* 183 */ &&case_DEFAULT,
/* 184 */ &&case_BCODE_STORE_INTO_OBJECT_X,
/* 185 */ &&case_DEFAULT,
/* 186 */ &&case_DEFAULT,
/* 187 */ &&case_DEFAULT,
/* 188 */ &&case_BCODE_POP_INTO_OBJECT_X,
/* 189 */ &&case_DEFAULT,
/* 190 */ &&case_DEFAULT,
/* 191 */ &&case_DEFAULT,
/* 192 */ &&case_BCODE_PUSH_OBJECT_X,
/* 193 */ &&case_DEFAULT,
/* 194 */ &&case_DEFAULT,
/* 195 */ &&case_DEFAULT,
/* 196 */ &&case_BCODE_JUMP_FORWARD_X,
/* 197 */ &&case_BCODE_JUMP2_FORWARD,
/* 198 */ &&case_DEFAULT,
/* 199 */ &&case_DEFAULT,
/* 200 */ &&case_BCODE_JUMP_BACKWARD_X,
/* 201 */ &&case_BCODE_JUMP2_BACKWARD,
/* 202 */ &&case_DEFAULT,
/* 203 */ &&case_DEFAULT,
/* 204 */ &&case_BCODE_JUMP_BACKWARD_IF_FALSE_X,
/* 205 */ &&case_BCODE_JUMP2_BACKWARD_IF_FALSE,
/* 206 */ &&case_DEFAULT,
/* 207 */ &&case_DEFAULT,
/* 208 */ &&case_BCODE_JUMP_BACKWARD_IF_TRUE_X,
/* 209 */ &&case_BCODE_JUMP2_BACKWARD_IF_TRUE,
/* 210 */ &&case_DEFAULT,
/* 211 */ &&case_DEFAULT,
/* 212 */ &&case_BCODE_JUMP_FORWARD_IF_FALSE,
/* 213 */ &&case_BCODE_JUMP2_FORWARD_IF_FALSE,
/* 214 */ &&case_BCODE_JUMP_FORWARD_IF_TRUE,
/* 215 */ &&case_BCODE_JUMP2_FORWARD_IF_TRUE,
/* 216 */ &&case_BCODE_STORE_INTO_CTXTEMPVAR_X,
/* 217 */ &&case_DEFAULT,
/* 218 */ &&case_DEFAULT,
/* 219 */ &&case_DEFAULT,
/* 220 */ &&case_BCODE_POP_INTO_CTXTEMPVAR_X,
/* 221 */ &&case_DEFAULT,
/* 222 */ &&case_DEFAULT,
/* 223 */ &&case_DEFAULT,
/* 224 */ &&case_BCODE_PUSH_CTXTEMPVAR_X,
/* 225 */ &&case_DEFAULT,
/* 226 */ &&case_DEFAULT,
/* 227 */ &&case_DEFAULT,
/* 228 */ &&case_BCODE_PUSH_OBJVAR_X,
/* 229 */ &&case_DEFAULT,
/* 230 */ &&case_DEFAULT,
/* 231 */ &&case_DEFAULT,
/* 232 */ &&case_BCODE_STORE_INTO_OBJVAR_X,
/* 233 */ &&case_DEFAULT,
/* 234 */ &&case_DEFAULT,
/* 235 */ &&case_DEFAULT,
/* 236 */ &&case_BCODE_POP_INTO_OBJVAR_X,
/* 237 */ &&case_DEFAULT,
/* 238 */ &&case_DEFAULT,
/* 239 */ &&case_DEFAULT,
/* 240 */ &&case_BCODE_SEND_MESSAGE_X,
/* 241 */ &&case_DEFAULT,
/* 242 */ &&case_BCODE_MAKE_DICTIONARY,
/* 243 */ &&case_BCODE_POP_INTO_DICTIONARY,
/* 244 */ &&case_BCODE_SEND_MESSAGE_TO_SUPER_X,
/* 245 */ &&case_BCODE_MAKE_ARRAY,
/* 246 */ &&case_BCODE_POP_INTO_ARRAY,
/* 247 */ &&case_BCODE_DUP_STACKTOP,
/* 248 */ &&case_BCODE_POP_STACKTOP,
/* 249 */ &&case_BCODE_RETURN_STACKTOP,
/* 250 */ &&case_BCODE_RETURN_RECEIVER,
/* 251 */ &&case_BCODE_RETURN_FROM_BLOCK,
/* 252 */ &&case_BCODE_LOCAL_RETURN,
/* 253 */ &&case_BCODE_MAKE_BLOCK,
/* 254 */ &&case_BCODE_SEND_BLOCK_COPY,
/* 255 */ &&case_BCODE_NOOP

View File

@ -57,9 +57,6 @@
/* Define to 1 if you have the `closedir' function. */
#undef HAVE_CLOSEDIR
/* computed gotos */
#undef HAVE_COMPUTED_GOTO
/* Define to 1 if you have the `coshq' function. */
#undef HAVE_COSHQ
@ -133,6 +130,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* labels as values */
#undef HAVE_LABELS_AS_VALUES
/* Define if you have the libdl library or equivalent. */
#undef HAVE_LIBDL

View File

@ -748,10 +748,14 @@ struct moo_context_t
typedef struct moo_process_t moo_process_t;
typedef struct moo_process_t* moo_oop_process_t;
#define MOO_SEMAPHORE_NAMED_INSTVARS 9
#define MOO_SEMAPHORE_NAMED_INSTVARS 10
typedef struct moo_semaphore_t moo_semaphore_t;
typedef struct moo_semaphore_t* moo_oop_semaphore_t;
#define MOO_SEMAPHORE_GROUP_NAMED_INSTVARS 5
typedef struct moo_semaphore_group_t moo_semaphore_group_t;
typedef struct moo_semaphore_group_t* moo_oop_semaphore_group_t;
struct moo_process_t
{
MOO_OBJ_HEADER;
@ -774,7 +778,7 @@ struct moo_process_t
moo_oop_process_t next;
} sem_wait; /* links to use with a semaphore */
moo_oop_semaphore_t sem;
moo_oop_t sem; /* nil, semaphore, or semaphore group */
moo_oop_t perr; /* last error set by a primitive function */
moo_oop_t perrmsg;
@ -791,13 +795,14 @@ struct moo_semaphore_t
{
MOO_OBJ_HEADER;
moo_oop_t count; /* SmallInteger */
/* [IMPORTANT] make sure that the position of 'waiting' in moo_semaphore_t
* must be exactly the same as its position in moo_semaphore_group_t */
struct
{
moo_oop_process_t first;
moo_oop_process_t last;
} waiting; /* list of processes waiting on this semaphore */
moo_oop_t count; /* SmallInteger */
moo_oop_t heap_index; /* index to the heap */
moo_oop_t heap_ftime_sec; /* firing time */
@ -806,15 +811,24 @@ struct moo_semaphore_t
moo_oop_t io_index;
moo_oop_t io_handle;
moo_oop_t io_mask; /* SmallInteger */
moo_oop_semaphore_group_t group; /* nil or belonging semaphore group */
};
#define MOO_SEMAPHORE_GROUP_NAMED_INSTVARS 2
typedef struct moo_semaphore_group_t moo_semaphore_group_t;
typedef struct moo_semaphore_group_t* moo_oop_semaphore_group_t;
struct moo_semaphore_group_t
{
MOO_OBJ_HEADER;
/* [IMPORTANT] make sure that the position of 'waiting' in moo_semaphore_group_t
* must be exactly the same as its position in moo_semaphore_t */
struct
{
moo_oop_process_t first;
moo_oop_process_t last; /* list of processes waiting on this semaphore group */
} waiting;
moo_oop_t size; /* SmallInteger */
moo_oop_t pos; /* current processing position */
moo_oop_oop_t semarr; /* Array of Semaphores */
};