Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
f3cd1289
Commit
f3cd1289
authored
8 years ago
by
Zbynek Slajchrt
Browse files
Options
Downloads
Patches
Plain Diff
"Dead" specializations detected by rbdiag
parent
098c1137
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/RBuiltinDiagnostics.java
+30
-4
30 additions, 4 deletions
.../com/oracle/truffle/r/nodes/test/RBuiltinDiagnostics.java
with
30 additions
and
4 deletions
com.oracle.truffle.r.nodes.test/src/com/oracle/truffle/r/nodes/test/RBuiltinDiagnostics.java
+
30
−
4
View file @
f3cd1289
...
...
@@ -27,6 +27,8 @@ import java.lang.reflect.Modifier;
import
java.lang.reflect.Type
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
...
...
@@ -35,6 +37,8 @@ import java.util.Optional;
import
java.util.Set
;
import
java.util.stream.Collectors
;
import
javax.imageio.metadata.IIOInvalidTreeException
;
import
com.oracle.truffle.api.dsl.Specialization
;
import
com.oracle.truffle.api.frame.Frame
;
import
com.oracle.truffle.r.nodes.access.variables.ReadVariableNode
;
...
...
@@ -222,6 +226,8 @@ public class RBuiltinDiagnostics {
System
.
out
.
println
(
"\nUnhandled argument combinations: "
+
nonCoveredArgsSet
.
size
());
System
.
out
.
println
(
""
);
printDeadSpecs
();
if
(
diagSuite
.
diagConfig
.
verbose
)
{
for
(
List
<
Type
>
uncoveredArgs
:
nonCoveredArgsSet
)
{
System
.
out
.
println
(
uncoveredArgs
.
stream
().
map
(
t
->
typeName
(
t
)).
collect
(
Collectors
.
toList
()));
...
...
@@ -229,6 +235,26 @@ public class RBuiltinDiagnostics {
}
}
private
void
printDeadSpecs
()
{
System
.
out
.
println
(
"Dead specializations: "
);
for
(
Map
.
Entry
<
Method
,
List
<
Set
<
Cast
>>>
resTpPerSpec
:
convResultTypePerSpec
.
entrySet
())
{
List
<
Set
<
Cast
>>
argsCasts
=
resTpPerSpec
.
getValue
();
List
<
Integer
>
missingCasts
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
argsCasts
.
size
();
i
++)
{
Set
<
Cast
>
argCasts
=
argsCasts
.
get
(
i
);
if
(
argCasts
.
isEmpty
())
{
missingCasts
.
add
(
i
);
}
}
if
(!
missingCasts
.
isEmpty
())
{
System
.
out
.
println
(
" "
+
methodName
(
resTpPerSpec
.
getKey
(),
missingCasts
));
}
}
System
.
out
.
println
(
""
);
}
protected
void
diagnosePipeline
(
int
i
)
{
TypeExpr
argResultSet
=
argResultSets
.
get
(
i
);
System
.
out
.
println
(
"\n Pipeline for '"
+
parameterNames
[
i
]
+
"' (arg["
+
i
+
"]):"
);
...
...
@@ -243,7 +269,7 @@ public class RBuiltinDiagnostics {
argCastInSpec
.
stream
().
forEach
(
partialCast
->
{
System
.
out
.
println
(
" "
+
partialCast
.
coverage
()
+
" ("
+
typeName
(
partialCast
.
inputType
())
+
"->"
+
typeName
(
partialCast
.
resultType
())
+
")"
+
" in "
+
methodName
(
entry
.
getKey
(),
curParIndex
));
methodName
(
entry
.
getKey
(),
Collections
.
singleton
(
curParIndex
))
)
;
unboundArgTypes
.
remove
(
partialCast
.
inputType
());
});
}
...
...
@@ -296,13 +322,13 @@ public class RBuiltinDiagnostics {
}
}
private
static
String
methodName
(
Method
m
,
int
markedParamInd
ex
)
{
final
int
markedParamRealInd
ex
=
getRealParamIndex
(
m
.
getParameterTypes
(),
markedParamIndex
);
private
static
String
methodName
(
Method
m
,
Collection
<
Integer
>
markedParamInd
ices
)
{
final
Set
<
Integer
>
markedParamRealInd
ices
=
markedParamIndices
.
stream
().
map
(
markedParamIndex
->
getRealParamIndex
(
m
.
getParameterTypes
(),
markedParamIndex
)
).
collect
(
Collectors
.
toSet
())
;
StringBuilder
sb
=
new
StringBuilder
();
int
i
=
0
;
for
(
Class
<?>
pt
:
m
.
getParameterTypes
())
{
final
String
tn
;
if
(
i
==
markedParamRealInd
ex
)
{
if
(
markedParamRealInd
ices
.
contains
(
i
)
)
{
tn
=
"*"
+
typeName
(
pt
)
+
"*"
;
}
else
{
tn
=
typeName
(
pt
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment