Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sven-Bodo Scholz
sac2c
Commits
2d900190
Commit
2d900190
authored
3 years ago
by
Sven-Bodo Scholz
Browse files
Options
Download
Email Patches
Plain Diff
improved function dispatch
parent
dc5b44fe
hotfix-1288
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/libsac2c/typecheck/dispatchfuncalls.c
+9
-8
src/libsac2c/typecheck/dispatchfuncalls.c
with
9 additions
and
8 deletions
+9
-8
src/libsac2c/typecheck/dispatchfuncalls.c
+
9
-
8
View file @
2d900190
...
...
@@ -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!"
);
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help