diff options
-rw-r--r-- | backendC/CleanCompilerSources/codegen2.c | 33 | ||||
-rw-r--r-- | backendC/CleanCompilerSources/codegen3.c | 10 |
2 files changed, 37 insertions, 6 deletions
diff --git a/backendC/CleanCompilerSources/codegen2.c b/backendC/CleanCompilerSources/codegen2.c index 81690b0..3deeed8 100644 --- a/backendC/CleanCompilerSources/codegen2.c +++ b/backendC/CleanCompilerSources/codegen2.c @@ -227,6 +227,27 @@ void UnpackArray (int aindex, int *asp_p, Bool removeroot) *asp_p += SizeOfAStackElem; } +#if 0 /* defined (_WINDOWS_) */ +void trace (char *s) +{ + DWORD n_chars; + + n_chars = strlen (s); + WriteFile (GetStdHandle (STD_OUTPUT_HANDLE),s,n_chars,&n_chars,NULL); +} + +void trace_si (char *e,int i) +{ + DWORD n_chars; + char s[128]; + + sprintf (s,"%s %d\n",e,i); + + n_chars = strlen (s); + WriteFile (GetStdHandle (STD_OUTPUT_HANDLE),s,n_chars,&n_chars,NULL); +} +#endif + Coercions CoerceStateKind (StateKind dem_state_kind, StateKind off_state_kind) { if (dem_state_kind==Undefined) @@ -3276,10 +3297,14 @@ static void FillNormalNode (Node node,int *asp_p,int *bsp_p,NodeId update_node_i old_asp=*asp_p; old_bsp=*bsp_p; BuildArg (node->node_arguments,asp_p,bsp_p,code_gen_node_ids_p); - GenPopA (*asp_p-old_asp); - GenPopA (*bsp_p-old_bsp); - *asp_p=old_asp; - *bsp_p=old_bsp; + if (*asp_p>=old_asp){ + GenPopA (*asp_p-old_asp); + *asp_p=old_asp; + } + if (*bsp_p>=old_bsp){ + GenPopB (*bsp_p-old_bsp); + *bsp_p=old_bsp; + } if (update_node_id==NULL){ ArgP arg2_arg; diff --git a/backendC/CleanCompilerSources/codegen3.c b/backendC/CleanCompilerSources/codegen3.c index cfe7178..28b783e 100644 --- a/backendC/CleanCompilerSources/codegen3.c +++ b/backendC/CleanCompilerSources/codegen3.c @@ -981,8 +981,14 @@ static void CodeNormalRootNode (Node root,NodeId rootid,int asp,int bsp,CodeGenN old_asp=asp; old_bsp=bsp; BuildArg (root->node_arguments,&asp,&bsp,code_gen_node_ids_p); - GenPopA (asp-old_asp); - GenPopB (bsp-old_bsp); + if (asp>=old_asp) + GenPopA (asp-old_asp); + else + old_asp=asp; + if (bsp>=old_bsp) + GenPopB (bsp-old_bsp); + else + old_bsp=bsp; /* asp=old_asp; bsp=old_bsp; */ CodeRootNode (root->node_arguments->arg_next->arg_node,rootid,old_asp,old_bsp,code_gen_node_ids_p,resultstate,NULL); |