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
cdf54437
Commit
cdf54437
authored
7 years ago
by
Lukas Stadler
Browse files
Options
Downloads
Patches
Plain Diff
simplify NonNANode using VectorAccess
parent
915856a1
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/src/com/oracle/truffle/r/nodes/unary/NonNANode.java
+16
-64
16 additions, 64 deletions
...nodes/src/com/oracle/truffle/r/nodes/unary/NonNANode.java
with
16 additions
and
64 deletions
com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/unary/NonNANode.java
+
16
−
64
View file @
cdf54437
...
...
@@ -22,6 +22,7 @@
*/
package
com.oracle.truffle.r.nodes.unary
;
import
com.oracle.truffle.api.dsl.Cached
;
import
com.oracle.truffle.api.dsl.Specialization
;
import
com.oracle.truffle.api.profiles.BranchProfile
;
import
com.oracle.truffle.r.nodes.builtin.casts.MessageData
;
...
...
@@ -29,13 +30,10 @@ import com.oracle.truffle.r.runtime.RRuntime;
import
com.oracle.truffle.r.runtime.data.RComplex
;
import
com.oracle.truffle.r.runtime.data.RMissing
;
import
com.oracle.truffle.r.runtime.data.RNull
;
import
com.oracle.truffle.r.runtime.data.model.RAbstract
Complex
Vector
;
import
com.oracle.truffle.r.runtime.data.model.RAbstract
Atomic
Vector
;
import
com.oracle.truffle.r.runtime.data.model.RAbstractContainer
;
import
com.oracle.truffle.r.runtime.data.model.RAbstractDoubleVector
;
import
com.oracle.truffle.r.runtime.data.model.RAbstractIntVector
;
import
com.oracle.truffle.r.runtime.data.model.RAbstractLogicalVector
;
import
com.oracle.truffle.r.runtime.data.model.RAbstractRawVector
;
import
com.oracle.truffle.r.runtime.data.model.RAbstractStringVector
;
import
com.oracle.truffle.r.runtime.data.nodes.VectorAccess
;
import
com.oracle.truffle.r.runtime.data.nodes.VectorAccess.SequentialIterator
;
public
abstract
class
NonNANode
extends
CastNode
{
...
...
@@ -155,72 +153,26 @@ public abstract class NonNANode extends CastNode {
return
x
;
}
protected
boolean
isComplete
(
RAbstractContainer
x
)
{
return
x
.
isComplete
();
}
@Specialization
(
guards
=
"isComplete(x)"
)
@Specialization
(
guards
=
"x.isComplete()"
)
protected
Object
onCompleteContainer
(
RAbstractContainer
x
)
{
return
x
;
}
@Specialization
(
guards
=
"!isComplete(x)"
)
protected
Object
onPossiblyIncompleteContainer
(
RAbstractIntVector
x
)
{
int
len
=
x
.
getLength
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
if
(
RRuntime
.
isNA
(
x
.
getDataAt
(
i
)))
{
return
handleNA
(
x
);
}
}
return
x
;
}
@Specialization
(
guards
=
"!isComplete(x)"
)
protected
Object
onPossiblyIncompleteContainer
(
RAbstractLogicalVector
x
)
{
int
len
=
x
.
getLength
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
if
(
RRuntime
.
isNA
(
x
.
getDataAt
(
i
)))
{
return
handleNA
(
x
);
}
}
return
x
;
}
@Specialization
(
guards
=
"!isComplete(x)"
)
protected
Object
onPossiblyIncompleteContainer
(
RAbstractDoubleVector
x
)
{
int
len
=
x
.
getLength
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
if
(
RRuntime
.
isNA
(
x
.
getDataAt
(
i
)))
{
return
handleNA
(
x
);
@Specialization
(
guards
=
{
"access.supports(x)"
,
"!x.isComplete()"
})
protected
RAbstractAtomicVector
onPossiblyIncompleteContainerCached
(
RAbstractAtomicVector
x
,
@Cached
(
"x.access()"
)
VectorAccess
access
)
{
try
(
SequentialIterator
iter
=
access
.
access
(
x
))
{
while
(
access
.
next
(
iter
))
{
if
(
access
.
isNA
(
iter
))
{
handleNA
(
x
);
}
}
}
return
x
;
}
@Specialization
(
guards
=
"!isComplete(x)"
)
protected
Object
onPossiblyIncompleteContainer
(
RAbstractComplexVector
x
)
{
int
len
=
x
.
getLength
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
if
(
RRuntime
.
isNA
(
x
.
getDataAt
(
i
)))
{
return
handleNA
(
x
);
}
}
return
x
;
}
@Specialization
(
guards
=
"!isComplete(x)"
)
protected
Object
onPossiblyIncompleteContainer
(
RAbstractStringVector
x
)
{
int
len
=
x
.
getLength
();
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
if
(
RRuntime
.
isNA
(
x
.
getDataAt
(
i
)))
{
return
handleNA
(
x
);
}
}
return
x
;
}
@Specialization
(
guards
=
"!isComplete(x)"
)
protected
Object
onPossiblyIncompleteContainer
(
RAbstractRawVector
x
)
{
return
x
;
@Specialization
(
replaces
=
"onPossiblyIncompleteContainerCached"
,
guards
=
"!x.isComplete()"
)
protected
RAbstractAtomicVector
onPossiblyIncompleteContainerGeneric
(
RAbstractAtomicVector
x
)
{
return
onPossiblyIncompleteContainerCached
(
x
,
x
.
slowPathAccess
());
}
}
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