Commit 2d900190 authored by Sven-Bodo Scholz's avatar Sven-Bodo Scholz
Browse files

improved function dispatch

No related merge requests found
Showing with 9 additions and 8 deletions
+9 -8
......@@ -202,7 +202,8 @@ DispatchFunCall (node *fundef, ntype *arg_types, info *arg_info)
* static dispatch possible!!
*
* We now know, that EITHER dft_res->def OR dft_res->deriveable
* are the only "definition" that matches here. However, there MAY
* are the only "definition" that matches here since any possible
* partial or deriveable partial is a specialisation. However, there MAY
* still be specialisations of that function in dft_res->partials or in
* dft_res->num_deriveable_partials that suit the given arguments
* better.
......@@ -242,6 +243,12 @@ DispatchFunCall (node *fundef, ntype *arg_types, info *arg_info)
CTIitemName (new_fundef));
}
}
} else if ((dft_res->num_partials + dft_res->num_deriveable_partials == 1)
&& (dft_res->def == NULL) && (dft_res->deriveable == NULL)) {
new_fundef = (dft_res->num_partials == 1)
? dft_res->partials[0]
: dft_res->deriveable_partials[0];
DBUG_PRINT (" (3) dispatched statically %s", CTIitemName (new_fundef));
} else if (!CWChasWrapperCode (fundef)) {
/*
* static dispatch impossible,
......@@ -249,17 +256,11 @@ DispatchFunCall (node *fundef, ntype *arg_types, info *arg_info)
* if only a single instance is available, do the dispatch
* statically and give a warning message, otherwise we are stuck here!
*/
if ((dft_res->num_partials + dft_res->num_deriveable_partials == 1)
&& (dft_res->def == NULL) && (dft_res->deriveable == NULL)) {
new_fundef = (dft_res->num_partials == 1)
? dft_res->partials[0]
: dft_res->deriveable_partials[0];
if (new_fundef != NULL) {
CTIwarnLine (global.linenum,
"Application of var-arg function %s found which may"
" cause a type error",
CTIitemName (new_fundef));
DBUG_PRINT (" dispatched statically although only partial"
" has been found (T_dots)!");
} else {
DBUG_UNREACHABLE (
"wrapper with T_dots found which could be dispatched statically!");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment