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
5839d0ea
Commit
5839d0ea
authored
7 years ago
by
Lukas Stadler
Browse files
Options
Downloads
Patches
Plain Diff
workaround for Truffle DSL bug
parent
c6f13f67
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/UpdateAttributes.java
+18
-16
18 additions, 16 deletions
...oracle/truffle/r/nodes/builtin/base/UpdateAttributes.java
with
18 additions
and
16 deletions
com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/UpdateAttributes.java
+
18
−
16
View file @
5839d0ea
...
...
@@ -31,7 +31,6 @@ import static com.oracle.truffle.r.runtime.builtins.RBuiltinKind.PRIMITIVE;
import
com.oracle.truffle.api.CompilerDirectives
;
import
com.oracle.truffle.api.CompilerDirectives.TruffleBoundary
;
import
com.oracle.truffle.api.dsl.Cached
;
import
com.oracle.truffle.api.dsl.Fallback
;
import
com.oracle.truffle.api.dsl.Specialization
;
import
com.oracle.truffle.api.profiles.ConditionProfile
;
import
com.oracle.truffle.r.nodes.attributes.RemoveAttributeNode
;
...
...
@@ -50,8 +49,10 @@ import com.oracle.truffle.r.runtime.RError;
import
com.oracle.truffle.r.runtime.RRuntime
;
import
com.oracle.truffle.r.runtime.builtins.RBuiltin
;
import
com.oracle.truffle.r.runtime.data.RAttributable
;
import
com.oracle.truffle.r.runtime.data.RComplex
;
import
com.oracle.truffle.r.runtime.data.RList
;
import
com.oracle.truffle.r.runtime.data.RNull
;
import
com.oracle.truffle.r.runtime.data.RRaw
;
import
com.oracle.truffle.r.runtime.data.RShareable
;
import
com.oracle.truffle.r.runtime.data.RStringVector
;
import
com.oracle.truffle.r.runtime.data.model.RAbstractContainer
;
...
...
@@ -247,16 +248,14 @@ public abstract class UpdateAttributes extends RBuiltinNode.Arg2 {
* All other, non-performance centric, {@link RAttributable} types, or error case for RNull
* value.
*/
@
Fallback
@
Specialization
(
guards
=
"!isRAbstractContainer(o)"
)
@TruffleBoundary
protected
Object
doOtherNull
(
Object
o
,
Object
operand
)
{
checkAttributable
(
o
);
Object
obj
=
getNonShared
(
o
);
RAttributable
attrObj
=
(
RAttributable
)
obj
;
attrObj
.
removeAllAttributes
();
protected
Object
doOtherNull
(
RAttributable
o
,
Object
operand
)
{
RAttributable
obj
=
getNonShared
(
o
);
obj
.
removeAllAttributes
();
if
(
operand
==
RNull
.
instance
)
{
attrO
bj
.
setClassAttr
(
null
);
o
bj
.
setClassAttr
(
null
);
}
else
{
RList
list
=
(
RList
)
operand
;
RStringVector
listNames
=
list
.
getNames
();
...
...
@@ -273,24 +272,27 @@ public abstract class UpdateAttributes extends RBuiltinNode.Arg2 {
if
(
attrValue
==
null
)
{
throw
error
(
RError
.
Message
.
SET_INVALID_CLASS_ATTR
);
}
attrO
bj
.
setClassAttr
(
UpdateAttr
.
convertClassAttrFromObject
(
attrValue
));
o
bj
.
setClassAttr
(
UpdateAttr
.
convertClassAttrFromObject
(
attrValue
));
}
else
{
attrO
bj
.
setAttr
(
attrName
.
intern
(),
list
.
getDataAt
(
i
));
o
bj
.
setAttr
(
attrName
.
intern
(),
list
.
getDataAt
(
i
));
}
}
}
return
obj
;
}
private
void
checkAttributable
(
Object
obj
)
{
if
(!(
obj
instanceof
RAttributable
))
{
throw
error
(
RError
.
Message
.
INVALID_OR_UNIMPLEMENTED_ARGUMENTS
);
}
@Specialization
(
guards
=
{
"!isRAttributable(o)"
,
"!isScalar(o)"
})
protected
Object
doFallback
(
@SuppressWarnings
(
"unused"
)
Object
o
,
@SuppressWarnings
(
"unused"
)
Object
operand
)
{
throw
error
(
RError
.
Message
.
INVALID_OR_UNIMPLEMENTED_ARGUMENTS
);
}
protected
static
boolean
isScalar
(
Object
o
)
{
return
o
instanceof
Integer
||
o
instanceof
Double
||
o
instanceof
Byte
||
o
instanceof
RRaw
||
o
instanceof
RComplex
;
}
private
static
Object
getNonShared
(
Object
obj
)
{
private
static
RAttributable
getNonShared
(
RAttributable
obj
)
{
if
(
obj
instanceof
RShareable
)
{
return
((
RShareable
)
obj
).
getNonShared
();
return
(
RAttributable
)
((
RShareable
)
obj
).
getNonShared
();
}
return
obj
;
}
...
...
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