wrote more code for process handling and return handling

This commit is contained in:
hyunghwan.chung
2016-02-15 18:07:20 +00:00
parent df226a4790
commit 9edf849d2a
5 changed files with 162 additions and 53 deletions

View File

@ -83,7 +83,10 @@ enum stix_trait_t
{
/* perform no garbage collection when the heap is full.
* you still can use stix_gc() explicitly. */
STIX_NOGC = (1 << 0)
STIX_NOGC = (1 << 0),
/* wait for running process when exiting from the main method */
STIX_AWAIT_PROCS = (1 << 1),
};
typedef enum stix_trait_t stix_trait_t;
@ -492,35 +495,35 @@ struct stix_context_t
* is activated as a result of normal message sending and a block
* context is activated when it is sent 'value'. it's set to
* nil if a block context created hasn't received 'value'. */
stix_oop_t sender;
stix_oop_context_t sender;
/* SmallInteger, instruction pointer */
stix_oop_t ip;
stix_oop_t ip;
/* SmallInteger, stack pointer */
stix_oop_t sp;
stix_oop_t sp;
/* SmallInteger. Number of temporaries.
* For a block context, it's inclusive of the temporaries
* defined its 'home'. */
stix_oop_t ntmprs;
stix_oop_t ntmprs;
/* CompiledMethod for a method context,
* SmallInteger for a block context */
stix_oop_t method_or_nargs;
stix_oop_t method_or_nargs;
/* it points to the receiver of the message for a method context.
* a base block context(created but not yet activated) has nil in this
* field. if a block context is activated by 'value', it points
* to the block context object used as a base for shallow-copy. */
stix_oop_t receiver_or_source;
stix_oop_t receiver_or_source;
/* it is set to nil for a method context.
* for a block context, it points to the active context at the
* moment the block context was created. that is, it points to
* a method context where the base block has been defined.
* an activated block context copies this field from the source. */
stix_oop_t home;
stix_oop_t home;
/* when a method context is created, it is set to itself. no change is
* made when the method context is activated. when a block context is
@ -528,10 +531,10 @@ struct stix_context_t
* origin of the active context. when the block context is shallow-copied
* for activation (when it is sent 'value'), it is set to the origin of
* the source block context. */
stix_oop_context_t origin;
stix_oop_context_t origin;
/* variable indexed part */
stix_oop_t slot[1]; /* stack */
stix_oop_t slot[1]; /* stack */
};
#define STIX_PROCESS_NAMED_INSTVARS 6
@ -541,7 +544,7 @@ struct stix_process_t
{
STIX_OBJ_HEADER;
stix_oop_context_t initial_context;
stix_oop_context_t active_context;
stix_oop_context_t suspended_context;
stix_oop_t state; /* SmallInteger */
stix_oop_process_t prev;
stix_oop_process_t next;