Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying too many arguments to a function object #1

Merged
merged 1 commit into from Apr 18, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions Epic/CodegenC.lhs
Expand Up @@ -20,8 +20,8 @@

> writeIFace :: [Decl] -> String
> writeIFace [] = ""
> writeIFace ((Decl name ret (Bind args _ _ _) _ _):xs) =
> "extern " ++ showC name ++ " ("++ showextargs (args) ++ ")" ++
> writeIFace ((Decl (UN name) ret (Bind args _ _ _) _ _):xs) =
> "extern " ++ name ++ " ("++ showextargs (args) ++ ")" ++
> " -> " ++ show ret ++ "\n" ++ writeIFace xs
> writeIFace (_:xs) = writeIFace xs

Expand Down
24 changes: 17 additions & 7 deletions evm/closure.c
Expand Up @@ -534,7 +534,7 @@ inline VAL CLOSURE_ADD5(VAL xin, VAL a1, VAL a2, VAL a3, VAL a4, VAL a5)
fn->arg_end[2] = a3;
fn->arg_end[3] = a4;
fn->arg_end[4] = a5;
fn->arg_end+=2;
fn->arg_end+=5;

return x;
}
Expand Down Expand Up @@ -684,7 +684,9 @@ inline VAL CLOSURE_APPLY1(VAL f, VAL a1)
block[got] = a1;
return (VAL)(finf->fn(block));
}
else return CLOSURE_ADD1(f,a1);
else if (finf->arity < (got+1)) {
return (VAL) DO_EVAL(CLOSURE_ADD1(f,a1), 0);
} else return CLOSURE_ADD1(f,a1);
}
else return aux_CLOSURE_APPLY1(f,a1);
}
Expand All @@ -705,8 +707,9 @@ inline VAL CLOSURE_APPLY2(VAL f, VAL a1, VAL a2)
block[got] = a1;
block[got+1] = a2;
return (VAL)(finf->fn(block));
}
else return CLOSURE_ADD2(f,a1,a2);
} else if (finf->arity < (got+2)) {
return (VAL) DO_EVAL(CLOSURE_ADD2(f,a1,a2), 0);
} else return CLOSURE_ADD2(f,a1,a2);
}
else return aux_CLOSURE_APPLY2(f,a1,a2);
}
Expand All @@ -724,7 +727,9 @@ inline VAL CLOSURE_APPLY3(VAL f, VAL a1, VAL a2, VAL a3)
block[got+2] = a3;
return (VAL)(finf->fn(block));
}
else return CLOSURE_ADD3(f,a1,a2,a3);
else if (finf->arity < (got+3)) {
return (VAL) DO_EVAL(CLOSURE_ADD3(f,a1,a2,a3), 0);
} else return CLOSURE_ADD3(f,a1,a2,a3);
}
else return aux_CLOSURE_APPLY3(f,a1,a2,a3);
}
Expand All @@ -743,7 +748,9 @@ inline VAL CLOSURE_APPLY4(VAL f, VAL a1, VAL a2, VAL a3, VAL a4)
block[got+3] = a4;
return (VAL)(finf->fn(block));
}
else return CLOSURE_ADD4(f,a1,a2,a3,a4);
else if (finf->arity < (got+4)) {
return (VAL) DO_EVAL(CLOSURE_ADD4(f,a1,a2,a3,a4), 0);
} else return CLOSURE_ADD4(f,a1,a2,a3,a4);
}
else return aux_CLOSURE_APPLY4(f,a1,a2,a3,a4);
}
Expand All @@ -763,7 +770,9 @@ inline VAL CLOSURE_APPLY5(VAL f, VAL a1, VAL a2, VAL a3, VAL a4, VAL a5)
block[got+4] = a5;
return (VAL)(finf->fn(block));
}
else return CLOSURE_ADD5(f,a1,a2,a3,a4,a5);
else if (finf->arity < (got+5)) {
return (VAL) DO_EVAL(CLOSURE_ADD5(f,a1,a2,a3,a4,a5), 0);
} else return CLOSURE_ADD5(f,a1,a2,a3,a4,a5);
}
else return aux_CLOSURE_APPLY5(f,a1,a2,a3,a4,a5);
}
Expand All @@ -783,6 +792,7 @@ VAL DO_EVAL(VAL x, int update) {
switch(GETTY(x)) {
case CON:
case INT:
case BIGINT:
case FLOAT:
case STRING:
case PTR:
Expand Down