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
0d0f3b99
Commit
0d0f3b99
authored
8 years ago
by
Adam Welc
Browse files
Options
Downloads
Patches
Plain Diff
Rewritten parameter casts for the unlist builtin.
parent
cab08b52
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.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unlist.java
+11
-15
11 additions, 15 deletions
...n/src/com/oracle/truffle/r/nodes/builtin/base/Unlist.java
with
11 additions
and
15 deletions
com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Unlist.java
+
11
−
15
View file @
0d0f3b99
...
...
@@ -11,11 +11,13 @@
*/
package
com.oracle.truffle.r.nodes.builtin.base
;
import
static
com
.
oracle
.
truffle
.
r
.
nodes
.
builtin
.
CastBuilder
.
Predef
.*;
import
static
com
.
oracle
.
truffle
.
r
.
runtime
.
builtins
.
RBehavior
.
PURE
;
import
static
com
.
oracle
.
truffle
.
r
.
runtime
.
builtins
.
RBuiltinKind
.
INTERNAL
;
import
com.oracle.truffle.api.CompilerDirectives
;
import
com.oracle.truffle.api.CompilerDirectives.TruffleBoundary
;
import
com.oracle.truffle.api.dsl.Fallback
;
import
com.oracle.truffle.api.dsl.Specialization
;
import
com.oracle.truffle.api.dsl.TypeSystemReference
;
import
com.oracle.truffle.api.frame.VirtualFrame
;
...
...
@@ -47,8 +49,8 @@ public abstract class Unlist extends RBuiltinNode {
@Override
protected
void
createCasts
(
CastBuilder
casts
)
{
casts
.
first
Boolean
(
1
);
casts
.
first
Boolean
(
2
);
casts
.
arg
(
"recursive"
).
asLogicalVector
().
findFirst
(
RRuntime
.
LOGICAL_TRUE
).
map
(
to
Boolean
(
)
);
casts
.
arg
(
"use.names"
).
asLogicalVector
().
findFirst
(
RRuntime
.
LOGICAL_TRUE
).
map
(
to
Boolean
(
)
);
}
@Child
private
PrecedenceNode
precedenceNode
=
PrecedenceNodeGen
.
create
();
...
...
@@ -143,21 +145,9 @@ public abstract class Unlist extends RBuiltinNode {
return
RNull
.
instance
;
}
@SuppressWarnings
(
"unused"
)
@Specialization
(
guards
=
"!isVectorList(vector)"
)
protected
RAbstractVector
unlistVector
(
RAbstractVector
vector
,
boolean
recursive
,
boolean
useNames
)
{
return
vector
;
}
@SuppressWarnings
(
"unused"
)
@Specialization
(
guards
=
"isEmpty(list)"
)
protected
RNull
unlistEmptyList
(
VirtualFrame
frame
,
RList
list
,
boolean
recursive
,
boolean
useNames
)
{
return
RNull
.
instance
;
}
@SuppressWarnings
(
"unused"
)
@Specialization
(
guards
=
"isOneNull(list)"
)
protected
RNull
unlistOneNullList
(
VirtualFrame
frame
,
RList
list
,
boolean
recursive
,
boolean
useNames
)
{
protected
RNull
unlistEmptyList
(
RList
list
,
boolean
recursive
,
boolean
useNames
)
{
return
RNull
.
instance
;
}
...
...
@@ -184,6 +174,12 @@ public abstract class Unlist extends RBuiltinNode {
}
}
@SuppressWarnings
(
"unused"
)
@Fallback
protected
Object
unlist
(
Object
o
,
boolean
recursive
,
boolean
useNames
)
{
return
o
;
}
@TruffleBoundary
private
RAbstractVector
unlistHelper
(
RList
list
,
boolean
recursive
,
boolean
useNames
,
int
precedence
,
int
totalSize
)
{
String
[]
namesData
=
useNames
?
new
String
[
totalSize
]
:
null
;
...
...
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