--- a/WeakArray.st Wed Oct 11 15:55:36 2017 +0200
+++ b/WeakArray.st Wed Oct 11 15:55:51 2017 +0200
@@ -76,18 +76,18 @@
A weakArray notifies its dependents via normal dependency notfications.
[hint:]
- WeakArray handling adds small some overhead to the VM
- (each weakarray is scanned after each GC).
- It is uncertain, if the current mechanism works well
- with (say) ten-thousands of weakArrays.
- We had the system running with >2000 weakArrays, some being quite
- big for a while and had a few percent of added gc time.
- The system as delivered creates between 50 and 100 weakArrays,
- but with many dependents, this number may grow.
- If you need the dependency mechanism on a huge number of objects,
- consider adding a (non-weak) dependents field to your class
- - take the implementation of Model as a guide (or subclass them
- from Model).
+ WeakArray handling adds small some overhead to the VM
+ (each weakarray is scanned after each GC).
+ It is uncertain, if the current mechanism works well
+ with (say) ten-thousands of weakArrays.
+ We had the system running with >2000 weakArrays, some being quite
+ big for a while and had a few percent of added gc time.
+ The system as delivered creates between 50 and 100 weakArrays,
+ but with many dependents, this number may grow.
+ If you need the dependency mechanism on a huge number of objects,
+ consider adding a (non-weak) dependents field to your class
+ - take the implementation of Model as a guide (or subclass them
+ from Model).
As a possible option, we could perform the weakArray scanning only in
the oldSpace reclamation code - this would remove most of the overhead,
@@ -96,34 +96,34 @@
[instance variables:]
- dependents get informed via #change notifiction
- that the weakArray has lost pointers.
- Having the dependents here is an optimization.
+ dependents get informed via #change notifiction
+ that the weakArray has lost pointers.
+ Having the dependents here is an optimization.
[class variables:]
- RegistrationFailedSignal raised if a weakArray cannot be
- registered by the VM. This only happens,
- if the VM has to resize its internal tables
- and is running out of malloc-memory.
+ RegistrationFailedSignal raised if a weakArray cannot be
+ registered by the VM. This only happens,
+ if the VM has to resize its internal tables
+ and is running out of malloc-memory.
[memory requirements:]
- OBJ-HEADER + (size * ptr-size) + ptr-size
- + sizeof(dependents-collection)
+ OBJ-HEADER + (size * ptr-size) + ptr-size
+ + sizeof(dependents-collection)
[author:]
- Claus Gittinger
+ Claus Gittinger
[See also:]
- Array WeakIdentitySet WeakIdentityDictionary Registry
- Model
+ Array WeakIdentitySet WeakIdentityDictionary Registry
+ Model
"
! !
!WeakArray class methodsFor:'initialization'!
initialize
- "setup the private signal"
+ "adjust my class flags and setup the private signal"
self flags:(Behavior flagWeakPointers). "/ read the comment in basicNew:
RegistrationFailedSignal isNil ifTrue:[
@@ -182,71 +182,71 @@
ok = __addShadowObject(self, 0);
if (ok == false) {
- /*
- * the behavior of __addShadowObject() in case of overflowing
- * VM-table space can be controlled by the second argument:
- * if it's 0, the weakObject is not registered, and false
- * is returned.
- * if it's 1, the tables are reallocated, registration proceeds,
- * and true is returned.
- * This allows for the caller to have an influence on the VM's
- * shadow table allocation.
- *
- * If addShadowObject() returned false, too many shadow objects are
- * already there. Then collect garbage to get rid of
- * obsolete ones, and try again.
- * Since a full collect is expensive, we try
- * a scavenge first, doing a full collect only if
- * that does not help.
- *
- * THIS MAY OR MAY NOT BE A GOOD IDEA: although it reduces
- * the number of shadow objects that have to be
- * processed at GC time, it may create a long delay here,
- * at shadow object creation time.
- * Don't know which is better ...
- */
- __nonTenuringScavenge(__context);
- ok = __addShadowObject(self, 0);
+ /*
+ * the behavior of __addShadowObject() in case of overflowing
+ * VM-table space can be controlled by the second argument:
+ * if it's 0, the weakObject is not registered, and false
+ * is returned.
+ * if it's 1, the tables are reallocated, registration proceeds,
+ * and true is returned.
+ * This allows for the caller to have an influence on the VM's
+ * shadow table allocation.
+ *
+ * If addShadowObject() returned false, too many shadow objects are
+ * already there. Then collect garbage to get rid of
+ * obsolete ones, and try again.
+ * Since a full collect is expensive, we try
+ * a scavenge first, doing a full collect only if
+ * that does not help.
+ *
+ * THIS MAY OR MAY NOT BE A GOOD IDEA: although it reduces
+ * the number of shadow objects that have to be
+ * processed at GC time, it may create a long delay here,
+ * at shadow object creation time.
+ * Don't know which is better ...
+ */
+ __nonTenuringScavenge(__context);
+ ok = __addShadowObject(self, 0);
- if (ok == false) {
- /*
- * hard stuff - need full collect
- * if this is the very first GC, assume that we are in
- * the startup phase (where all weak stuff is allocated).
- * Then do no GC.
- * Heuristics showed, that this GC does not find much ...
- */
- if ((__garbageCollectCount() != 0)
- || (__incrementalGCCount() != 0)) {
- __markAndSweepIfUseful(__context);
- ok = __addShadowObject(self, 0);
- }
- if (ok == false) {
- /*
- * mhmh - it seems that there are really many shadow
- * objects around - force creation
- */
- ok = __addShadowObject(self, 1);
- if (ok == false) {
- /*
- * no chance - something must be wrong
- * lets fall into the exception and see.
- */
- }
- }
- }
+ if (ok == false) {
+ /*
+ * hard stuff - need full collect
+ * if this is the very first GC, assume that we are in
+ * the startup phase (where all weak stuff is allocated).
+ * Then do no GC.
+ * Heuristics showed, that this GC does not find much ...
+ */
+ if ((__garbageCollectCount() != 0)
+ || (__incrementalGCCount() != 0)) {
+ __markAndSweepIfUseful(__context);
+ ok = __addShadowObject(self, 0);
+ }
+ if (ok == false) {
+ /*
+ * mhmh - it seems that there are really many shadow
+ * objects around - force creation
+ */
+ ok = __addShadowObject(self, 1);
+ if (ok == false) {
+ /*
+ * no chance - something must be wrong
+ * lets fall into the exception and see.
+ */
+ }
+ }
+ }
}
%}.
ok ifFalse:[
- "
- the VM was not able to register the new weakArray
- This can only happen, if the VM has to resize its tables,
- and a malloc request failed. Usually, this smells like big
- trouble being on the way (soon running out of memory in
- other places as well).
- Configure your OS for more swap space.
- "
- ^ RegistrationFailedSignal raiseRequestWith:self
+ "
+ the VM was not able to register the new weakArray
+ This can only happen, if the VM has to resize its tables,
+ and a malloc request failed. Usually, this smells like big
+ trouble being on the way (soon running out of memory in
+ other places as well).
+ Configure your OS for more swap space.
+ "
+ ^ RegistrationFailedSignal raiseRequestWith:self
]
"Modified: / 13-02-2017 / 20:34:24 / cg"
@@ -282,7 +282,7 @@
el := self basicAt:index.
el class == SmallInteger ifTrue:[
- ^ exceptionalValue value
+ ^ exceptionalValue value
].
^ el
!
@@ -390,35 +390,35 @@
wasBlocked := OperatingSystem blockInterrupts.
[
- |deps|
+ |deps|
- deps := dependents.
- "/
- "/ store the very first dependent directly in
- "/ the dependents instVar
- "/
- (deps isNil and:[anObject isCollection not]) ifTrue:[
- dependents := anObject
- ] ifFalse:[
- "/
- "/ store more dependents in the dependents collection
- "/
- deps isCollection ifTrue:[
- deps add:anObject
- ] ifFalse:[
- deps ~~ anObject ifTrue:[
- deps isNil ifTrue:[
- dependents := IdentitySet with:anObject.
- ] ifFalse:[
- dependents := IdentitySet with:deps with:anObject.
- ]
- ]
- ]
- ]
+ deps := dependents.
+ "/
+ "/ store the very first dependent directly in
+ "/ the dependents instVar
+ "/
+ (deps isNil and:[anObject isCollection not]) ifTrue:[
+ dependents := anObject
+ ] ifFalse:[
+ "/
+ "/ store more dependents in the dependents collection
+ "/
+ deps isCollection ifTrue:[
+ deps add:anObject
+ ] ifFalse:[
+ deps ~~ anObject ifTrue:[
+ deps isNil ifTrue:[
+ dependents := IdentitySet with:anObject.
+ ] ifFalse:[
+ dependents := IdentitySet with:deps with:anObject.
+ ]
+ ]
+ ]
+ ]
] ensure:[
- wasBlocked ifFalse:[
- OperatingSystem unblockInterrupts
- ]
+ wasBlocked ifFalse:[
+ OperatingSystem unblockInterrupts
+ ]
]
"Modified: / 08-01-1997 / 23:40:30 / cg"
@@ -479,34 +479,34 @@
wasBlocked := OperatingSystem blockInterrupts.
[
- |deps sz dep|
+ |deps sz dep|
- deps := dependents.
- deps notNil ifTrue:[
- deps isCollection ifTrue:[
- dep := deps remove:anObject ifAbsent:[].
- "if dep is nil, nothing has changed"
- dep notNil ifTrue:[
- (sz := deps size) == 0 ifTrue:[
- dependents := nil
- ] ifFalse:[
- sz == 1 ifTrue:[
- (dep := deps first) isCollection ifFalse:[
- dependents := dep
- ]
- ]
- ].
- ].
- ] ifFalse:[
- deps == anObject ifTrue:[
- dependents := nil
- ]
- ]
- ]
+ deps := dependents.
+ deps notNil ifTrue:[
+ deps isCollection ifTrue:[
+ dep := deps remove:anObject ifAbsent:[].
+ "if dep is nil, nothing has changed"
+ dep notNil ifTrue:[
+ (sz := deps size) == 0 ifTrue:[
+ dependents := nil
+ ] ifFalse:[
+ sz == 1 ifTrue:[
+ (dep := deps first) isCollection ifFalse:[
+ dependents := dep
+ ]
+ ]
+ ].
+ ].
+ ] ifFalse:[
+ deps == anObject ifTrue:[
+ dependents := nil
+ ]
+ ]
+ ]
] ensure:[
- wasBlocked ifFalse:[
- OperatingSystem unblockInterrupts
- ]
+ wasBlocked ifFalse:[
+ OperatingSystem unblockInterrupts
+ ]
]
! !
@@ -529,50 +529,50 @@
if (__isBlockLike(aBlock)
&& (__BlockInstPtr(aBlock)->b_nargs == __mkSmallInteger(1))) {
- {
- /*
- * the most common case: a static compiled block, with home on the stack ...
- */
- REGISTER OBJFUNC codeVal;
+ {
+ /*
+ * the most common case: a static compiled block, with home on the stack ...
+ */
+ REGISTER OBJFUNC codeVal;
- if (((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
- && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))) {
+ if (((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
+ && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))) {
#ifdef NEW_BLOCK_CALL
# define BLOCK_ARG aBlock
#else
# define BLOCK_ARG rHome
- REGISTER OBJ rHome;
+ REGISTER OBJ rHome;
- rHome = __BlockInstPtr(aBlock)->b_home;
- if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE))
+ rHome = __BlockInstPtr(aBlock)->b_home;
+ if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE))
#endif
- {
- for (; index < nIndex; index++) {
- if (InterruptPending != nil) __interruptL(@line);
+ {
+ for (; index < nIndex; index++) {
+ if (InterruptPending != nil) __interruptL(@line);
- element = __InstPtr(self)->i_instvars[index];
- if (__isNonNilObject(element)) {
- element = __WEAK_READ__(self, element);
+ element = __InstPtr(self)->i_instvars[index];
+ if (__isNonNilObject(element)) {
+ element = __WEAK_READ__(self, element);
#ifdef WEAK_DEBUG
- if (! __ISVALIDOBJECT(element)) {
- fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
- __dumpObject__(element, __LINE__);
- element = nil;
- }
+ if (! __ISVALIDOBJECT(element)) {
+ fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
+ __dumpObject__(element, __LINE__);
+ element = nil;
+ }
#endif
- }
- (*codeVal)(BLOCK_ARG, element);
- }
- RETURN (self);
- }
- }
- }
+ }
+ (*codeVal)(BLOCK_ARG, element);
+ }
+ RETURN (self);
+ }
+ }
+ }
- /*
- * sorry, must check code-pointer in the loop
- * it could be recompiled or flushed
- */
+ /*
+ * sorry, must check code-pointer in the loop
+ * it could be recompiled or flushed
+ */
# undef BLOCK_ARG
#ifdef NEW_BLOCK_CALL
# define BLOCK_ARG aBlock
@@ -582,44 +582,44 @@
# define IBLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
#endif
- for (; index < nIndex; index++) {
- REGISTER OBJFUNC codeVal;
+ for (; index < nIndex; index++) {
+ REGISTER OBJFUNC codeVal;
- if (InterruptPending != nil) __interruptL(@line);
+ if (InterruptPending != nil) __interruptL(@line);
- element = __InstPtr(self)->i_instvars[index];
- if (__isNonNilObject(element)) {
- element = __WEAK_READ__(self, element);
+ element = __InstPtr(self)->i_instvars[index];
+ if (__isNonNilObject(element)) {
+ element = __WEAK_READ__(self, element);
#ifdef WEAK_DEBUG
- if (! __ISVALIDOBJECT(element)) {
- fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
- __dumpObject__(element, __LINE__);
- element = nil;
- }
+ if (! __ISVALIDOBJECT(element)) {
+ fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
+ __dumpObject__(element, __LINE__);
+ element = nil;
+ }
#endif
- }
- if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
- (*codeVal)(BLOCK_ARG, element);
- } else {
- if (__BlockInstPtr(aBlock)->b_bytecodes != nil) {
- /*
- * arg is a compiled block with bytecode -
- * directly call interpreter without going through Block>>value
- */
+ }
+ if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
+ (*codeVal)(BLOCK_ARG, element);
+ } else {
+ if (__BlockInstPtr(aBlock)->b_bytecodes != nil) {
+ /*
+ * arg is a compiled block with bytecode -
+ * directly call interpreter without going through Block>>value
+ */
#ifdef PASS_ARG_POINTER
- __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, &element);
+ __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, &element);
#else
- __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, element);
+ __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, element);
#endif
- } else {
- /*
- * arg is something else - call it with #value
- */
- (*val.ilc_func)(aBlock, @symbol(value:), nil, &val, element);
- }
- }
- }
- RETURN (self);
+ } else {
+ /*
+ * arg is something else - call it with #value
+ */
+ (*val.ilc_func)(aBlock, @symbol(value:), nil, &val, element);
+ }
+ }
+ }
+ RETURN (self);
# undef BLOCK_ARG
# undef IBLOCK_ARG
@@ -630,28 +630,28 @@
* not a block - send it #value:
*/
for (; index < nIndex; index++) {
- if (InterruptPending != nil) __interruptL(@line);
+ if (InterruptPending != nil) __interruptL(@line);
- element = __InstPtr(self)->i_instvars[index];
- if (__isNonNilObject(element)) {
- element = __WEAK_READ__(self, element);
+ element = __InstPtr(self)->i_instvars[index];
+ if (__isNonNilObject(element)) {
+ element = __WEAK_READ__(self, element);
#ifdef WEAK_DEBUG
- if (! __ISVALIDOBJECT(element)) {
- fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
- __dumpObject__(element, __LINE__);
- element = nil;
- }
+ if (! __ISVALIDOBJECT(element)) {
+ fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
+ __dumpObject__(element, __LINE__);
+ element = nil;
+ }
#endif
- }
- (*val.ilc_func)(aBlock,
- @symbol(value:),
- nil, &val,
- element);
+ }
+ (*val.ilc_func)(aBlock,
+ @symbol(value:),
+ nil, &val,
+ element);
}
RETURN (self);
%}.
^ super do:[:each |
- each notNil ifTrue:[aBlock value:each]
+ each notNil ifTrue:[aBlock value:each]
]
"Modified: / 23-07-2015 / 15:35:24 / cg"
@@ -683,10 +683,10 @@
slots may change iff the garbage collector finds new garbage."
self keysAndValuesDo:[:index :element |
- element class == SmallInteger ifTrue:[
- self at:index put:newValue.
- aBlock value:index.
- ]
+ element class == SmallInteger ifTrue:[
+ self at:index put:newValue.
+ aBlock value:index.
+ ]
]
"Modified: 25.1.1997 / 14:51:28 / cg"
@@ -712,57 +712,57 @@
nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
if (__isBlockLike(aBlock)
&& (__BlockInstPtr(aBlock)->b_nargs == __mkSmallInteger(1))) {
- {
- /*
- * the most common case: a static compiled block, with home on the stack ...
- */
- REGISTER OBJFUNC codeVal;
+ {
+ /*
+ * the most common case: a static compiled block, with home on the stack ...
+ */
+ REGISTER OBJFUNC codeVal;
- if (((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
- && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))) {
+ if (((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
+ && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))) {
#ifdef NEW_BLOCK_CALL
# define BLOCK_ARG aBlock
#else
# define BLOCK_ARG rHome
- REGISTER OBJ rHome;
+ REGISTER OBJ rHome;
- rHome = __BlockInstPtr(aBlock)->b_home;
- if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE))
+ rHome = __BlockInstPtr(aBlock)->b_home;
+ if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE))
#endif
- {
- for (; index < nIndex; index++) {
- element = __InstPtr(self)->i_instvars[index];
- if (element) {
- if (InterruptPending != nil) {
- __interruptL(@line);
- element = __InstPtr(self)->i_instvars[index];
- }
+ {
+ for (; index < nIndex; index++) {
+ element = __InstPtr(self)->i_instvars[index];
+ if (element) {
+ if (InterruptPending != nil) {
+ __interruptL(@line);
+ element = __InstPtr(self)->i_instvars[index];
+ }
- if (__isNonNilObject(element)) {
- element = __WEAK_READ__(self, element);
+ if (__isNonNilObject(element)) {
+ element = __WEAK_READ__(self, element);
#ifdef WEAK_DEBUG
- if (! __ISVALIDOBJECT(element)) {
- fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
- __dumpObject__(element, __LINE__);
- element = nil;
- }
+ if (! __ISVALIDOBJECT(element)) {
+ fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
+ __dumpObject__(element, __LINE__);
+ element = nil;
+ }
#endif
- }
- if (element) {
- (*codeVal)(BLOCK_ARG, element);
- }
- }
- }
- RETURN (self);
- }
- }
- }
+ }
+ if (element) {
+ (*codeVal)(BLOCK_ARG, element);
+ }
+ }
+ }
+ RETURN (self);
+ }
+ }
+ }
- /*
- * sorry, must check code-pointer in the loop
- * it could be recompiled or flushed
- */
+ /*
+ * sorry, must check code-pointer in the loop
+ * it could be recompiled or flushed
+ */
# undef BLOCK_ARG
#ifdef NEW_BLOCK_CALL
# define BLOCK_ARG aBlock
@@ -772,50 +772,50 @@
# define IBLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
#endif
- for (; index < nIndex; index++) {
- REGISTER OBJFUNC codeVal;
+ for (; index < nIndex; index++) {
+ REGISTER OBJFUNC codeVal;
- element = __InstPtr(self)->i_instvars[index];
- if (element) {
- if (InterruptPending != nil) {
- __interruptL(@line);
- element = __InstPtr(self)->i_instvars[index];
- }
- if (__isNonNilObject(element)) {
- element = __WEAK_READ__(self, element);
+ element = __InstPtr(self)->i_instvars[index];
+ if (element) {
+ if (InterruptPending != nil) {
+ __interruptL(@line);
+ element = __InstPtr(self)->i_instvars[index];
+ }
+ if (__isNonNilObject(element)) {
+ element = __WEAK_READ__(self, element);
#ifdef WEAK_DEBUG
- if (! __ISVALIDOBJECT(element)) {
- fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
- __dumpObject__(element, __LINE__);
- element = nil;
- }
+ if (! __ISVALIDOBJECT(element)) {
+ fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
+ __dumpObject__(element, __LINE__);
+ element = nil;
+ }
#endif
- }
- if (element) {
- if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
- (*codeVal)(BLOCK_ARG, element);
- } else {
- if (__BlockInstPtr(aBlock)->b_bytecodes != nil) {
- /*
- * arg is a compiled block with bytecode -
- * directly call interpreter without going through Block>>value
- */
+ }
+ if (element) {
+ if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
+ (*codeVal)(BLOCK_ARG, element);
+ } else {
+ if (__BlockInstPtr(aBlock)->b_bytecodes != nil) {
+ /*
+ * arg is a compiled block with bytecode -
+ * directly call interpreter without going through Block>>value
+ */
#ifdef PASS_ARG_POINTER
- __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, &element);
+ __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, &element);
#else
- __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, element);
+ __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, element);
#endif
- } else {
- /*
- * arg is something else - call it with #value
- */
- (*val.ilc_func)(aBlock, @symbol(value:), nil, &val, element);
- }
- }
- }
- }
- }
- RETURN (self);
+ } else {
+ /*
+ * arg is something else - call it with #value
+ */
+ (*val.ilc_func)(aBlock, @symbol(value:), nil, &val, element);
+ }
+ }
+ }
+ }
+ }
+ RETURN (self);
# undef BLOCK_ARG
# undef IBLOCK_ARG
@@ -825,34 +825,34 @@
* not a block - send it #value:
*/
for (; index < nIndex; index++) {
- element = __InstPtr(self)->i_instvars[index];
- if (element) {
- if (InterruptPending != nil) {
- __interruptL(@line);
- element = __InstPtr(self)->i_instvars[index];
- }
- if (__isNonNilObject(element)) {
- element = __WEAK_READ__(self, element);
+ element = __InstPtr(self)->i_instvars[index];
+ if (element) {
+ if (InterruptPending != nil) {
+ __interruptL(@line);
+ element = __InstPtr(self)->i_instvars[index];
+ }
+ if (__isNonNilObject(element)) {
+ element = __WEAK_READ__(self, element);
#ifdef WEAK_DEBUG
- if (! __ISVALIDOBJECT(element)) {
- fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
- __dumpObject__(element, __LINE__);
- element = nil;
- }
+ if (! __ISVALIDOBJECT(element)) {
+ fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
+ __dumpObject__(element, __LINE__);
+ element = nil;
+ }
#endif
- }
- if (element) {
- (*val.ilc_func)(aBlock,
- @symbol(value:),
- nil, &val,
- element);
- }
- }
+ }
+ if (element) {
+ (*val.ilc_func)(aBlock,
+ @symbol(value:),
+ nil, &val,
+ element);
+ }
+ }
}
RETURN (self);
%}.
^ super do:[:each |
- each notNil ifTrue:[aBlock value:each]
+ each notNil ifTrue:[aBlock value:each]
]
!
@@ -869,57 +869,57 @@
nIndex = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE);
if (__isBlockLike(aBlock)
&& (__BlockInstPtr(aBlock)->b_nargs == __mkSmallInteger(1))) {
- {
- /*
- * the most common case: a static compiled block, with home on the stack ...
- */
- REGISTER OBJFUNC codeVal;
+ {
+ /*
+ * the most common case: a static compiled block, with home on the stack ...
+ */
+ REGISTER OBJFUNC codeVal;
- if (((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
- && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))) {
+ if (((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil)
+ && (! ((INT)(__BlockInstPtr(aBlock)->b_flags) & __MASKSMALLINT(F_DYNAMIC)))) {
#ifdef NEW_BLOCK_CALL
# define BLOCK_ARG aBlock
#else
# define BLOCK_ARG rHome
- REGISTER OBJ rHome;
+ REGISTER OBJ rHome;
- rHome = __BlockInstPtr(aBlock)->b_home;
- if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE))
+ rHome = __BlockInstPtr(aBlock)->b_home;
+ if ((rHome == nil) || (__qSpace(rHome) >= STACKSPACE))
#endif
- {
- for (; index < nIndex; index++) {
- element = __InstPtr(self)->i_instvars[index];
- if (__isNonNilObject(element)) {
- if (InterruptPending != nil) {
- __interruptL(@line);
- element = __InstPtr(self)->i_instvars[index];
- }
+ {
+ for (; index < nIndex; index++) {
+ element = __InstPtr(self)->i_instvars[index];
+ if (__isNonNilObject(element)) {
+ if (InterruptPending != nil) {
+ __interruptL(@line);
+ element = __InstPtr(self)->i_instvars[index];
+ }
- if (__isNonNilObject(element)) {
- element = __WEAK_READ__(self, element);
+ if (__isNonNilObject(element)) {
+ element = __WEAK_READ__(self, element);
#ifdef WEAK_DEBUG
- if (! __ISVALIDOBJECT(element)) {
- fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
- __dumpObject__(element, __LINE__);
- element = nil;
- }
+ if (! __ISVALIDOBJECT(element)) {
+ fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
+ __dumpObject__(element, __LINE__);
+ element = nil;
+ }
#endif
- if (__isNonNilObject(element)) {
- (*codeVal)(BLOCK_ARG, element);
- }
- }
- }
- }
- RETURN (self);
- }
- }
- }
+ if (__isNonNilObject(element)) {
+ (*codeVal)(BLOCK_ARG, element);
+ }
+ }
+ }
+ }
+ RETURN (self);
+ }
+ }
+ }
- /*
- * sorry, must check code-pointer in the loop
- * it could be recompiled or flushed
- */
+ /*
+ * sorry, must check code-pointer in the loop
+ * it could be recompiled or flushed
+ */
# undef BLOCK_ARG
#ifdef NEW_BLOCK_CALL
# define BLOCK_ARG aBlock
@@ -929,50 +929,50 @@
# define IBLOCK_ARG (__BlockInstPtr(aBlock)->b_home)
#endif
- for (; index < nIndex; index++) {
- REGISTER OBJFUNC codeVal;
+ for (; index < nIndex; index++) {
+ REGISTER OBJFUNC codeVal;
- element = __InstPtr(self)->i_instvars[index];
- if (__isNonNilObject(element)) {
- if (InterruptPending != nil) {
- __interruptL(@line);
- element = __InstPtr(self)->i_instvars[index];
- }
- if (__isNonNilObject(element)) {
- element = __WEAK_READ__(self, element);
+ element = __InstPtr(self)->i_instvars[index];
+ if (__isNonNilObject(element)) {
+ if (InterruptPending != nil) {
+ __interruptL(@line);
+ element = __InstPtr(self)->i_instvars[index];
+ }
+ if (__isNonNilObject(element)) {
+ element = __WEAK_READ__(self, element);
#ifdef WEAK_DEBUG
- if (! __ISVALIDOBJECT(element)) {
- fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
- __dumpObject__(element, __LINE__);
- element = nil;
- }
+ if (! __ISVALIDOBJECT(element)) {
+ fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
+ __dumpObject__(element, __LINE__);
+ element = nil;
+ }
#endif
- if (__isNonNilObject(element)) {
- if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
- (*codeVal)(BLOCK_ARG, element);
- } else {
- if (__BlockInstPtr(aBlock)->b_bytecodes != nil) {
- /*
- * arg is a compiled block with bytecode -
- * directly call interpreter without going through Block>>value
- */
+ if (__isNonNilObject(element)) {
+ if ((codeVal = __BlockInstPtr(aBlock)->b_code) != (OBJFUNC)nil) {
+ (*codeVal)(BLOCK_ARG, element);
+ } else {
+ if (__BlockInstPtr(aBlock)->b_bytecodes != nil) {
+ /*
+ * arg is a compiled block with bytecode -
+ * directly call interpreter without going through Block>>value
+ */
#ifdef PASS_ARG_POINTER
- __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, &element);
+ __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, &element);
#else
- __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, element);
+ __interpret(aBlock, 1, nil, IBLOCK_ARG, nil, nil, element);
#endif
- } else {
- /*
- * arg is something else - call it with #value
- */
- (*val.ilc_func)(aBlock, @symbol(value:), nil, &val, element);
- }
- }
- }
- }
- }
- }
- RETURN (self);
+ } else {
+ /*
+ * arg is something else - call it with #value
+ */
+ (*val.ilc_func)(aBlock, @symbol(value:), nil, &val, element);
+ }
+ }
+ }
+ }
+ }
+ }
+ RETURN (self);
# undef BLOCK_ARG
# undef IBLOCK_ARG
@@ -982,34 +982,34 @@
* not a block - send it #value:
*/
for (; index < nIndex; index++) {
- element = __InstPtr(self)->i_instvars[index];
- if (__isNonNilObject(element)) {
- if (InterruptPending != nil) {
- __interruptL(@line);
- element = __InstPtr(self)->i_instvars[index];
- }
- if (__isNonNilObject(element)) {
- element = __WEAK_READ__(self, element);
+ element = __InstPtr(self)->i_instvars[index];
+ if (__isNonNilObject(element)) {
+ if (InterruptPending != nil) {
+ __interruptL(@line);
+ element = __InstPtr(self)->i_instvars[index];
+ }
+ if (__isNonNilObject(element)) {
+ element = __WEAK_READ__(self, element);
#ifdef WEAK_DEBUG
- if (! __ISVALIDOBJECT(element)) {
- fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
- __dumpObject__(element, __LINE__);
- element = nil;
- }
+ if (! __ISVALIDOBJECT(element)) {
+ fprintf(stderr, "****** OOPS - invalid Weak-Read\n");
+ __dumpObject__(element, __LINE__);
+ element = nil;
+ }
#endif
- if (__isNonNilObject(element)) {
- (*val.ilc_func)(aBlock,
- @symbol(value:),
- nil, &val,
- element);
- }
- }
- }
+ if (__isNonNilObject(element)) {
+ (*val.ilc_func)(aBlock,
+ @symbol(value:),
+ nil, &val,
+ element);
+ }
+ }
+ }
}
RETURN (self);
%}.
^ super do:[:each |
- (each notNil and:[each class ~~ SmallInteger]) ifTrue:[aBlock value:each]
+ (each notNil and:[each class ~~ SmallInteger]) ifTrue:[aBlock value:each]
]
"Modified: / 23-07-2015 / 15:32:44 / cg"