Skip to content

Commit

Permalink
fix bug in memory management
Browse files Browse the repository at this point in the history
  • Loading branch information
dongfanghong committed Jan 9, 2017
1 parent aff87a3 commit 8fe0e42
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions simpleruntime.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@ Value * releaseValue(Value * p){
} else if (p->type==VALUE_EXCEPTION){

}
allocateValue(p);
}
allocateValue(p);
}
return NULL;
}
Expand Down Expand Up @@ -752,7 +752,7 @@ Value * resolveValue(Value * v){ // v : stolen returns: stolen
v->r_exp=nexp;
v->r_context=context;
v->r_cont=ncont;
//releaseContinuationSingle(cont);
releaseContinuationSingle(cont);
}
}// else other expression types
}
Expand Down Expand Up @@ -932,8 +932,8 @@ int executeValue(Value * v,int argc,char ** args){
ncont->cont=NULL;
Value * nv=newValue();
nv->type=VALUE_RUNNING;
nv->r_exp=sys_cont->exp;
nv->r_context=sys_cont->context;
nv->r_exp=retainVExp(sys_cont->exp);
nv->r_context=retainVContext(sys_cont->context);
nv->r_cont=ncont;
v=nv;
}
Expand Down Expand Up @@ -1062,26 +1062,14 @@ int executeVExp(VExp * exp,int argc,char ** argv){
return executeValue(v,argc,argv);
}

/*{
int resultcode =executeVExp(makeApply(
/*int main(int argc,char ** argv){
return executeVExp(makeApply(
makeAbs(
makeRef(0)),
makeApply(
makeApply(
makeBuiltin("systemCmd"),
makeApply(
makeApply(
makeBuiltin("makeIntList"),
makeInt(115)),
makeInt(108))),
makeAbs(
makeApply(
makeBuiltin("exit"),
makeInt(0))))));
//printf("\nhere\n");
//printf("%d",resultcode);
makeBuiltin("putChar"),
makeInt(67)),
makeBuiltin("exit"))),argc,argv);
}*/

0 comments on commit 8fe0e42

Please sign in to comment.