fixed some minor build flaws
This commit is contained in:
		| @ -297,3 +297,23 @@ | |||||||
| 		self class cannotInstantiate | 		self class cannotInstantiate | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | #class Object(Apex) | ||||||
|  | { | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #class UndefinedObject(Apex) | ||||||
|  | { | ||||||
|  | 	#method isNil | ||||||
|  | 	{ | ||||||
|  | 		^true | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	#method notNil | ||||||
|  | 	{ | ||||||
|  | 		^false. | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,63 +0,0 @@ | |||||||
| #class(#pointer) Array(Collection) |  | ||||||
| { |  | ||||||
| 	#method size |  | ||||||
| 	{ |  | ||||||
| 		^self basicSize. |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	#method ubound |  | ||||||
| 	{ |  | ||||||
| 		^(self basicSize - 1). |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	#method at: anInteger |  | ||||||
| 	{ |  | ||||||
| 		^self basicAt: anInteger. |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	#method at: anInteger put: aValue |  | ||||||
| 	{ |  | ||||||
| 		^self basicAt: anInteger put: aValue. |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	#method first |  | ||||||
| 	{ |  | ||||||
| 		^self at: 0. |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	#method last |  | ||||||
| 	{ |  | ||||||
| 		^self at: (self ubound). |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	#method do: aBlock |  | ||||||
| 	{ |  | ||||||
| 		0 to: (self ubound) do: [:i | aBlock value: (self at: i)]. |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	#method copy: anArray |  | ||||||
| 	{ |  | ||||||
| 		0 to: (anArray ubound) do: [:i | self at: i put: (anArray at: i) ]. |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #class(#character) String(Array) |  | ||||||
| { |  | ||||||
| 	#method , aString |  | ||||||
| 	{ |  | ||||||
| 		## concatenate two strings. |  | ||||||
| ## TOOD: make this a primitive for performance. |  | ||||||
| 		| newsize newstr self_ubound| |  | ||||||
| 		newsize := self basicSize + aString basicSize. |  | ||||||
| 		##newstr := self class basicNew: newsize. |  | ||||||
| 		newstr := String basicNew: newsize.  ## TODO: redefine , for symbol... it's a work arouind... symbols are not contacated to a symbol at this moment. |  | ||||||
| 		self_ubound := self ubound. |  | ||||||
| 		0 to: self_ubound do: [:i | newstr at: i put: (self at: i)]. |  | ||||||
| 		0 to: (aString ubound) do: [:i | newstr at: (i + self_ubound + 1) put: (aString at: i)]. |  | ||||||
| 		^newstr |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #class(#character) Symbol(String) |  | ||||||
| { |  | ||||||
| } |  | ||||||
| @ -1,13 +0,0 @@ | |||||||
| #class(#byte) ByteArray(Collection) |  | ||||||
| { |  | ||||||
| 	#method at: anInteger |  | ||||||
| 	{ |  | ||||||
| 		^self basicAt: anInteger. |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	#method at: anInteger put: aValue |  | ||||||
| 	{ |  | ||||||
| 		^self basicAt: anInteger put: aValue. |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @ -1,31 +0,0 @@ | |||||||
| #class Set(Collection) |  | ||||||
| { |  | ||||||
| 	#dcl tally bucket. |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #class SymbolSet(Set) |  | ||||||
| { |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #class Dictionary(Set) |  | ||||||
| { |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #class SystemDictionary(Dictionary) |  | ||||||
| { |  | ||||||
| } |  | ||||||
|  |  | ||||||
|  |  | ||||||
| #class Namespace(Set) |  | ||||||
| { |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #class PoolDictionary(Set) |  | ||||||
| { |  | ||||||
| } |  | ||||||
|  |  | ||||||
| #class MethodDictionary(Dictionary) |  | ||||||
| { |  | ||||||
|  |  | ||||||
| } |  | ||||||
|  |  | ||||||
| @ -1,3 +1,122 @@ | |||||||
| #class Collection(Object) | #class Collection(Object) | ||||||
| { | { | ||||||
| } | } | ||||||
|  |  | ||||||
|  | ## ------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | #class(#pointer) Array(Collection) | ||||||
|  | { | ||||||
|  | 	#method size | ||||||
|  | 	{ | ||||||
|  | 		^self basicSize. | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	#method ubound | ||||||
|  | 	{ | ||||||
|  | 		^(self basicSize - 1). | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	#method at: anInteger | ||||||
|  | 	{ | ||||||
|  | 		^self basicAt: anInteger. | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	#method at: anInteger put: aValue | ||||||
|  | 	{ | ||||||
|  | 		^self basicAt: anInteger put: aValue. | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	#method first | ||||||
|  | 	{ | ||||||
|  | 		^self at: 0. | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	#method last | ||||||
|  | 	{ | ||||||
|  | 		^self at: (self ubound). | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	#method do: aBlock | ||||||
|  | 	{ | ||||||
|  | 		0 to: (self ubound) do: [:i | aBlock value: (self at: i)]. | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	#method copy: anArray | ||||||
|  | 	{ | ||||||
|  | 		0 to: (anArray ubound) do: [:i | self at: i put: (anArray at: i) ]. | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | ## ------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | #class(#character) String(Array) | ||||||
|  | { | ||||||
|  | 	#method , aString | ||||||
|  | 	{ | ||||||
|  | 		## concatenate two strings. | ||||||
|  | ## TOOD: make this a primitive for performance. | ||||||
|  | 		| newsize newstr self_ubound| | ||||||
|  | 		newsize := self basicSize + aString basicSize. | ||||||
|  | 		##newstr := self class basicNew: newsize. | ||||||
|  | 		newstr := String basicNew: newsize.  ## TODO: redefine , for symbol... it's a work arouind... symbols are not contacated to a symbol at this moment. | ||||||
|  | 		self_ubound := self ubound. | ||||||
|  | 		0 to: self_ubound do: [:i | newstr at: i put: (self at: i)]. | ||||||
|  | 		0 to: (aString ubound) do: [:i | newstr at: (i + self_ubound + 1) put: (aString at: i)]. | ||||||
|  | 		^newstr | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | ## ------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | #class(#character) Symbol(String) | ||||||
|  | { | ||||||
|  | } | ||||||
|  |  | ||||||
|  | ## ------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | #class(#byte) ByteArray(Collection) | ||||||
|  | { | ||||||
|  | 	#method at: anInteger | ||||||
|  | 	{ | ||||||
|  | 		^self basicAt: anInteger. | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	#method at: anInteger put: aValue | ||||||
|  | 	{ | ||||||
|  | 		^self basicAt: anInteger put: aValue. | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | ## ------------------------------------------------------------------------------- | ||||||
|  |  | ||||||
|  | #class Set(Collection) | ||||||
|  | { | ||||||
|  | 	#dcl tally bucket. | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #class SymbolSet(Set) | ||||||
|  | { | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #class Dictionary(Set) | ||||||
|  | { | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #class SystemDictionary(Dictionary) | ||||||
|  | { | ||||||
|  | } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #class Namespace(Set) | ||||||
|  | { | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #class PoolDictionary(Set) | ||||||
|  | { | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #class MethodDictionary(Dictionary) | ||||||
|  | { | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | |||||||
| @ -1,4 +0,0 @@ | |||||||
| #class Object(Apex) |  | ||||||
| { |  | ||||||
|  |  | ||||||
| } |  | ||||||
| @ -1,6 +1,4 @@ | |||||||
| #include 'Apex.st'. | #include 'Apex.st'. | ||||||
| #include 'Object.st'. |  | ||||||
| #include 'UndefinedObject.st'. |  | ||||||
| #include 'Class.st'. | #include 'Class.st'. | ||||||
| #include 'Boolean.st'. | #include 'Boolean.st'. | ||||||
|  |  | ||||||
| @ -249,9 +247,7 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| #include 'Collection.st'. | #include 'Collection.st'. | ||||||
| #include 'Collection-ByteArray.st'. | ## #include 'Collec~1.st'. | ||||||
| #include 'Collection-Array.st'. |  | ||||||
| #include 'Collection-Set.st'. |  | ||||||
|  |  | ||||||
| #class(#pointer) CompiledMethod(Object) | #class(#pointer) CompiledMethod(Object) | ||||||
| { | { | ||||||
|  | |||||||
| @ -1,12 +0,0 @@ | |||||||
| #class UndefinedObject(Apex) |  | ||||||
| { |  | ||||||
| 	#method isNil |  | ||||||
| 	{ |  | ||||||
| 		^true |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	#method notNil |  | ||||||
| 	{ |  | ||||||
| 		^false. |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
| @ -26,18 +26,21 @@ | |||||||
|  |  | ||||||
| #include "stix-prv.h" | #include "stix-prv.h" | ||||||
|  |  | ||||||
| /* TODO: remove this header after having changed clock_gettime() to a  |  | ||||||
|  *       platform independent function */ |  | ||||||
| #if defined(HAVE_TIME_H) |  | ||||||
| #	include <time.h> |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #if defined(HAVE_SYS_TIME_H) |  | ||||||
| #	include <sys/time.h> |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #if defined(_WIN32) | #if defined(_WIN32) | ||||||
| #	include <windows.h> | #	include <windows.h> | ||||||
|  | #elif defined(__MSDOS__) | ||||||
|  | #	include <time.h> | ||||||
|  | #else | ||||||
|  | 	/* TODO: remove this header after having changed clock_gettime() to a  | ||||||
|  | 	 *       platform independent function */ | ||||||
|  | #	if defined(HAVE_TIME_H) | ||||||
|  | #		include <time.h> | ||||||
|  | #	endif | ||||||
|  |  | ||||||
|  | #	if defined(HAVE_SYS_TIME_H) | ||||||
|  | #		include <sys/time.h> | ||||||
|  | #	endif | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #define PROC_STATE_RUNNING 3 | #define PROC_STATE_RUNNING 3 | ||||||
| @ -189,7 +192,24 @@ static void vm_cleanup (stix_t* stix) | |||||||
|  |  | ||||||
| static STIX_INLINE void vm_gettime (stix_t* stix, stix_ntime_t* now) | static STIX_INLINE void vm_gettime (stix_t* stix, stix_ntime_t* now) | ||||||
| { | { | ||||||
| #if defined(HAVE_CLOCK_GETTIME) | #if defined(__MSDOS__) && defined(_INTELC32_) | ||||||
|  | 	clock_t c; | ||||||
|  |  | ||||||
|  | /* TODO: handle overflow?? */ | ||||||
|  | 	c = clock (); | ||||||
|  | 	now->sec = c / CLOCKS_PER_SEC; | ||||||
|  | 	#if (CLOCKS_PER_SEC == 1000) | ||||||
|  | 		now->nsec = STIX_MSEC_TO_NSEC(c % CLOCKS_PER_SEC); | ||||||
|  | 	#elif (CLOCKS_PER_SEC == 1000000L) | ||||||
|  | 		now->nsec = STIX_USEC_TO_NSEC(c % CLOCKS_PER_SEC); | ||||||
|  | 	#elif (CLOCKS_PER_SEC == 1000000000L) | ||||||
|  | 		now->nsec = (c % CLOCKS_PER_SEC); | ||||||
|  | 	#else | ||||||
|  | 	#	error UNSUPPORTED CLOCKS_PER_SEC | ||||||
|  | 	#endif | ||||||
|  | printf ("%05ld %010ld\n", (long)now->sec, (long)now->nsec); | ||||||
|  |  | ||||||
|  | #elif defined(HAVE_CLOCK_GETTIME) | ||||||
| 	struct timespec ts; | 	struct timespec ts; | ||||||
| 	#if defined(CLOCK_MONOTONIC) | 	#if defined(CLOCK_MONOTONIC) | ||||||
| 	clock_gettime (CLOCK_MONOTONIC, &ts); | 	clock_gettime (CLOCK_MONOTONIC, &ts); | ||||||
| @ -221,6 +241,26 @@ static STIX_INLINE void vm_sleep (stix_t* stix, const stix_ntime_t* dur) | |||||||
| 		Sleep (STIX_SECNSEC_TO_MSEC(dur->sec,dur->nsec)); | 		Sleep (STIX_SECNSEC_TO_MSEC(dur->sec,dur->nsec)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | #elif defined(__MSDOS__) && defined(_INTELC32_) | ||||||
|  |  | ||||||
|  | 	clock_t c; | ||||||
|  |  | ||||||
|  | 	c = clock (); | ||||||
|  | 	c += dur->sec * CLOCKS_PER_SEC; | ||||||
|  | 	#if (CLOCKS_PER_SEC == 1000) | ||||||
|  | 		c += STIX_NSEC_TO_MSEC(dur->nsec); | ||||||
|  | 	#elif (CLOCKS_PER_SEC == 1000000L) | ||||||
|  | 		c += STIX_NSEC_TO_USEC(dur->nsec); | ||||||
|  | 	#elif (CLOCKS_PER_SEC == 1000000000L) | ||||||
|  | 		c += dur->nsec; | ||||||
|  | 	#else | ||||||
|  | 	#	error UNSUPPORTED CLOCKS_PER_SEC | ||||||
|  | 	#endif | ||||||
|  |  | ||||||
|  | /* TODO: handle clock overvlow */ | ||||||
|  | /* TODO: check if there is abortion request or interrupt */ | ||||||
|  | 	while (c > clock()) ; | ||||||
|  |  | ||||||
| #else | #else | ||||||
| 	struct timespec ts; | 	struct timespec ts; | ||||||
| 	ts.tv_sec = dur->sec; | 	ts.tv_sec = dur->sec; | ||||||
| @ -495,7 +535,7 @@ static void resume_process (stix_t* stix, stix_oop_process_t proc) | |||||||
| 	{ | 	{ | ||||||
| 		/* SUSPENED ---> RUNNING */ | 		/* SUSPENED ---> RUNNING */ | ||||||
|  |  | ||||||
| //printf ("TO RESUME PROCESS = %p %d SUSPENED ----> RUNNING\n", proc, (int)STIX_OOP_TO_SMOOI(proc->state)); | /*printf ("TO RESUME PROCESS = %p %d SUSPENED ----> RUNNING\n", proc, (int)STIX_OOP_TO_SMOOI(proc->state));*/ | ||||||
| 		STIX_ASSERT ((stix_oop_t)proc->prev == stix->_nil); | 		STIX_ASSERT ((stix_oop_t)proc->prev == stix->_nil); | ||||||
| 		STIX_ASSERT ((stix_oop_t)proc->next == stix->_nil); | 		STIX_ASSERT ((stix_oop_t)proc->next == stix->_nil); | ||||||
|  |  | ||||||
| @ -530,11 +570,11 @@ static void suspend_process (stix_t* stix, stix_oop_process_t proc) | |||||||
|  |  | ||||||
| 			nrp = find_next_runnable_process (stix); | 			nrp = find_next_runnable_process (stix); | ||||||
|  |  | ||||||
| //printf ("TO SUSPEND...%p %d\n", proc, (int)STIX_OOP_TO_SMOOI(proc->state)); | /*printf ("TO SUSPEND...%p %d\n", proc, (int)STIX_OOP_TO_SMOOI(proc->state));*/ | ||||||
| 			if (nrp == proc) | 			if (nrp == proc) | ||||||
| 			{ | 			{ | ||||||
| 				/* no runnable process after suspension */ | 				/* no runnable process after suspension */ | ||||||
| //printf ("NO RUNNABLE PROCESS AFTER SUPSENDISION\n"); | /*printf ("NO RUNNABLE PROCESS AFTER SUPSENDISION\n");*/ | ||||||
| 				sleep_active_process (stix, PROC_STATE_RUNNABLE); | 				sleep_active_process (stix, PROC_STATE_RUNNABLE); | ||||||
| 				unchain_from_processor (stix, proc, PROC_STATE_SUSPENDED); | 				unchain_from_processor (stix, proc, PROC_STATE_SUSPENDED); | ||||||
|  |  | ||||||
| @ -545,7 +585,7 @@ static void suspend_process (stix_t* stix, stix_oop_process_t proc) | |||||||
| 			} | 			} | ||||||
| 			else | 			else | ||||||
| 			{ | 			{ | ||||||
| //printf ("SWITCHING TO XXXXXXXXXXXXXXXXXXXXx\n"); | /*printf ("SWITCHING TO XXXXXXXXXXXXXXXXXXXXx\n");*/ | ||||||
| 				/* keep the unchained process at the runnable state for | 				/* keep the unchained process at the runnable state for | ||||||
| 				 * the immediate call to switch_to_process() below */ | 				 * the immediate call to switch_to_process() below */ | ||||||
| 				unchain_from_processor (stix, proc, PROC_STATE_RUNNABLE); | 				unchain_from_processor (stix, proc, PROC_STATE_RUNNABLE); | ||||||
| @ -617,7 +657,7 @@ static stix_oop_process_t signal_semaphore (stix_t* stix, stix_oop_semaphore_t s | |||||||
|  |  | ||||||
| 	if ((stix_oop_t)sem->waiting_head == stix->_nil) | 	if ((stix_oop_t)sem->waiting_head == stix->_nil) | ||||||
| 	{ | 	{ | ||||||
| //printf ("signal semaphore...1111\n"); | /*printf ("signal semaphore...1111\n");*/ | ||||||
| 		/* no process is waiting on this semaphore */ | 		/* no process is waiting on this semaphore */ | ||||||
| 		count = STIX_OOP_TO_SMOOI(sem->count); | 		count = STIX_OOP_TO_SMOOI(sem->count); | ||||||
| 		count++; | 		count++; | ||||||
| @ -634,7 +674,7 @@ static stix_oop_process_t signal_semaphore (stix_t* stix, stix_oop_semaphore_t s | |||||||
|  |  | ||||||
| 		unchain_from_semaphore (stix, proc); | 		unchain_from_semaphore (stix, proc); | ||||||
| 		resume_process (stix, proc); /* TODO: error check */ | 		resume_process (stix, proc); /* TODO: error check */ | ||||||
| //printf ("signal semaphore...2222 DONE -> resumed process -> proc state %d\n", (int)STIX_OOP_TO_SMOOI(proc->state)); | /*printf ("signal semaphore...2222 DONE -> resumed process -> proc state %d\n", (int)STIX_OOP_TO_SMOOI(proc->state));*/ | ||||||
|  |  | ||||||
| 		/* return the resumed process */ | 		/* return the resumed process */ | ||||||
| 		return proc; | 		return proc; | ||||||
| @ -652,14 +692,14 @@ static void await_semaphore (stix_t* stix, stix_oop_semaphore_t sem) | |||||||
| 		/* it's already signalled */ | 		/* it's already signalled */ | ||||||
| 		count--; | 		count--; | ||||||
| 		sem->count = STIX_SMOOI_TO_OOP(count); | 		sem->count = STIX_SMOOI_TO_OOP(count); | ||||||
| //printf (">>>>>>>>>>>>>> AWAIT SEMAPHORE - NO SUSPENDING ...................\n"); | /*printf (">>>>>>>>>>>>>> AWAIT SEMAPHORE - NO SUSPENDING ...................\n");*/ | ||||||
| 	} | 	} | ||||||
| 	else | 	else | ||||||
| 	{ | 	{ | ||||||
| 		/* not signaled. need to wait */ | 		/* not signaled. need to wait */ | ||||||
| 		proc = stix->processor->active; | 		proc = stix->processor->active; | ||||||
|  |  | ||||||
| //printf (">>>>>>>>>>>>>> AWAIT SEMAPHORE - SUEPENDING ACTIVE PROCESS..........state=>[%d].....PROC %p\n", (int)STIX_OOP_TO_SMOOI(proc->state), proc); | /*printf (">>>>>>>>>>>>>> AWAIT SEMAPHORE - SUEPENDING ACTIVE PROCESS..........state=>[%d].....PROC %p\n", (int)STIX_OOP_TO_SMOOI(proc->state), proc);*/ | ||||||
| 		/* suspend the active process */ | 		/* suspend the active process */ | ||||||
| 		suspend_process (stix, proc);  | 		suspend_process (stix, proc);  | ||||||
|  |  | ||||||
| @ -668,7 +708,7 @@ static void await_semaphore (stix_t* stix, stix_oop_semaphore_t sem) | |||||||
|  |  | ||||||
| 		STIX_ASSERT (sem->waiting_tail == proc); | 		STIX_ASSERT (sem->waiting_tail == proc); | ||||||
|  |  | ||||||
| //printf (">>>>>>>>>>>>>> AWAIT SEMAPHORE - SUEPENDING ACTIVE PROCESS....XX......state=>[%d]..PROC %p\n", (int)STIX_OOP_TO_SMOOI(proc->state), proc); | /*printf (">>>>>>>>>>>>>> AWAIT SEMAPHORE - SUEPENDING ACTIVE PROCESS....XX......state=>[%d]..PROC %p\n", (int)STIX_OOP_TO_SMOOI(proc->state), proc);*/ | ||||||
| 		STIX_ASSERT (stix->processor->active != proc); | 		STIX_ASSERT (stix->processor->active != proc); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| @ -1824,12 +1864,12 @@ static int prim_processor_add_timed_semaphore (stix_t* stix, stix_ooi_t nargs) | |||||||
| /* TODO: make clock_gettime to be platform independent  | /* TODO: make clock_gettime to be platform independent  | ||||||
|  *  |  *  | ||||||
|  * this code assumes that the monotonic clock returns a small value |  * this code assumes that the monotonic clock returns a small value | ||||||
|  * that can fit into a small integer, even after some addtions... */ |  * that can fit into a SmallInteger, even after some addtions... */ | ||||||
| 	vm_gettime (stix, &now); | 	vm_gettime (stix, &now); | ||||||
| 	STIX_ADDNTIMESNS (&ft, &now, STIX_OOP_TO_SMOOI(sec), STIX_OOP_TO_SMOOI(nsec)); | 	STIX_ADDNTIMESNS (&ft, &now, STIX_OOP_TO_SMOOI(sec), STIX_OOP_TO_SMOOI(nsec)); | ||||||
| 	if (ft.sec < 0 || ft.sec > STIX_SMOOI_MAX)  | 	if (ft.sec < 0 || ft.sec > STIX_SMOOI_MAX)  | ||||||
| 	{ | 	{ | ||||||
| 		/* soft error - cannot represent the e:xpiry time in | 		/* soft error - cannot represent the exxpiry time in | ||||||
| 		 *              a small integer. */ | 		 *              a small integer. */ | ||||||
| 		return 0; | 		return 0; | ||||||
| 	} | 	} | ||||||
| @ -3805,7 +3845,7 @@ printf (">>>>>>>>>>>>>>>> METHOD RETURN FROM WITHIN A BLOCK. NON-LOCAL RETURN.. | |||||||
| 					{ | 					{ | ||||||
| 						/* the sender of the intial context is nil. | 						/* the sender of the intial context is nil. | ||||||
| 						 * use this fact to tell an initial context from a normal context. */ | 						 * use this fact to tell an initial context from a normal context. */ | ||||||
| 						STIX_ASSERT (stix->active_context->receiver_or_source == stix->_nil); | 		/*				STIX_ASSERT (stix->active_context->receiver_or_source == stix->_nil);*/ | ||||||
|  |  | ||||||
| 						/* when sender is nil, the following condition must be true. | 						/* when sender is nil, the following condition must be true. | ||||||
| 						 * but it's not always true the other way around */ | 						 * but it's not always true the other way around */ | ||||||
|  | |||||||
| @ -65,7 +65,7 @@ void* stix_allocheapmem (stix_t* stix, stix_heap_t* heap, stix_oow_t size) | |||||||
| { | { | ||||||
| 	stix_uint8_t* ptr; | 	stix_uint8_t* ptr; | ||||||
|  |  | ||||||
| //printf ("heap ptr %p  %p %lld %lld\n", heap->ptr, heap->limit, (long long int)size, (long long int)(heap->limit - heap->ptr)); | /*printf ("heap ptr %p  %p %lld %lld\n", heap->ptr, heap->limit, (long long int)size, (long long int)(heap->limit - heap->ptr));*/ | ||||||
| 	/* check the heap size limit */ | 	/* check the heap size limit */ | ||||||
| 	if (heap->ptr >= heap->limit || heap->limit - heap->ptr < size) | 	if (heap->ptr >= heap->limit || heap->limit - heap->ptr < size) | ||||||
| 	{ | 	{ | ||||||
|  | |||||||
| @ -611,6 +611,11 @@ struct stix_cmgr_t | |||||||
| /* ========================================================================= | /* ========================================================================= | ||||||
|  * COMPILER FEATURE TEST MACROS |  * COMPILER FEATURE TEST MACROS | ||||||
|  * =========================================================================*/ |  * =========================================================================*/ | ||||||
|  | #if defined(_INTELC32_) && !defined(__has_builtin) | ||||||
|  | 	/* intel c code builder 1.0 ended up with an error without this override */ | ||||||
|  | 	#define __has_builtin(x) 0 | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #if defined(__has_builtin)  | #if defined(__has_builtin)  | ||||||
| 	#if __has_builtin(__builtin_ctz) | 	#if __has_builtin(__builtin_ctz) | ||||||
| 		#define STIX_HAVE_BUILTIN_CTZ | 		#define STIX_HAVE_BUILTIN_CTZ | ||||||
|  | |||||||
| @ -134,6 +134,33 @@ | |||||||
| #	define STIX_SIZEOF_MBSTATE_T   STIX_SIZEOF_LONG | #	define STIX_SIZEOF_MBSTATE_T   STIX_SIZEOF_LONG | ||||||
| #	define STIX_MBLEN_MAX          8 | #	define STIX_MBLEN_MAX          8 | ||||||
|  |  | ||||||
|  | #elif defined(_INTELC32_) | ||||||
|  |  | ||||||
|  | 	/* Intel C Code Builder 1.0 */ | ||||||
|  | #	define STIX_SIZEOF_CHAR        1 | ||||||
|  | #	define STIX_SIZEOF_SHORT       2 | ||||||
|  | #	define STIX_SIZEOF_INT         4 | ||||||
|  | #	define STIX_SIZEOF_LONG        4 | ||||||
|  | #	define STIX_SIZEOF_LONG_LONG   0 | ||||||
|  |  | ||||||
|  | #	define STIX_SIZEOF_VOID_P      4 | ||||||
|  | #	define STIX_SIZEOF_FLOAT       4 | ||||||
|  | #	define STIX_SIZEOF_DOUBLE      8 | ||||||
|  | #	define STIX_SIZEOF_LONG_DOUBLE 8 | ||||||
|  | #	define STIX_SIZEOF_WCHAR_T     1 | ||||||
|  |  | ||||||
|  | #	define STIX_SIZEOF___INT8      0 | ||||||
|  | #	define STIX_SIZEOF___INT16     0 | ||||||
|  | #	define STIX_SIZEOF___INT32     0 | ||||||
|  | #	define STIX_SIZEOF___INT64     0 | ||||||
|  | #	define STIX_SIZEOF___INT128    0 | ||||||
|  |  | ||||||
|  | #	define STIX_SIZEOF_OFF64_T     0 | ||||||
|  | #	define STIX_SIZEOF_OFF_T       4 | ||||||
|  |  | ||||||
|  | #	define STIX_SIZEOF_MBSTATE_T   STIX_SIZEOF_LONG | ||||||
|  | #	define STIX_MBLEN_MAX          8 | ||||||
|  |  | ||||||
| #else | #else | ||||||
| #	error Define the size of various data types. | #	error Define the size of various data types. | ||||||
| #endif | #endif | ||||||
|  | |||||||
| @ -54,7 +54,7 @@ | |||||||
|  |  | ||||||
| /* this is for gc debugging */ | /* this is for gc debugging */ | ||||||
| /*#define STIX_DEBUG_PROCESSOR*/ | /*#define STIX_DEBUG_PROCESSOR*/ | ||||||
| #define STIX_DEBUG_GC_001 | /*#define STIX_DEBUG_GC_001*/ | ||||||
| /*#define STIX_DEBUG_GC_002*/ | /*#define STIX_DEBUG_GC_002*/ | ||||||
| #define STIX_DEBUG_COMP_001 | #define STIX_DEBUG_COMP_001 | ||||||
| /*#define STIX_DEBUG_COMP_002*/ | /*#define STIX_DEBUG_COMP_002*/ | ||||||
| @ -96,14 +96,12 @@ | |||||||
| #	else | #	else | ||||||
| #		define STIX_MEMCMP(dst,src,size)  memcmp(dst,src,size) | #		define STIX_MEMCMP(dst,src,size)  memcmp(dst,src,size) | ||||||
| #	endif | #	endif | ||||||
|  |  | ||||||
| #elif defined(__GNUC__) && (__GNUC__  >= 3 || (defined(__GNUC_MINOR) && __GNUC__ == 2 && __GNUC_MINOR__ >= 91)) | #elif defined(__GNUC__) && (__GNUC__  >= 3 || (defined(__GNUC_MINOR) && __GNUC__ == 2 && __GNUC_MINOR__ >= 91)) | ||||||
| 	/* gcc 2.91 or higher */ | 	/* gcc 2.91 or higher */ | ||||||
| #	define STIX_MEMSET(dst,src,size)  __builtin_memset(dst,src,size) | #	define STIX_MEMSET(dst,src,size)  __builtin_memset(dst,src,size) | ||||||
| #	define STIX_MEMCPY(dst,src,size)  __builtin_memcpy(dst,src,size) | #	define STIX_MEMCPY(dst,src,size)  __builtin_memcpy(dst,src,size) | ||||||
| #	define STIX_MEMMOVE(dst,src,size) __builtin_memmove(dst,src,size) | #	define STIX_MEMMOVE(dst,src,size) __builtin_memmove(dst,src,size) | ||||||
| #	define STIX_MEMCMP(dst,src,size)  __builtin_memcmp(dst,src,size) | #	define STIX_MEMCMP(dst,src,size)  __builtin_memcmp(dst,src,size) | ||||||
|  |  | ||||||
| #else | #else | ||||||
| #	define STIX_MEMSET(dst,src,size)  memset(dst,src,size) | #	define STIX_MEMSET(dst,src,size)  memset(dst,src,size) | ||||||
| #	define STIX_MEMCPY(dst,src,size)  memcpy(dst,src,size) | #	define STIX_MEMCPY(dst,src,size)  memcpy(dst,src,size) | ||||||
|  | |||||||
| @ -88,7 +88,7 @@ enum stix_trait_t | |||||||
| 	STIX_NOGC = (1 << 0), | 	STIX_NOGC = (1 << 0), | ||||||
|  |  | ||||||
| 	/* wait for running process when exiting from the main method */ | 	/* wait for running process when exiting from the main method */ | ||||||
| 	STIX_AWAIT_PROCS = (1 << 1), | 	STIX_AWAIT_PROCS = (1 << 1) | ||||||
| }; | }; | ||||||
| typedef enum stix_trait_t stix_trait_t; | typedef enum stix_trait_t stix_trait_t; | ||||||
|  |  | ||||||
| @ -204,7 +204,7 @@ enum stix_obj_type_t | |||||||
| 	STIX_OBJ_TYPE_CHAR, | 	STIX_OBJ_TYPE_CHAR, | ||||||
| 	STIX_OBJ_TYPE_BYTE, | 	STIX_OBJ_TYPE_BYTE, | ||||||
| 	STIX_OBJ_TYPE_HALFWORD, | 	STIX_OBJ_TYPE_HALFWORD, | ||||||
| 	STIX_OBJ_TYPE_WORD, | 	STIX_OBJ_TYPE_WORD | ||||||
|  |  | ||||||
| /* | /* | ||||||
| 	STIX_OBJ_TYPE_UINT8, | 	STIX_OBJ_TYPE_UINT8, | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user