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
2ee0dda6
Commit
2ee0dda6
authored
7 years ago
by
Lukas Stadler
Browse files
Options
Downloads
Patches
Plain Diff
make cached case of CollectGenericArgumentsNode more useful
parent
25e616f8
Branches
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/src/com/oracle/truffle/r/nodes/objects/CollectGenericArgumentsNode.java
+10
-13
10 additions, 13 deletions
.../truffle/r/nodes/objects/CollectGenericArgumentsNode.java
with
10 additions
and
13 deletions
com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/objects/CollectGenericArgumentsNode.java
+
10
−
13
View file @
2ee0dda6
...
...
@@ -23,6 +23,7 @@
package
com.oracle.truffle.r.nodes.objects
;
import
com.oracle.truffle.api.CompilerDirectives
;
import
com.oracle.truffle.api.CompilerDirectives.CompilationFinal
;
import
com.oracle.truffle.api.dsl.Specialization
;
import
com.oracle.truffle.api.frame.MaterializedFrame
;
import
com.oracle.truffle.api.frame.VirtualFrame
;
...
...
@@ -57,6 +58,7 @@ public abstract class CollectGenericArgumentsNode extends RBaseNode {
// TODO: re-do with a multi-element cache? (list comparison will have some cost, though)
@Children
private
final
ClassHierarchyScalarNode
[]
classHierarchyNodes
;
@CompilationFinal
(
dimensions
=
1
)
private
final
ConditionProfile
[]
isArgsAndNamesProfiles
;
@Child
private
ClassHierarchyScalarNode
classHierarchyNodeSlowPath
;
@Child
private
PromiseCheckHelperNode
promiseHelper
=
new
PromiseCheckHelperNode
();
...
...
@@ -67,35 +69,31 @@ public abstract class CollectGenericArgumentsNode extends RBaseNode {
public
abstract
RStringVector
execute
(
VirtualFrame
frame
,
int
argLength
);
protected
CollectGenericArgumentsNode
(
int
argLength
)
{
ClassHierarchyScalarNode
[]
hierarchyNodes
=
new
ClassHierarchyScalarNode
[
argLength
];
classHierarchyNodes
=
new
ClassHierarchyScalarNode
[
argLength
];
isArgsAndNamesProfiles
=
new
ConditionProfile
[
argLength
];
for
(
int
i
=
0
;
i
<
argLength
;
i
++)
{
hierarchyNodes
[
i
]
=
ClassHierarchyScalarNodeGen
.
create
();
classHierarchyNodes
[
i
]
=
ClassHierarchyScalarNodeGen
.
create
();
isArgsAndNamesProfiles
[
i
]
=
ConditionProfile
.
createBinaryProfile
();
}
nProvidedArgs
=
argLength
;
classHierarchyNodes
=
hierarchyNodes
;
}
@ExplodeLoop
@Specialization
(
rewriteOn
=
SlowPathException
.
class
)
protected
RStringVector
combineCached
(
VirtualFrame
frame
,
int
argLength
)
throws
SlowPathException
{
int
nActualArgs
=
RArguments
.
getArgumentsLength
(
frame
);
if
(
argLength
!=
nProvidedArgs
||
!(
nActualArgs
==
nProvidedArgs
||
nActualArgs
==
nProvidedArgs
+
1
)
)
{
if
(
argLength
!=
nProvidedArgs
||
nActualArgs
<
nProvidedArgs
)
{
throw
new
SlowPathException
();
}
String
[]
result
=
new
String
[
nProvidedArgs
];
// The length of the actual and formal arguments may not be equal because "..." is just
// ignored in formals (i.e. '.SigArgs').
assert
nActualArgs
==
result
.
length
||
nActualArgs
==
result
.
length
+
1
;
// Intentionally using 'i' as loop variable since nActualArgs >=
// signatureArgumentNames.length
int
j
=
0
;
for
(
int
i
=
0
;
i
<
nProvidedArgs
;
i
++)
{
Object
value
=
RArguments
.
getArgument
(
frame
,
j
);
if
(
value
instanceof
RArgsValuesAndNames
)
{
j
++;
value
=
RArguments
.
getArgument
(
frame
,
j
);
Object
value
=
RArguments
.
getArgument
(
frame
,
j
++);
if
(
isArgsAndNamesProfiles
[
i
].
profile
(
value
instanceof
RArgsValuesAndNames
))
{
value
=
RArguments
.
getArgument
(
frame
,
j
++);
}
if
(
value
==
REmpty
.
instance
||
value
==
RMissing
.
instance
)
{
value
=
null
;
...
...
@@ -103,7 +101,6 @@ public abstract class CollectGenericArgumentsNode extends RBaseNode {
Object
evaledArg
=
promiseHelper
.
checkEvaluate
(
frame
,
value
);
assert
!(
evaledArg
instanceof
RArgsValuesAndNames
);
result
[
i
]
=
valueMissingProfile
.
profile
(
value
==
null
)
?
"missing"
:
classHierarchyNodes
[
i
].
executeString
(
evaledArg
);
j
++;
}
return
RDataFactory
.
createStringVector
(
result
,
RDataFactory
.
COMPLETE_VECTOR
);
}
...
...
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