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
4790862d
Commit
4790862d
authored
9 years ago
by
Adam Welc
Browse files
Options
Downloads
Patches
Plain Diff
Fixes to slot access implementation.
parent
d14a7b43
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/Slot.java
+16
-7
16 additions, 7 deletions
...tin/src/com/oracle/truffle/r/nodes/builtin/base/Slot.java
with
16 additions
and
7 deletions
com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/Slot.java
+
16
−
7
View file @
4790862d
...
...
@@ -13,6 +13,7 @@
package
com.oracle.truffle.r.nodes.builtin.base
;
import
com.oracle.truffle.api.CompilerDirectives
;
import
com.oracle.truffle.api.dsl.*
;
import
com.oracle.truffle.r.nodes.access.ConstantNode
;
import
com.oracle.truffle.r.nodes.access.variables.ReadVariableNode
;
...
...
@@ -70,9 +71,12 @@ public abstract class Slot extends RBuiltinNode {
// in general, treatment of the name parameter has to be finessed to be
// fully compatible with GNU R on direct calls to `@` function
if
(
classHierarchy
==
null
)
{
CompilerDirectives
.
transferToInterpreterAndInvalidate
();
classHierarchy
=
insert
(
ClassHierarchyNodeGen
.
create
(
true
));
}
return
classHierarchy
.
execute
(
object
);
}
else
if
(
name
==
RRuntime
.
DOT_DATA
)
{
return
getDataPart
(
object
);
}
else
if
(
name
==
RRuntime
.
NAMES_ATTR_KEY
&&
object
instanceof
RAbstractVector
)
{
assert
false
;
// RS4Object can never be a vector?
return
RNull
.
instance
;
...
...
@@ -81,6 +85,7 @@ public abstract class Slot extends RBuiltinNode {
RStringVector
classAttr
=
object
.
getClassAttr
(
attrProfiles
);
if
(
classAttr
==
null
)
{
if
(
typeofNode
==
null
)
{
CompilerDirectives
.
transferToInterpreterAndInvalidate
();
typeofNode
=
insert
(
TypeofNodeGen
.
create
());
}
throw
RError
.
error
(
this
,
RError
.
Message
.
SLOT_CANNOT_GET
,
name
,
typeofNode
.
execute
(
object
).
getName
());
...
...
@@ -109,7 +114,7 @@ public abstract class Slot extends RBuiltinNode {
return
getSlotS4Internal
(
object
,
name
,
value
);
}
protected
RFunction
getDataPart
(
REnvironment
methodsNamespace
)
{
protected
RFunction
getDataPart
Function
(
REnvironment
methodsNamespace
)
{
Object
f
=
methodsNamespace
.
findFunction
(
"getDataPart"
);
return
(
RFunction
)
RContext
.
getRRuntimeASTAccess
().
forcePromise
(
f
);
}
...
...
@@ -118,18 +123,22 @@ public abstract class Slot extends RBuiltinNode {
return
REnvironment
.
getRegisteredNamespace
(
"methods"
);
}
@SuppressWarnings
(
"unused"
)
@Specialization
(
guards
=
{
"!isS4(object)"
,
"isDotData(getName(nameObj))"
})
protected
Object
getSlotNonS4
(
RAbstractContainer
object
,
Object
nameObj
)
{
// TODO: any way to cache it?
private
Object
getDataPart
(
Object
object
)
{
// TODO: any way to cache it or use a mechanism similar to overrides?
REnvironment
methodsNamespace
=
REnvironment
.
getRegisteredNamespace
(
"methods"
);
RFunction
dataPart
=
getDataPart
(
methodsNamespace
);
RFunction
dataPart
=
getDataPart
Function
(
methodsNamespace
);
return
RContext
.
getEngine
().
evalFunction
(
dataPart
,
methodsNamespace
.
getFrame
(),
object
);
}
@SuppressWarnings
(
"unused"
)
@Specialization
(
guards
=
"isDotData(getName(nameObj))"
)
protected
Object
getSlotNonS4
(
RAbstractContainer
object
,
Object
nameObj
)
{
return
getDataPart
(
object
);
}
// this is really a fallback specialization but @Fallback does not work here (because of the
// type of "object"?)
@Specialization
@Specialization
(
guards
=
"!isDotData(getName(nameObj))"
)
protected
Object
getSlot
(
RAbstractContainer
object
,
Object
nameObj
)
{
// first argument is wrong
String
name
=
getName
(
nameObj
);
...
...
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