[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Randomising ActionGroup
From: |
Marcus G. Daniels |
Subject: |
Re: Randomising ActionGroup |
Date: |
05 Mar 1999 15:25:37 -0800 |
>>>>> "AVK" == Axel von Kamp <address@hidden> writes:
AVK> When I run this program,
AVK> the actionGroupTest ActionGroup will be executed once and even in
AVK> random order but after that the program crashes with a
AVK> segmentation fault.
Ok, I think Vladimir and I have sorted this out.
It was two independent problems: a memory leak and a bug in casting.
Below are the required diffs to the collections and activity libraries.
Alternatively, if you e-mail me, I'll point you to a snapshot.
Thanks.
Index: Collection.m
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/collections/Collection.m,v
retrieving revision 1.41
retrieving revision 1.44
diff -c -r1.41 -r1.44
*** Collection.m 1999/02/06 01:46:40 1.41
--- Collection.m 1999/03/05 04:49:34 1.44
***************
*** 407,413 ****
+ createBegin: aZone
{
PermutedIndex_c *obj = [aZone allocIVars: self];
! obj->collection = [Permutation createBegin: [aZone getComponentZone]];
return obj;
}
--- 407,413 ----
+ createBegin: aZone
{
PermutedIndex_c *obj = [aZone allocIVars: self];
! obj->collection = [Permutation createBegin: getCZone (aZone)];
return obj;
}
***************
*** 426,432 ****
- createEnd
{
collection = [collection createEnd];
! index = [collection begin: [getZone (self) getComponentZone]];
setMappedAlloc (self);
return self;
}
--- 426,432 ----
- createEnd
{
collection = [collection createEnd];
! index = [collection begin: getCZone (getZone (self))];
setMappedAlloc (self);
return self;
}
***************
*** 438,444 ****
id shuffler = ((Permutation_c *) collection)->shuffler;
[shuffler shuffleWholeList: collection];
[index drop];
! index = [collection begin: [getZone (self) getComponentZone]];
return self;
}
--- 438,444 ----
id shuffler = ((Permutation_c *) collection)->shuffler;
[shuffler shuffleWholeList: collection];
[index drop];
! index = [collection begin: getCZone (getZone (self))];
return self;
}
Index: Permutation.m
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/collections/Permutation.m,v
retrieving revision 1.14
retrieving revision 1.19
diff -c -r1.14 -r1.19
*** Permutation.m 1999/02/06 01:46:49 1.14
--- Permutation.m 1999/03/05 22:56:55 1.19
***************
*** 46,59 ****
@end
@implementation Permutation_c
-
PHASE(Creating)
+ createBegin: aZone
{
Permutation_c *obj = [super createBegin: aZone];
! obj->shuffler = [ListShuffler createBegin: aZone];
return obj;
}
--- 46,58 ----
@end
@implementation Permutation_c
PHASE(Creating)
+ createBegin: aZone
{
Permutation_c *obj = [super createBegin: aZone];
! obj->shuffler = [ListShuffler createBegin: getCZone (aZone)];
return obj;
}
***************
*** 85,91 ****
index = [collection begin: scratchZone];
for (elem = [index next], i = 0; i < count; elem = [index next], i++)
[self atOffset: i put:
! [[[[PermutationItem createBegin: [[self getZone] getComponentZone]]
setPosition: i]
setItem: elem]
createEnd]];
--- 84,90 ----
index = [collection begin: scratchZone];
for (elem = [index next], i = 0; i < count; elem = [index next], i++)
[self atOffset: i put:
! [[[[PermutationItem createBegin: getCZone (getZone (self))]
setPosition: i]
setItem: elem]
createEnd]];
***************
*** 112,117 ****
--- 111,117 ----
[index drop];
mapObject (mapalloc, shuffler);
+ [super mapAllocations: mapalloc];
}
- (void)describe: outputCharStream
Diffs to the collections library:
Index: ActionGroup.h
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/activity/ActionGroup.h,v
retrieving revision 1.15
retrieving revision 1.17
diff -c -r1.15 -r1.17
*** ActionGroup.h 1999/02/06 01:46:24 1.15
--- ActionGroup.h 1999/03/05 23:16:12 1.17
***************
*** 32,38 ****
- (void)_performPlan_;
- _createActivity_: ownerActivity : activityClass : indexClass;
- (void)drop;
! - _createPermutedIndex_: aZone;
/*** methods in ActionGroup_c (inserted from .m file by m2h) ***/
- createEnd;
- _activateUnderSwarm_: activityClass : indexClass : swarmContext;
--- 32,38 ----
- (void)_performPlan_;
- _createActivity_: ownerActivity : activityClass : indexClass;
- (void)drop;
! - _createPermutedIndex_: aZone activity: activity;
/*** methods in ActionGroup_c (inserted from .m file by m2h) ***/
- createEnd;
- _activateUnderSwarm_: activityClass : indexClass : swarmContext;
***************
*** 72,78 ****
@interface GroupIndex_c: ListIndex_mlinks
{
@public
! id <Activity> activity; // activity for which index created
}
/*** methods implemented in CompoundAction.m file ***/
- getHoldType;
--- 72,78 ----
@interface GroupIndex_c: ListIndex_mlinks
{
@public
! id <Activity> activity; // activity for which index created
}
/*** methods implemented in CompoundAction.m file ***/
- getHoldType;
***************
*** 86,94 ****
@public
id <Activity> activity;
}
! + createBegin: aZone;
! - setCollection: aGroup;
! - createEnd;
- getHoldType;
- nextAction: (id *)status;
- (void)dropAllocations: (BOOL)componentAlloc;
--- 86,92 ----
@public
id <Activity> activity;
}
! - setActivity: activity;
- getHoldType;
- nextAction: (id *)status;
- (void)dropAllocations: (BOOL)componentAlloc;
Index: ActionGroup.m
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/activity/ActionGroup.m,v
retrieving revision 1.18
retrieving revision 1.24
diff -c -r1.18 -r1.24
*** ActionGroup.m 1999/02/06 01:46:25 1.18
--- ActionGroup.m 1999/03/05 23:16:13 1.24
***************
*** 224,234 ****
return newAction;
}
! - _createPermutedIndex_: (id)aZone
{
! return [[[GroupPermutedIndex_c createBegin: aZone]
! setCollection: self]
! createEnd];
}
//
--- 224,235 ----
return newAction;
}
! - _createPermutedIndex_: aZone activity: activity
{
! return [[[[GroupPermutedIndex_c createBegin: aZone]
! setCollection: self]
! setActivity: activity]
! createEnd];
}
//
***************
*** 401,429 ****
//
@implementation GroupPermutedIndex_c
!
! + createBegin: aZone
! {
! GroupPermutedIndex_c *newIndex;
!
! newIndex = [super createBegin: aZone];
! newIndex->collection = [Permutation createBegin: [aZone getComponentZone]];
! return newIndex;
! }
!
! - setCollection: aCollection
! {
! [(Permutation_c *) collection setCollection: aCollection];
! return self;
! }
!
! - createEnd
{
! [super createEnd];
! index = [collection begin: [getZone (self) getComponentZone]];
return self;
}
//
// mix in action plan index methods by source inclusion
//
--- 402,415 ----
//
@implementation GroupPermutedIndex_c
! PHASE(Creating)
! - setActivity: theActivity
{
! activity = theActivity;
return self;
}
+ PHASE(Using)
//
// mix in action plan index methods by source inclusion
//
***************
*** 537,542 ****
--- 523,529 ----
@implementation ForEachIndex_c
+ PHASE(Using)
- nextAction: (id *)status
{
// reload and return the action being used to execute each member
***************
*** 572,574 ****
--- 559,562 ----
}
@end
+
Index: CompoundAction.m
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/activity/CompoundAction.m,v
retrieving revision 1.20
retrieving revision 1.21
diff -c -r1.20 -r1.21
*** CompoundAction.m 1999/02/08 18:26:11 1.20
--- CompoundAction.m 1999/03/05 22:37:01 1.21
***************
*** 154,160 ****
{
id activityZone;
Activity_c *newActivity;
- INDEX_CLASS *newIndex;
// allocate and initialize a new activity
--- 154,159 ----
***************
*** 194,207 ****
// create index on the plan actions for traversal by the activity
if ([self getDefaultOrder] == (id) Randomized
&& [self conformsTo: @protocol(ActionGroup)])
! newIndex = [(ActionGroup_c *) self _createPermutedIndex_:
! getCZone (activityZone)];
else
! newIndex = [self _createIndex_: getCZone (activityZone)
! forIndexSubclass: indexClass];
! newIndex->activity = (id) newActivity;
! newActivity->currentIndex = newIndex;
!
return newActivity;
}
--- 193,209 ----
// create index on the plan actions for traversal by the activity
if ([self getDefaultOrder] == (id) Randomized
&& [self conformsTo: @protocol(ActionGroup)])
! newActivity->currentIndex =
! [(ActionGroup_c *) self _createPermutedIndex_:
! getCZone (activityZone)
! activity: newActivity];
else
! {
! INDEX_CLASS *newIndex = [self _createIndex_: getCZone (activityZone)
! forIndexSubclass: indexClass];
! newIndex->activity = newActivity;
! newActivity->currentIndex = newIndex;
! }
return newActivity;
}
Index: XActivity.h
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/activity/XActivity.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -c -r1.10 -r1.11
*** XActivity.h 1999/02/06 01:46:28 1.10
--- XActivity.h 1999/03/05 22:45:18 1.11
***************
*** 15,21 ****
//
// Activity_c -- state of processing within an action type
//
! @interface Activity_c: Object_s
{
@public
Activity_c *ownerActivity; // activity running this activity
--- 15,21 ----
//
// Activity_c -- state of processing within an action type
//
! @interface Activity_c: Object_s <Activity>
{
@public
Activity_c *ownerActivity; // activity running this activity
Index: XActivity.m
===================================================================
RCS file: /opt/src/hive/cvs/Swarm/swarm/src/activity/XActivity.m,v
retrieving revision 1.15
retrieving revision 1.16
diff -c -r1.15 -r1.16
*** XActivity.m 1999/02/06 01:46:29 1.15
--- XActivity.m 1999/03/05 22:45:19 1.16
***************
*** 26,32 ****
//
@implementation Activity_c
!
//
// auditRunRequest() -- common function for run and step messages
//
--- 26,33 ----
//
@implementation Activity_c
! PHASE(Creating)
! PHASE(Using)
//
// auditRunRequest() -- common function for run and step messages
//
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
- Re: Randomising ActionGroup,
Marcus G. Daniels <=
- Re: Randomising ActionGroup, srm8, 1999/03/05
- Xpm, Marcus G. Daniels, 1999/03/05
- Re: Xpm, srm8, 1999/03/08
- Bug tutorial Batch Swarm needed, Perrone Alessandro, 1999/03/09
- Re: Bug tutorial Batch Swarm needed, Marcus G. Daniels, 1999/03/09
- Re: Bug tutorial Batch Swarm needed, Perrone Alessandro, 1999/03/15
- Re: Bug tutorial Batch Swarm needed, Paul E. Johnson, 1999/03/15
- Re: Bug tutorial Batch Swarm needed, Marcus G. Daniels, 1999/03/15
- Re: Bug tutorial Batch Swarm needed, Marshall James, 1999/03/15