diff options
-rw-r--r-- | backendC/CleanCompilerSources/codegen2.c | 18 | ||||
-rw-r--r-- | backendC/CleanCompilerSources/codegen3.c | 12 |
2 files changed, 26 insertions, 4 deletions
diff --git a/backendC/CleanCompilerSources/codegen2.c b/backendC/CleanCompilerSources/codegen2.c index f8d0d49..775f686 100644 --- a/backendC/CleanCompilerSources/codegen2.c +++ b/backendC/CleanCompilerSources/codegen2.c @@ -2898,6 +2898,22 @@ LabDef *unboxed_cons_label (SymbolP cons_symbol_p) } #endif +#if STRICT_LISTS +int simple_expression_without_node_ids (NodeP node_p) +{ + if (node_p->node_kind==NormalNode){ + ArgP arg_p; + + for_l (arg_p,node_p->node_arguments,arg_next) + if (!simple_expression_without_node_ids (arg_p->arg_node)) + return False; + + return True; + } + return False; +} +#endif + static void FillNormalNode (Node node,int *asp_p,int *bsp_p,NodeId update_node_id,CodeGenNodeIdsP code_gen_node_ids_p) { Symbol symb; @@ -3082,7 +3098,7 @@ static void FillNormalNode (Node node,int *asp_p,int *bsp_p,NodeId update_node_i return; case nil_symb: #if STRICT_LISTS - if (symb->symb_head_strictness & 1){ + if ((symb->symb_head_strictness & 1) && !simple_expression_without_node_ids (node->node_arguments->arg_node)){ BuildArg (node->node_arguments,asp_p,bsp_p,code_gen_node_ids_p); GenPopA (1); --*asp_p; diff --git a/backendC/CleanCompilerSources/codegen3.c b/backendC/CleanCompilerSources/codegen3.c index bbd9ceb..21c8703 100644 --- a/backendC/CleanCompilerSources/codegen3.c +++ b/backendC/CleanCompilerSources/codegen3.c @@ -707,6 +707,10 @@ static int CodeRhsNodeDefsAndRestoreNodeIdStates (Node root_node,NodeDefs defs,i #define BETWEEN(l,h,v) ((unsigned)((v)-(l)) <= (unsigned)((h)-(l))) +#if STRICT_LISTS +extern int simple_expression_without_node_ids (NodeP node_p); +#endif + static void CodeNormalRootNode (Node root,NodeId rootid,int asp,int bsp,CodeGenNodeIdsP code_gen_node_ids_p,StateS resultstate) { Symbol rootsymb; @@ -792,9 +796,11 @@ static void CodeNormalRootNode (Node root,NodeId rootid,int asp,int bsp,CodeGenN case nil_symb: #if STRICT_LISTS if (rootsymb->symb_head_strictness & 1){ - BuildArg (root->node_arguments,&asp,&bsp,code_gen_node_ids_p); - GenPopA (1); - --asp; + if (!simple_expression_without_node_ids (root->node_arguments->arg_node)){ + BuildArg (root->node_arguments,&asp,&bsp,code_gen_node_ids_p); + GenPopA (1); + --asp; + } if (resultstate.state_kind==StrictRedirection){ GenPopA (asp); |