Compare commits

..

No commits in common. "ea73f9f8d2016983b28d18281eeb274c5c71c7b0" and "e37a6dcd05fae8e08373e0ff7b1bf54de01a58ef" have entirely different histories.

163 changed files with 57 additions and 127 deletions

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

View File

@ -166,35 +166,28 @@ class System(Apex)
// TODO: Do i have to protected this in an exception handler??? // TODO: Do i have to protected this in an exception handler???
//TODO: Execute Handler for signo. //TODO: Execute Handler for signo.
System logNl: "Interrupt detected - signal no - " & signo asString. System logNl: "Interrupt dectected - signal no - " & signo asString.
//System logNl: "WWWWWWWWWWWWWWWWWWWWWWWWW ".
// user-defined signal handler is not allowed for 16rFF // user-defined signal handler is not allowed for 16rFF
if (signo == 16rFF) { goto done }. if (signo == 16rFF) { goto done }.
//System logNl: "OHHHHHHHHHHHHHH ".
ifnot (self.shr isEmpty) ifnot (self.shr isEmpty)
{ {
//System logNl: "About to execute handler for the signal detected - " & signo asString.
self.shr do: [ :handler | handler value: signo ]. self.shr do: [ :handler | handler value: signo ].
} }
else else
{ {
//System logNl: "Jumping to done detected - signal no - " & signo asString.
if (signo == 2) { goto done }. if (signo == 2) { goto done }.
}. }.
}. }.
//System logNl: "Waiting for signal on os_intr_sem...".
os_intr_sem wait. os_intr_sem wait.
}. }.
done: done:
//System logNl: "Jumped to done detected - signal no - " & signo asString.
nil. nil.
] ]
ensure: [ ensure: [
| pid proc oldps | | pid proc oldps |
//System logNl: "Aborting signal handler......".
// stop subscribing to signals. // stop subscribing to signals.
os_intr_sem signal. os_intr_sem signal.
os_intr_sem unsignal. os_intr_sem unsignal.

View File

@ -28,10 +28,19 @@
#define DECODE_LOG_MASK (MOO_LOG_MNEMONIC | MOO_LOG_DEBUG) #define DECODE_LOG_MASK (MOO_LOG_MNEMONIC | MOO_LOG_DEBUG)
#define LOG_INST_0(moo,fmt) MOO_LOG1(moo, DECODE_LOG_MASK, " %06zd " fmt "\n", fetched_instruction_pointer) #if defined(MOO_BUILD_RELEASE)
#define LOG_INST_1(moo,fmt,a1) MOO_LOG2(moo, DECODE_LOG_MASK, " %06zd " fmt "\n", fetched_instruction_pointer, a1) /* get rid of instruction logging regardless of the log mask
#define LOG_INST_2(moo,fmt,a1,a2) MOO_LOG3(moo, DECODE_LOG_MASK, " %06zd " fmt "\n", fetched_instruction_pointer, a1, a2) * in the release build */
#define LOG_INST_3(moo,fmt,a1,a2,a3) MOO_LOG4(moo, DECODE_LOG_MASK, " %06zd " fmt "\n", fetched_instruction_pointer, a1, a2, a3) # define LOG_INST_0(moo,fmt)
# define LOG_INST_1(moo,fmt,a1)
# define LOG_INST_2(moo,fmt,a1,a2)
# define LOG_INST_3(moo,fmt,a1,a2,a3)
#else
# define LOG_INST_0(moo,fmt) MOO_LOG1(moo, DECODE_LOG_MASK, " %06zd " fmt "\n", fetched_instruction_pointer)
# define LOG_INST_1(moo,fmt,a1) MOO_LOG2(moo, DECODE_LOG_MASK, " %06zd " fmt "\n", fetched_instruction_pointer, a1)
# define LOG_INST_2(moo,fmt,a1,a2) MOO_LOG3(moo, DECODE_LOG_MASK, " %06zd " fmt "\n", fetched_instruction_pointer, a1, a2)
# define LOG_INST_3(moo,fmt,a1,a2,a3) MOO_LOG4(moo, DECODE_LOG_MASK, " %06zd " fmt "\n", fetched_instruction_pointer, a1, a2, a3)
#endif
#define FETCH_BYTE_CODE(moo) (cdptr[ip++]) #define FETCH_BYTE_CODE(moo) (cdptr[ip++])
#define FETCH_BYTE_CODE_TO(moo,v_oow) (v_oow = FETCH_BYTE_CODE(moo)) #define FETCH_BYTE_CODE_TO(moo,v_oow) (v_oow = FETCH_BYTE_CODE(moo))

View File

@ -135,7 +135,6 @@ static MOO_INLINE const char* proc_state_to_string (int state)
static int delete_sem_from_sem_io_tuple (moo_t* moo, moo_oop_semaphore_t sem, int force); static int delete_sem_from_sem_io_tuple (moo_t* moo, moo_oop_semaphore_t sem, int force);
static void signal_io_semaphore (moo_t* moo, moo_ooi_t io_handle, moo_ooi_t mask); static void signal_io_semaphore (moo_t* moo, moo_ooi_t io_handle, moo_ooi_t mask);
static void terminate_all_processes (moo_t* moo);
static int send_message (moo_t* moo, moo_oop_char_t selector, moo_ooi_t nargs, int to_super); static int send_message (moo_t* moo, moo_oop_char_t selector, moo_ooi_t nargs, int to_super);
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
@ -166,24 +165,6 @@ static MOO_INLINE void vm_cleanup (moo_t* moo)
/* TODO: clean up semaphores being waited on /* TODO: clean up semaphores being waited on
MOO_ASSERT (moo, moo->sem_io_wait_count == 0); */ MOO_ASSERT (moo, moo->sem_io_wait_count == 0); */
if (moo->processor->total_count != MOO_SMOOI_TO_OOP(0))
{
/* the stock kernel code is supposed to stop all processes.
* if the code reaches here, the kernel code must be buggy */
MOO_LOG3 (moo, MOO_LOG_WARN, "Warning - non-zero number of processes upon VM clean-up - total: %zd runnable: %zd suspended: %zd\n",
(moo_ooi_t)MOO_OOP_TO_SMOOI(moo->processor->total_count),
(moo_ooi_t)MOO_OOP_TO_SMOOI(moo->processor->runnable.count),
(moo_ooi_t)MOO_OOP_TO_SMOOI(moo->processor->suspended.count));
MOO_LOG0 (moo, MOO_LOG_WARN, "Warning - terminating all residue processes\n");
terminate_all_processes (moo);
}
MOO_ASSERT (moo, moo->processor->active == moo->nil_process);
MOO_ASSERT (moo, MOO_OOP_TO_SMOOI(moo->processor->total_count) == 0);
MOO_ASSERT (moo, MOO_OOP_TO_SMOOI(moo->processor->runnable.count) == 0);
MOO_ASSERT (moo, MOO_OOP_TO_SMOOI(moo->processor->suspended.count) == 0);
for (i = 0; i < moo->sem_io_map_capa;) for (i = 0; i < moo->sem_io_map_capa;)
{ {
moo_ooi_t sem_io_index; moo_ooi_t sem_io_index;
@ -797,22 +778,6 @@ static void terminate_process (moo_t* moo, moo_oop_process_t proc)
#endif #endif
} }
static void terminate_all_processes (moo_t* moo)
{
while (MOO_OOP_TO_SMOOI(moo->processor->suspended.count) > 0)
{
terminate_process (moo, moo->processor->suspended.first);
}
while (MOO_OOP_TO_SMOOI(moo->processor->runnable.count) > 0)
{
terminate_process (moo, moo->processor->runnable.first);
}
MOO_ASSERT (moo, MOO_OOP_TO_SMOOI(moo->processor->total_count) == 0);
MOO_ASSERT (moo, moo->processor->active == moo->nil_process);
}
static void resume_process (moo_t* moo, moo_oop_process_t proc) static void resume_process (moo_t* moo, moo_oop_process_t proc)
{ {
if (proc->state == MOO_SMOOI_TO_OOP(PROC_STATE_SUSPENDED)) if (proc->state == MOO_SMOOI_TO_OOP(PROC_STATE_SUSPENDED))
@ -1994,11 +1959,11 @@ void moo_clearmethodcache (moo_t* moo)
static int start_initial_process_and_context (moo_t* moo, const moo_oocs_t* objname, const moo_oocs_t* mthname) static int start_initial_process_and_context (moo_t* moo, const moo_oocs_t* objname, const moo_oocs_t* mthname)
{ {
/* the initial context is a fake context. if objname is 'Moo' and /* the initial context is a fake context. if objname is 'Stix' and
* mthname is 'main', this function emulates message sending 'Moo main'. * mthname is 'main', this function emulates message sending 'Stix main'.
* it should emulate the following logical byte-code sequences: * it should emulate the following logical byte-code sequences:
* *
* push Moo * push Stix
* send #main * send #main
*/ */
moo_oop_context_t ctx; moo_oop_context_t ctx;
@ -4903,7 +4868,7 @@ static int send_message (moo_t* moo, moo_oop_char_t selector, moo_ooi_t nargs, i
MOO_ASSERT (moo, MOO_OBJ_GET_FLAGS_TYPE(selector) == MOO_OBJ_TYPE_CHAR); MOO_ASSERT (moo, MOO_OBJ_GET_FLAGS_TYPE(selector) == MOO_OBJ_TYPE_CHAR);
MOO_ASSERT (moo, MOO_CLASSOF(moo, selector) == moo->_symbol); MOO_ASSERT (moo, MOO_CLASSOF(moo, selector) == moo->_symbol);
receiver = MOO_STACK_GETRCV(moo, nargs); receiver = MOO_STACK_GET(moo, moo->sp - nargs);
#if defined(MOO_PROFILE_VM) #if defined(MOO_PROFILE_VM)
moo->stat.message_sends++; moo->stat.message_sends++;

View File

@ -839,7 +839,7 @@ static int fmt_outv (moo_fmtout_t* fmtout, va_list ap)
/* zeropad must not take effect for 's' */ /* zeropad must not take effect for 's' */
if (flagc & FLAGC_ZEROPAD) padc = ' '; if (flagc & FLAGC_ZEROPAD) padc = ' ';
if (lm_flag & LF_H) goto lowercase_s; if (lm_flag & LF_H) goto lowercase_s;
#if defined(MOO_OOCH_IS_BCH) #if defined(MOO_OOCH_IS_UCH)
if (lm_flag & LF_J) goto lowercase_s; if (lm_flag & LF_J) goto lowercase_s;
#endif #endif
uppercase_s: uppercase_s:

View File

@ -1105,26 +1105,26 @@ struct moo_dbgi_method_t
enum moo_log_mask_t enum moo_log_mask_t
{ {
MOO_LOG_DEBUG = ((moo_bitmask_t)1 << 0), MOO_LOG_DEBUG = (1u << 0),
MOO_LOG_INFO = ((moo_bitmask_t)1 << 1), MOO_LOG_INFO = (1u << 1),
MOO_LOG_WARN = ((moo_bitmask_t)1 << 2), MOO_LOG_WARN = (1u << 2),
MOO_LOG_ERROR = ((moo_bitmask_t)1 << 3), MOO_LOG_ERROR = (1u << 3),
MOO_LOG_FATAL = ((moo_bitmask_t)1 << 4), MOO_LOG_FATAL = (1u << 4),
MOO_LOG_UNTYPED = ((moo_bitmask_t)1 << 6), /* only to be used by MOO_DEBUGx() and MOO_INFOx() */ MOO_LOG_UNTYPED = (1u << 6), /* only to be used by MOO_DEBUGx() and MOO_INFOx() */
MOO_LOG_COMPILER = ((moo_bitmask_t)1 << 7), MOO_LOG_COMPILER = (1u << 7),
MOO_LOG_VM = ((moo_bitmask_t)1 << 8), MOO_LOG_VM = (1u << 8),
MOO_LOG_MNEMONIC = ((moo_bitmask_t)1 << 9), /* bytecode mnemonic */ MOO_LOG_MNEMONIC = (1u << 9), /* bytecode mnemonic */
MOO_LOG_GC = ((moo_bitmask_t)1 << 10), MOO_LOG_GC = (1u << 10),
MOO_LOG_IC = ((moo_bitmask_t)1 << 11), /* instruction cycle, fetch-decode-execute */ MOO_LOG_IC = (1u << 11), /* instruction cycle, fetch-decode-execute */
MOO_LOG_PRIMITIVE = ((moo_bitmask_t)1 << 12), MOO_LOG_PRIMITIVE = (1u << 12),
MOO_LOG_APP = ((moo_bitmask_t)1 << 13), /* moo applications, set by moo logging primitive */ MOO_LOG_APP = (1u << 13), /* moo applications, set by moo logging primitive */
MOO_LOG_ALL_LEVELS = (MOO_LOG_DEBUG | MOO_LOG_INFO | MOO_LOG_WARN | MOO_LOG_ERROR | MOO_LOG_FATAL), MOO_LOG_ALL_LEVELS = (MOO_LOG_DEBUG | MOO_LOG_INFO | MOO_LOG_WARN | MOO_LOG_ERROR | MOO_LOG_FATAL),
MOO_LOG_ALL_TYPES = (MOO_LOG_UNTYPED | MOO_LOG_COMPILER | MOO_LOG_VM | MOO_LOG_MNEMONIC | MOO_LOG_GC | MOO_LOG_IC | MOO_LOG_PRIMITIVE | MOO_LOG_APP), MOO_LOG_ALL_TYPES = (MOO_LOG_UNTYPED | MOO_LOG_COMPILER | MOO_LOG_VM | MOO_LOG_MNEMONIC | MOO_LOG_GC | MOO_LOG_IC | MOO_LOG_PRIMITIVE | MOO_LOG_APP),
MOO_LOG_STDOUT = ((moo_bitmask_t)1 << 14), /* write log messages to stdout without timestamp. MOO_LOG_STDOUT wins over MOO_LOG_STDERR. */ MOO_LOG_STDOUT = (1u << 14), /* write log messages to stdout without timestamp. MOO_LOG_STDOUT wins over MOO_LOG_STDERR. */
MOO_LOG_STDERR = ((moo_bitmask_t)1 << 15) /* write log messages to stderr without timestamp. */ MOO_LOG_STDERR = (1u << 15) /* write log messages to stderr without timestamp. */
}; };
typedef enum moo_log_mask_t moo_log_mask_t; typedef enum moo_log_mask_t moo_log_mask_t;

View File

@ -24,10 +24,7 @@
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#if defined(__GNUC__)
#if defined(__GNUC__) && (__GNUC__ >= 4)
# pragma pack(push,1)
#elif defined(__GNUC__)
# pragma pack(1) # pragma pack(1)
#elif defined(__HP_aCC) || defined(__HP_cc) #elif defined(__HP_aCC) || defined(__HP_cc)
# pragma PACK 1 # pragma PACK 1

Some files were not shown because too many files have changed in this diff Show More