ModelAction::~ModelAction()
{
- if (cv)
- delete cv;
+ /** We can't free the clock vector:
+ * The reason is as follows:
+ * Clock vectors are snapshotting state... when we delete model actions
+ * they are at the end of the node list and have invalid old clock vectors...
+ * They are already free at that point...
+ */
+
+ /* if (cv)
+ delete cv;*/
}
void ModelAction::copy_from_new(ModelAction *newaction)
//Make sure the promise's value matches the write's value
ASSERT(promise->get_value() == write->get_value());
+ delete(promise);
promises->erase(promises->begin() + promise_index);
resolved = true;
} else
/** Snapshotting malloc implementation for user programs. */
void *malloc( size_t size ) {
- if (mySpace)
+ if (mySpace) {
return mspace_malloc( mySpace, size );
- else
+ } else
return HandleEarlyAllocationRequest( size );
}
{
/* Diverging from previous execution; clear out remainder of list */
unsigned int it=iter+numAhead;
+ for(unsigned i=it;i<node_list.size();i++)
+ delete node_list[i];
node_list.resize(it);
}
int increment_threads() { return ++numthreads; }
uint64_t get_value() const { return value; }
+ SNAPSHOTALLOC
private:
const uint64_t value;
const modelclock_t expiration;
unsigned int numheappages, VoidFuncPtr entryPoint) {
/* Setup a stack for our signal handler.... */
stack_t ss;
- ss.ss_sp = model_malloc(SIGSTACKSIZE);
+ ss.ss_sp = PageAlignAddressUpward(model_malloc(SIGSTACKSIZE+PAGESIZE-1));
ss.ss_size = SIGSTACKSIZE;
ss.ss_flags = 0;
sigaltstack(&ss, NULL);
* @param a The parameter to pass to this function.
*/
Thread::Thread(thrd_t *t, void (*func)(void *), void *a) :
+ creation(NULL),
pending(NULL),
start_routine(func),
arg(a),