Commit f701bbe3 authored by John van Groningen's avatar John van Groningen
Browse files

add integers and rationals

parent 856490d6
...@@ -27,6 +27,7 @@ void PushBasicOnB (ObjectKind state, int offset); ...@@ -27,6 +27,7 @@ void PushBasicOnB (ObjectKind state, int offset);
void UpdateBasic (int size, int srcoffset, int dstoffset); void UpdateBasic (int size, int srcoffset, int dstoffset);
void CallFunction (Label label, SymbDef def, Bool isjsr, Node root); void CallFunction (Label label, SymbDef def, Bool isjsr, Node root);
void CallFunction1 (Label label, SymbDef def, StateS root_state, Args fun_args, int arity);
void CallArrayFunction (SymbDef def,Bool isjsr,StateP node_state_p); void CallArrayFunction (SymbDef def,Bool isjsr,StateP node_state_p);
...@@ -66,6 +67,9 @@ void GenBuildU (Label symblab,int a_size,int b_size,Label contlab); ...@@ -66,6 +67,9 @@ void GenBuildU (Label symblab,int a_size,int b_size,Label contlab);
void GenBuildArray (int argoffset); void GenBuildArray (int argoffset);
void GenBuildString (SymbValue val); void GenBuildString (SymbValue val);
void GenPushZ (SymbValue val);
void GenPushZR (SymbValue val);
void GenBuildFieldSelector (Label symblab,Label contlab,char *record_name,int arity); void GenBuildFieldSelector (Label symblab,Label contlab,char *record_name,int arity);
void GenFillFieldSelector (Label symblab,Label contlab,char *record_name,int arity,int offset,FillKind fkind); void GenFillFieldSelector (Label symblab,Label contlab,char *record_name,int arity,int offset,FillKind fkind);
...@@ -91,6 +95,7 @@ void GenJsrAp (int n_args); ...@@ -91,6 +95,7 @@ void GenJsrAp (int n_args);
void GenJmpEval (void); void GenJmpEval (void);
void GenJmpAp (int n_args); void GenJmpAp (int n_args);
void GenJmpApUpd (int n_args); void GenJmpApUpd (int n_args);
void GenJmpNotEqZ (SymbValue val,Label tolab);
void GenJmpUpd (Label tolab); void GenJmpUpd (Label tolab);
void GenPopA (int nr); void GenPopA (int nr);
void GenPopB (int nr); void GenPopB (int nr);
...@@ -168,6 +173,7 @@ void GenApplyEntryDirective (int arity,Label label); ...@@ -168,6 +173,7 @@ void GenApplyEntryDirective (int arity,Label label);
void GenLazyRecordNodeEntryDirective (int arity,Label label,Label label2); void GenLazyRecordNodeEntryDirective (int arity,Label label,Label label2);
void GenFieldNodeEntryDirective (int arity, Label label, Label label2,char *record_name); void GenFieldNodeEntryDirective (int arity, Label label, Label label2,char *record_name);
void GenConstructorDescriptorAndExport (SymbDef sdef); void GenConstructorDescriptorAndExport (SymbDef sdef);
void GenConstructor0DescriptorAndExport (SymbDef sdef,int constructor_n);
void GenFunctionDescriptorAndExportNodeAndDescriptor (SymbDef sdef); void GenFunctionDescriptorAndExportNodeAndDescriptor (SymbDef sdef);
void GenConstructorFunctionDescriptorAndExportNodeAndDescriptor (SymbDef sdef); void GenConstructorFunctionDescriptorAndExportNodeAndDescriptor (SymbDef sdef);
#if OPTIMIZE_LAZY_TUPLE_RECURSION #if OPTIMIZE_LAZY_TUPLE_RECURSION
......
...@@ -497,9 +497,9 @@ static Node copy_root_node (Node old) ...@@ -497,9 +497,9 @@ static Node copy_root_node (Node old)
case_node_arg_p=case_node_p->node_arguments; case_node_arg_p=case_node_p->node_arguments;
new_case_node_p->node_su.su_u.u_case=CompAllocType (CaseNodeContentsS);
if (case_node_p->node_kind==CaseNode){ if (case_node_p->node_kind==CaseNode){
new_case_node_p->node_su.su_u.u_case=CompAllocType (CaseNodeContentsS);
new_case_node_p->node_node_defs = copy_rhs_node_ids_of_node_defs (case_node_p->node_node_defs,NULL); new_case_node_p->node_node_defs = copy_rhs_node_ids_of_node_defs (case_node_p->node_node_defs,NULL);
if (case_node_arg_p->arg_node->node_kind==PushNode){ if (case_node_arg_p->arg_node->node_kind==PushNode){
...@@ -570,9 +570,49 @@ static Node copy_root_node (Node old) ...@@ -570,9 +570,49 @@ static Node copy_root_node (Node old)
new_case_node_arg_p->arg_node = copy_root_node (case_node_arg_p->arg_node); new_case_node_arg_p->arg_node = copy_root_node (case_node_arg_p->arg_node);
} }
} else if (case_node_p->node_kind==DefaultNode){ } else if (case_node_p->node_kind==DefaultNode){
new_case_node_p->node_su.su_u.u_case=CompAllocType (CaseNodeContentsS);
new_case_node_p->node_node_defs = copy_rhs_node_ids_of_node_defs (case_node_p->node_node_defs,NULL);
copy_nodes_of_node_defs (new_case_node_p->node_node_defs,False);
new_case_node_arg_p->arg_node = copy_root_node (case_node_arg_p->arg_node);
} else if (case_node_p->node_kind==OverloadedCaseNode){
NodeP new_overloaded_case_node_p;
ArgP new_overloaded_case_node_arg2_p;
new_overloaded_case_node_arg2_p=CompAllocType (ArgS);
new_overloaded_case_node_arg2_p->arg_state=LazyState;
new_overloaded_case_node_arg2_p->arg_next=NULL;
new_case_node_arg_p->arg_next=new_overloaded_case_node_arg2_p;
new_case_node_arg_p->arg_node=copy_node (case_node_arg_p->arg_node,False);
new_overloaded_case_node_arg2_p->arg_node=copy_node (case_node_arg_p->arg_next->arg_node,False);
case_node_p=case_node_p->node_node;
new_overloaded_case_node_p=new_case_node_p;
new_case_node_p = CompAllocType (NodeS);
*new_case_node_p = *case_node_p;
new_overloaded_case_node_p->node_node = new_case_node_p;
new_case_node_arg_p=CompAllocType (ArgS);
new_case_node_arg_p->arg_state=LazyState;
new_case_node_p->node_arguments=new_case_node_arg_p;
new_case_node_arg_p->arg_next=NULL;
case_node_arg_p=case_node_p->node_arguments;
new_case_node_p->node_su.su_u.u_case=CompAllocType (CaseNodeContentsS);
new_case_node_p->node_node_defs = copy_rhs_node_ids_of_node_defs (case_node_p->node_node_defs,NULL); new_case_node_p->node_node_defs = copy_rhs_node_ids_of_node_defs (case_node_p->node_node_defs,NULL);
copy_nodes_of_node_defs (new_case_node_p->node_node_defs,False); copy_nodes_of_node_defs (new_case_node_p->node_node_defs,False);
new_case_node_arg_p->arg_node = copy_root_node (case_node_arg_p->arg_node); new_case_node_arg_p->arg_node = copy_root_node (case_node_arg_p->arg_node);
} else } else
error_in_function ("copy_root_node"); error_in_function ("copy_root_node");
...@@ -3086,6 +3126,23 @@ static void optimise_root_node (NodeP node,NodeDefP node_defs,FreeUniqueNodeIdsP ...@@ -3086,6 +3126,23 @@ static void optimise_root_node (NodeP node,NodeDefP node_defs,FreeUniqueNodeIdsP
optimise_root_node (case_alt_node_p,case_node->node_node_defs,case_f_node_ids); optimise_root_node (case_alt_node_p,case_node->node_node_defs,case_f_node_ids);
set_global_reference_counts (case_node); set_global_reference_counts (case_node);
} else if (case_node->node_kind==OverloadedCaseNode){
NodeP case_alt_node_p;
FreeUniqueNodeIdsP case_f_node_ids;
case_node=case_node->node_node;
case_f_node_ids=f_node_ids;
case_alt_node_p=case_node->node_arguments->arg_node;
set_local_reference_counts (case_node);
optimise_root_node (case_alt_node_p,case_node->node_node_defs,case_f_node_ids);
set_global_reference_counts (case_node);
} else } else
error_in_function ("optimise_root_node"); error_in_function ("optimise_root_node");
} }
...@@ -3609,10 +3666,21 @@ static void ReorderNodeDefinitionsAndDetermineUsedEntries (NodeDefs *def_p,Node ...@@ -3609,10 +3666,21 @@ static void ReorderNodeDefinitionsAndDetermineUsedEntries (NodeDefs *def_p,Node
error_in_function ("ReorderNodeDefinitionsAndDetermineUsedEntries"); error_in_function ("ReorderNodeDefinitionsAndDetermineUsedEntries");
for_l (arg,root->node_arguments,arg_next){ for_l (arg,root->node_arguments,arg_next){
if (arg->arg_node->node_kind!=CaseNode && arg->arg_node->node_kind!=DefaultNode) if (arg->arg_node->node_kind==OverloadedCaseNode){
error_in_function ("ReorderNodeDefinitionsAndDetermineUsedEntries"); NodeP overloaded_case_node_p,case_node_p;
overloaded_case_node_p=arg->arg_node;
MarkDependentNodeDefs (overloaded_case_node_p->node_arguments->arg_node);
MarkDependentNodeDefs (overloaded_case_node_p->node_arguments->arg_next->arg_node);
case_node_p=overloaded_case_node_p->node_node;
ReorderNodeDefinitionsAndDetermineUsedEntries (&case_node_p->node_node_defs,case_node_p->node_arguments->arg_node);
} else {
if (arg->arg_node->node_kind!=CaseNode && arg->arg_node->node_kind!=DefaultNode && arg->arg_node->node_kind!=OverloadedCaseNode)
error_in_function ("ReorderNodeDefinitionsAndDetermineUsedEntries");
ReorderNodeDefinitionsAndDetermineUsedEntries (&arg->arg_node->node_node_defs,arg->arg_node->node_arguments->arg_node); ReorderNodeDefinitionsAndDetermineUsedEntries (&arg->arg_node->node_node_defs,arg->arg_node->node_arguments->arg_node);
}
} }
return; return;
...@@ -3621,7 +3689,7 @@ static void ReorderNodeDefinitionsAndDetermineUsedEntries (NodeDefs *def_p,Node ...@@ -3621,7 +3689,7 @@ static void ReorderNodeDefinitionsAndDetermineUsedEntries (NodeDefs *def_p,Node
ReorderNodeDefinitionsAndDetermineUsedEntries (&root->node_node_defs,root->node_arguments->arg_next->arg_node); ReorderNodeDefinitionsAndDetermineUsedEntries (&root->node_node_defs,root->node_arguments->arg_next->arg_node);
return; return;
} }
reordered_defs_p=&reordered_defs; reordered_defs_p=&reordered_defs;
MarkNodeDefsWithProperty (*def_p,&IsObservedDef); MarkNodeDefsWithProperty (*def_p,&IsObservedDef);
...@@ -3847,6 +3915,18 @@ static void determine_then_else_ref_counts (NodeP node) ...@@ -3847,6 +3915,18 @@ static void determine_then_else_ref_counts (NodeP node)
set_global_reference_counts (case_node); set_global_reference_counts (case_node);
--node->node_node_id->nid_refcount; --node->node_node_id->nid_refcount;
} else if (case_node->node_kind==OverloadedCaseNode){
case_node=case_node->node_node;
++node->node_node_id->nid_refcount;
set_local_reference_counts (case_node);
determine_then_else_ref_counts (case_node->node_arguments->arg_node);
set_global_reference_counts (case_node);
--node->node_node_id->nid_refcount;
} else } else
error_in_function ("determine_then_else_ref_counts"); error_in_function ("determine_then_else_ref_counts");
} }
......
...@@ -776,7 +776,7 @@ static int determine_failing_cases_and_adjust_ref_counts (NodeP node,NodeIdRefCo ...@@ -776,7 +776,7 @@ static int determine_failing_cases_and_adjust_ref_counts (NodeP node,NodeIdRefCo
node_id_ref_count_list_sorted=0; node_id_ref_count_list_sorted=0;
for (arg=node->node_arguments; arg!=NULL; arg=arg->arg_next) for (arg=node->node_arguments; arg!=NULL; arg=arg->arg_next)
if (arg->arg_node->node_kind!=CaseNode) if (arg->arg_node->node_kind!=CaseNode && arg->arg_node->node_kind!=OverloadedCaseNode)
break; break;
default_may_fail=1; default_may_fail=1;
...@@ -853,6 +853,9 @@ static int determine_failing_cases_and_adjust_ref_counts (NodeP node,NodeIdRefCo ...@@ -853,6 +853,9 @@ static int determine_failing_cases_and_adjust_ref_counts (NodeP node,NodeIdRefCo
arg_node=arg->arg_node; arg_node=arg->arg_node;
switch (arg_node->node_kind){ switch (arg_node->node_kind){
case OverloadedCaseNode:
arg_node = arg_node->node_node;
/* no break */
case CaseNode: case CaseNode:
{ {
int case_may_fail; int case_may_fail;
......
...@@ -2136,6 +2136,11 @@ static void InitNode (Node node) ...@@ -2136,6 +2136,11 @@ static void InitNode (Node node)
InitNode (case_alt_node_p); InitNode (case_alt_node_p);
InitNodeDefs (node_p->node_node_defs); InitNodeDefs (node_p->node_node_defs);
} else if (node_p->node_kind==OverloadedCaseNode){
node_p=node_p->node_node;
InitNode (node_p->node_arguments->arg_node);
InitNodeDefs (node_p->node_node_defs);
} else if (node_p->node_kind==DefaultNode){ } else if (node_p->node_kind==DefaultNode){
InitNode (node_p->node_arguments->arg_node); InitNode (node_p->node_arguments->arg_node);
InitNodeDefs (node_p->node_node_defs); InitNodeDefs (node_p->node_node_defs);
...@@ -2683,7 +2688,12 @@ static void convert_switch_node (NodeP switch_node_p,Alts fun_alt_p) ...@@ -2683,7 +2688,12 @@ static void convert_switch_node (NodeP switch_node_p,Alts fun_alt_p)
} }
} else if (node_p->node_kind==DefaultNode){ } else if (node_p->node_kind==DefaultNode){
case_alt_node_p=node_p->node_arguments->arg_node; case_alt_node_p=node_p->node_arguments->arg_node;
case_alt_p->fun_lhs=NULL; case_alt_p->fun_lhs=NULL;
} else if (node_p->node_kind==OverloadedCaseNode){
node_p=node_p->node_node;
case_alt_node_p=node_p->node_arguments->arg_node;
case_alt_p->fun_lhs=⊤
} else } else
error_in_function ("convert_switch_node"); error_in_function ("convert_switch_node");
......
...@@ -31,64 +31,69 @@ static void set_node_id_scope_numbers (NodeDefP node_defs,int local_scope) ...@@ -31,64 +31,69 @@ static void set_node_id_scope_numbers (NodeDefP node_defs,int local_scope)
static void set_root_scope_numbers (NodeP node_p,int local_scope) static void set_root_scope_numbers (NodeP node_p,int local_scope)
{ {
/* RWS added switch nodes */ switch (node_p->node_kind){
switch (node_p->node_kind)
{
case IfNode: case IfNode:
{ {
int new_local_scope; int new_local_scope;
ArgP arg_p; ArgP arg_p;
node_p->node_if_scope=scope; node_p->node_if_scope=scope;
new_local_scope=scope+2;
scope+=3;
arg_p=node_p->node_arguments;
set_root_scope_numbers (arg_p->arg_node,local_scope);
++scope;
arg_p=arg_p->arg_next;
set_root_scope_numbers (arg_p->arg_node,new_local_scope);
set_node_id_scope_numbers (node_p->node_then_node_defs,new_local_scope);
++scope;
arg_p=arg_p->arg_next;
set_root_scope_numbers (arg_p->arg_node,new_local_scope);
set_node_id_scope_numbers (node_p->node_else_node_defs,new_local_scope);
new_local_scope=scope+2;
scope+=3;
arg_p=node_p->node_arguments;
set_root_scope_numbers (arg_p->arg_node,local_scope);
++scope;
arg_p=arg_p->arg_next;
set_root_scope_numbers (arg_p->arg_node,new_local_scope);
set_node_id_scope_numbers (node_p->node_then_node_defs,new_local_scope);
++scope;
arg_p=arg_p->arg_next;
set_root_scope_numbers (arg_p->arg_node,new_local_scope);
set_node_id_scope_numbers (node_p->node_else_node_defs,new_local_scope);
}
break; break;
}
case SwitchNode: case SwitchNode:
{ {
ArgP arg_p; ArgP arg_p;
int old_scope; int old_scope;
old_scope=scope; old_scope=scope;
for_l (arg_p,node_p->node_arguments,arg_next){ for_l (arg_p,node_p->node_arguments,arg_next){
NodeP node_p; NodeP node_p;
scope=old_scope; scope=old_scope;
node_p=arg_p->arg_node; node_p=arg_p->arg_node;
if (node_p->node_kind==CaseNode){ if (node_p->node_kind==CaseNode){
NodeP case_alt_node_p; NodeP case_alt_node_p;
case_alt_node_p=node_p->node_arguments->arg_node; case_alt_node_p=node_p->node_arguments->arg_node;
/* Cedewarrior bug if (case_alt_node_p->node_kind==PushNode) */ /* Cedewarrior bug if (case_alt_node_p->node_kind==PushNode) */
if (node_p->node_arguments->arg_node->node_kind==PushNode) if (node_p->node_arguments->arg_node->node_kind==PushNode)
set_root_scope_numbers (case_alt_node_p->node_arguments->arg_next->arg_node, local_scope); set_root_scope_numbers (case_alt_node_p->node_arguments->arg_next->arg_node, local_scope);
else else
set_root_scope_numbers (node_p->node_arguments->arg_node, local_scope);
} else if (node_p->node_kind==DefaultNode){
set_root_scope_numbers (node_p->node_arguments->arg_node, local_scope); set_root_scope_numbers (node_p->node_arguments->arg_node, local_scope);
} else } else if (node_p->node_kind==DefaultNode){
ErrorInCompiler ("set_scope_numbers.c", "set_root_scope_numbers", ""); set_root_scope_numbers (node_p->node_arguments->arg_node, local_scope);
} else if (node_p->node_kind==OverloadedCaseNode){
node_p=node_p->node_node;
set_root_scope_numbers (node_p->node_arguments->arg_node, local_scope);
set_node_id_scope_numbers (node_p->node_node_defs,local_scope); } else
} ErrorInCompiler ("set_scope_numbers.c", "set_root_scope_numbers", "");
set_node_id_scope_numbers (node_p->node_node_defs,local_scope);
} }
break; break;
}
case GuardNode: case GuardNode:
{ {
int old_scope; int old_scope;
......
...@@ -420,7 +420,7 @@ static void GenResultStatesOfLazyFields (SymbDef sdef) ...@@ -420,7 +420,7 @@ static void GenResultStatesOfLazyFields (SymbDef sdef)
for (i=0, fields = rectype->type_fields; fields; i++, fields = fields->fl_next){ for (i=0, fields = rectype->type_fields; fields; i++, fields = fields->fl_next){
TypeNode field_type_node = fields->fl_type; TypeNode field_type_node = fields->fl_type;
if (field_type_node->type_node_annotation!=StrictAnnot){ if (field_type_node->type_node_annotation!=StrictAnnot){
if (field_type_node->type_node_is_var || field_type_node->type_node_symbol->symb_kind==apply_symb) if (field_type_node->type_node_is_var || field_type_node->type_node_symbol->symb_kind==apply_symb)
SetUnaryState (&fields->fl_state, LazyRedirection, UnknownObj); SetUnaryState (&fields->fl_state, LazyRedirection, UnknownObj);
...@@ -570,6 +570,10 @@ static void ChangeElementStateForStrictAbsTypeFields (SymbDef icl_sdef,SymbDef d ...@@ -570,6 +570,10 @@ static void ChangeElementStateForStrictAbsTypeFields (SymbDef icl_sdef,SymbDef d
} }
} }
#ifdef CLEAN2
SymbDefP special_types[2];
#endif
void GenerateStatesForRecords (Symbol symbols) void GenerateStatesForRecords (Symbol symbols)
{ {
Symbol symb; Symbol symb;
...@@ -609,6 +613,11 @@ void GenerateStatesForRecords (Symbol symbols) ...@@ -609,6 +613,11 @@ void GenerateStatesForRecords (Symbol symbols)
} }
} }
} }
#ifdef CLEAN2
if (special_types[0]!=NULL)
BasicSymbolStates[integer_denot] = special_types[0]->sdef_record_state;
#endif
} }
/* /*
...@@ -2034,7 +2043,7 @@ static Bool NodeInAStrictContext (Node node,StateS demanded_state,int local_scop ...@@ -2034,7 +2043,7 @@ static Bool NodeInAStrictContext (Node node,StateS demanded_state,int local_scop
} }
definition_state_p = GetStateOfArguments (sdef,node->node_arity); definition_state_p = GetStateOfArguments (sdef,node->node_arity);
if (definition_state_p!=NULL){ if (definition_state_p!=NULL){
#ifdef FASTER_STRICT_AND_OR #ifdef FASTER_STRICT_AND_OR
if (sdef->sdef_module==StdBoolId->ident_name && node->node_arity==2){ if (sdef->sdef_module==StdBoolId->ident_name && node->node_arity==2){
...@@ -2117,7 +2126,7 @@ static Bool NodeInAStrictContext (Node node,StateS demanded_state,int local_scop ...@@ -2117,7 +2126,7 @@ static Bool NodeInAStrictContext (Node node,StateS demanded_state,int local_scop
} }
default: default:
if (rootsymb->symb_kind < Nr_Of_Predef_Types){ if (rootsymb->symb_kind < Nr_Of_Predef_Types){
node->node_state = BasicSymbolStates [rootsymb->symb_kind]; node->node_state = BasicSymbolStates [rootsymb->symb_kind];
node->node_state.state_kind = demanded_state.state_kind; node->node_state.state_kind = demanded_state.state_kind;
} }
break; break;
...@@ -2385,6 +2394,15 @@ static void DetermineStatesSwitchRootNode (Node root_node, StateS demstate, int ...@@ -2385,6 +2394,15 @@ static void DetermineStatesSwitchRootNode (Node root_node, StateS demstate, int
DetermineStatesOfRootNodeAndDefs (node->node_arguments->arg_node,&node->node_node_defs,demstate,local_scope); DetermineStatesOfRootNodeAndDefs (node->node_arguments->arg_node,&node->node_node_defs,demstate,local_scope);
} else if (node->node_kind==DefaultNode){ } else if (node->node_kind==DefaultNode){
DetermineStatesOfRootNodeAndDefs (node->node_arguments->arg_node,&node->node_node_defs,demstate,local_scope); DetermineStatesOfRootNodeAndDefs (node->node_arguments->arg_node,&node->node_node_defs,demstate,local_scope);
} else if (node->node_kind==OverloadedCaseNode){
NodeP case_node_p;
DetermineStrictArgContext (node->node_arguments,StrictState,local_scope);
if (ShouldDecrRefCount)
DecrRefCountCopiesOfArg (node->node_arguments->arg_next IF_OPTIMIZE_LAZY_TUPLE_RECURSION(local_scope));
case_node_p=node->node_node;
DetermineStatesOfRootNodeAndDefs (case_node_p->node_arguments->arg_node,&case_node_p->node_node_defs,demstate,local_scope);
} else } else
error_in_function ("DetermineStatesSwitchRootNode"); error_in_function ("DetermineStatesSwitchRootNode");
} }
...@@ -2785,6 +2803,8 @@ static void DetermineStatesOfNodeAndDefs (Node root_node,NodeDefs node_defs,Stat ...@@ -2785,6 +2803,8 @@ static void DetermineStatesOfNodeAndDefs (Node root_node,NodeDefs node_defs,Stat
DetermineStatesOfNodeAndDefs (case_alt_node_p,arg_node_p->node_node_defs,demstate,local_scope); DetermineStatesOfNodeAndDefs (case_alt_node_p,arg_node_p->node_node_defs,demstate,local_scope);
} else if (arg_node_p->node_kind==DefaultNode){ } else if (arg_node_p->node_kind==DefaultNode){
DetermineStatesOfNodeAndDefs (arg_node_p->node_arguments->arg_node,arg_node_p->node_node_defs,demstate,local_scope); DetermineStatesOfNodeAndDefs (arg_node_p->node_arguments->arg_node,arg_node_p->node_node_defs,demstate,local_scope);
} else if (arg_node_p->node_kind==OverloadedCaseNode){
DetermineStatesOfNodeAndDefs (arg_node_p->node_node->node_arguments->arg_node,arg_node_p->node_node->node_node_defs,demstate,local_scope);
} else } else
error_in_function ("DetermineStatesOfNodeAndDefs"); error_in_function ("DetermineStatesOfNodeAndDefs");
} }
...@@ -3160,6 +3180,8 @@ static NodeP add_argument_to_switch_node (NodeP rhs_root_p,NodeIdP new_node_id_p ...@@ -3160,6 +3180,8 @@ static NodeP add_argument_to_switch_node (NodeP rhs_root_p,NodeIdP new_node_id_p
node_h=&(*node_h)->node_arguments->arg_next->arg_node; node_h=&(*node_h)->node_arguments->arg_next->arg_node;
} else if (node_p->node_kind==DefaultNode){ } else if (node_p->node_kind==DefaultNode){
node_h=&node_p->node_arguments->arg_node; node_h=&node_p->node_arguments->arg_node;
} else if (node_p->node_kind==OverloadedCaseNode){
node_h=&node_p->node_node->node_arguments->arg_node;
} else } else
error_in_function ("add_argument_to_switch_node"); error_in_function ("add_argument_to_switch_node");
...@@ -3680,8 +3702,7 @@ static NodeDefs *CollectSharedNodeIdsInRootNode (Node* node_p,NodeId parent_node ...@@ -3680,8 +3702,7 @@ static NodeDefs *CollectSharedNodeIdsInRootNode (Node* node_p,NodeId parent_node
root_node=*node_p; root_node=*node_p;
switch (root_node->node_kind) switch (root_node->node_kind){
{
case SwitchNode: case SwitchNode:
{ {
ArgP arg_p; ArgP arg_p;
...@@ -3697,9 +3718,8 @@ static NodeDefs *CollectSharedNodeIdsInRootNode (Node* node_p,NodeId parent_node ...@@ -3697,9 +3718,8 @@ static NodeDefs *CollectSharedNodeIdsInRootNode (Node* node_p,NodeId parent_node
case_alt_node_p=node->node_arguments->arg_node; case_alt_node_p=node->node_arguments->arg_node;
case_last=&node->node_node_defs; case_last=&node->node_node_defs;
/* Codewarrior bug if (case_alt_node_p->node_kind==PushNode){ */ /* Codewarrior bug if (case_alt_node_p->node_kind==PushNode){ */
if (node->node_arguments->arg_node->node_kind==PushNode){ if (node->node_arguments->arg_node->node_kind==PushNode)
case_last=CollectSharedNodeIdsInRootNode (&case_alt_node_p->node_arguments->arg_next->arg_node, parent_node_id, case_last); case_last=CollectSharedNodeIdsInRootNode (&case_alt_node_p->node_arguments->arg_next->arg_node, parent_node_id, case_last);
}
else else
case_last=CollectSharedNodeIdsInRootNode (&node->node_arguments->arg_node, parent_node_id, case_last); case_last=CollectSharedNodeIdsInRootNode (&node->node_arguments->arg_node, parent_node_id, case_last);
*case_last=NULL; *case_last=NULL;
...@@ -3709,6 +3729,22 @@ static NodeDefs *CollectSharedNodeIdsInRootNode (Node* node_p,NodeId parent_node ...@@ -3709,6 +3729,22 @@ static NodeDefs *CollectSharedNodeIdsInRootNode (Node* node_p,NodeId parent_node
default_last=&node->node_node_defs; default_last=&node->node_node_defs;
default_last=CollectSharedNodeIdsInRootNode (&node->node_arguments->arg_node, parent_node_id, default_last); default_last=CollectSharedNodeIdsInRootNode (&node->node_arguments->arg_node, parent_node_id, default_last);
*default_last=NULL; *default_last=NULL;
} else if (node->node_kind==OverloadedCaseNode){
NodeP case_node_p;
NodeDefs *case_last;
ArgP arg;
arg=node->node_arguments;
arg->arg_state=LazyState;
last = CollectSharedNodeIdsInNode (&arg->arg_node,parent_node_id,last);
arg=arg->arg_next;
arg->arg_state=LazyState;
last = CollectSharedNodeIdsInNode (&arg->arg_node,parent_node_id,last);
case_node_p=node->node_node;
case_last=&case_node_p->node_node_defs;
case_last=CollectSharedNodeIdsInRootNode (&case_node_p->node_arguments->arg_node, parent_node_id, case_last);
*case_last=NULL;
} else } else
error_in_function ("CollectSharedNodeIdsInRootNode"); error_in_function ("CollectSharedNodeIdsInRootNode");
} }
...@@ -3765,11 +3801,11 @@ static void CollectSharedAndAnnotatedNodesInRhs (NodeS **root_p,NodeDefS **defs_ ...@@ -3765,11 +3801,11 @@ static void CollectSharedAndAnnotatedNodesInRhs (NodeS **root_p,NodeDefS **defs_
if ((imp_rule_p->rule_mark & RULE_LAMBDA_FUNCTION_MASK) && if ((imp_rule_p->rule_mark & RULE_LAMBDA_FUNCTION_MASK) &&
root_node->node_symbol->symb_def->sdef_arity==root_node->node_arity && root_node->node_symbol->symb_def->sdef_arity==root_node->node_arity &&
imp_rule_p->rule_alts->alt_next==NULL imp_rule_p->rule_alts->alt_next==NULL