From fabc9afee837fc6cd3b05f57a67dac342e4fd1d4 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Wed, 16 Mar 2016 02:27:18 +0000 Subject: [PATCH] added SemaphoreHeap --- stix/kernel/Collection-Array.st | 5 + stix/kernel/Context.st | 12 +- stix/kernel/Process.st | 224 +++++++++++++++++++++++++++----- stix/lib/exec.c | 78 ++++++----- stix/lib/gc.c | 2 +- stix/lib/stix-prv.h | 2 +- stix/lib/stix.c | 14 ++ stix/lib/stix.h | 21 ++- 8 files changed, 274 insertions(+), 84 deletions(-) diff --git a/stix/kernel/Collection-Array.st b/stix/kernel/Collection-Array.st index a7cc988..f408101 100644 --- a/stix/kernel/Collection-Array.st +++ b/stix/kernel/Collection-Array.st @@ -29,6 +29,11 @@ { 1 to: self size do: [:i | aBlock value: (self at: i)]. } + + #method copy: anArray + { + 1 to: (anArray size) do: [:i | self at: i put: (anArray at: i) ]. + } } #class(#character) String(Array) diff --git a/stix/kernel/Context.st b/stix/kernel/Context.st index f48ef20..58a261c 100644 --- a/stix/kernel/Context.st +++ b/stix/kernel/Context.st @@ -111,17 +111,17 @@ ## less block context before whileTrue: is recursively sent. ## whileTrue: is sent in a method context. -## (self value) ifFalse: [^nil]. -## aBlock value. -## self whileTrue: aBlock. + (self value) ifFalse: [^nil]. + aBlock value. + self whileTrue: aBlock. ## ---------------------------------------------------------------------------- ## ---------------------------------------------------------------------------- - | pc sp xsp | +" | pc sp xsp | sp := thisContext sp. - sp := sp - 1. "decrement sp by 1 becuase thisContext pushed above affects the sp method" + sp := sp - 1. ## decrement sp by 1 becuase thisContext pushed above affects the sp method pc := thisContext pc. self value ifFalse: [ ^nil "^self" ]. aBlock value. @@ -131,7 +131,7 @@ ## this +2 or - 3 above is dependent on the byte code instruction size used for 'store' ## +2 to skip STORE_INTO_TEMP(pc) and POP_STACKTOP. ## TODO: make it independent of the byte code size - +" ## ---------------------------------------------------------------------------- ## #