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
90914454
Commit
90914454
authored
6 years ago
by
Stepan Sindelar
Browse files
Options
Downloads
Plain Diff
[GR-10619] Fix: UseMethod invoked via interop.
PullRequest: fastr/1592
parents
55b827b5
d1284ba3
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.engine/src/com/oracle/truffle/r/engine/interop/RFunctionMR.java
+8
-30
8 additions, 30 deletions
.../src/com/oracle/truffle/r/engine/interop/RFunctionMR.java
with
8 additions
and
30 deletions
com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/interop/RFunctionMR.java
+
8
−
30
View file @
90914454
...
@@ -22,24 +22,21 @@
...
@@ -22,24 +22,21 @@
*/
*/
package
com.oracle.truffle.r.engine.interop
;
package
com.oracle.truffle.r.engine.interop
;
import
com.oracle.truffle.api.Truffle
;
import
com.oracle.truffle.api.frame.FrameDescriptor
;
import
com.oracle.truffle.api.frame.FrameDescriptor
;
import
com.oracle.truffle.api.frame.FrameSlot
;
import
com.oracle.truffle.api.frame.FrameSlot
;
import
com.oracle.truffle.api.frame.FrameSlotKind
;
import
com.oracle.truffle.api.frame.FrameSlotKind
;
import
com.oracle.truffle.api.frame.
Virtual
Frame
;
import
com.oracle.truffle.api.frame.
Materialized
Frame
;
import
com.oracle.truffle.api.interop.CanResolve
;
import
com.oracle.truffle.api.interop.CanResolve
;
import
com.oracle.truffle.api.interop.MessageResolution
;
import
com.oracle.truffle.api.interop.MessageResolution
;
import
com.oracle.truffle.api.interop.Resolve
;
import
com.oracle.truffle.api.interop.Resolve
;
import
com.oracle.truffle.api.interop.TruffleObject
;
import
com.oracle.truffle.api.interop.TruffleObject
;
import
com.oracle.truffle.api.nodes.Node
;
import
com.oracle.truffle.api.nodes.Node
;
import
com.oracle.truffle.r.nodes.function.RCallBaseNode
;
import
com.oracle.truffle.r.nodes.function.call.RExplicitCallNode
;
import
com.oracle.truffle.r.nodes.function.RCallNode
;
import
com.oracle.truffle.r.runtime.ArgumentsSignature
;
import
com.oracle.truffle.r.runtime.ArgumentsSignature
;
import
com.oracle.truffle.r.runtime.
RArguments
;
import
com.oracle.truffle.r.runtime.
context.RContext
;
import
com.oracle.truffle.r.runtime.data.RArgsValuesAndNames
;
import
com.oracle.truffle.r.runtime.data.RArgsValuesAndNames
;
import
com.oracle.truffle.r.runtime.data.RFunction
;
import
com.oracle.truffle.r.runtime.data.RFunction
;
import
com.oracle.truffle.r.runtime.data.RObject
;
import
com.oracle.truffle.r.runtime.data.RObject
;
import
com.oracle.truffle.r.runtime.data.RNull
;
import
com.oracle.truffle.r.runtime.env.frame.FrameSlotChangeMonitor
;
import
com.oracle.truffle.r.runtime.env.frame.FrameSlotChangeMonitor
;
import
com.oracle.truffle.r.runtime.env.frame.RFrameSlot
;
import
com.oracle.truffle.r.runtime.env.frame.RFrameSlot
;
import
com.oracle.truffle.r.runtime.interop.Foreign2R
;
import
com.oracle.truffle.r.runtime.interop.Foreign2R
;
...
@@ -69,36 +66,17 @@ public class RFunctionMR {
...
@@ -69,36 +66,17 @@ public class RFunctionMR {
public
abstract
static
class
RFunctionExecuteNode
extends
Node
{
public
abstract
static
class
RFunctionExecuteNode
extends
Node
{
@Child
private
Foreign2R
foreign2R
=
Foreign2RNodeGen
.
create
();
@Child
private
Foreign2R
foreign2R
=
Foreign2RNodeGen
.
create
();
@Child
private
R2Foreign
r2Foreign
=
R2ForeignNodeGen
.
create
();
@Child
private
R2Foreign
r2Foreign
=
R2ForeignNodeGen
.
create
();
@Child
private
RExplicitCallNode
call
=
RExplicitCallNode
.
create
();
private
static
final
FrameDescriptor
emptyFrameDescriptor
=
FrameSlotChangeMonitor
.
initializeFunctionFrameDescriptor
(
"<interop>"
,
new
FrameDescriptor
(
"R interop frame"
));
private
static
final
RFrameSlot
argsIdentifier
=
RFrameSlot
.
createTemp
(
false
);
private
static
final
RFrameSlot
explicitCallerId
=
RFrameSlot
.
createTemp
(
false
);
private
static
final
FrameSlot
slot
=
FrameSlotChangeMonitor
.
findOrAddFrameSlot
(
emptyFrameDescriptor
,
argsIdentifier
,
FrameSlotKind
.
Object
);
private
static
final
FrameSlot
slotCaller
=
FrameSlotChangeMonitor
.
findOrAddFrameSlot
(
emptyFrameDescriptor
,
explicitCallerId
,
FrameSlotKind
.
Object
);
static
{
FrameSlotChangeMonitor
.
initializeFunctionFrameDescriptor
(
"<function>"
,
emptyFrameDescriptor
);
}
@Child
private
RCallBaseNode
call
=
RCallNode
.
createExplicitCall
(
argsIdentifier
,
explicitCallerId
);
protected
Object
access
(
RFunction
receiver
,
Object
[]
arguments
)
{
protected
Object
access
(
RFunction
receiver
,
Object
[]
arguments
)
{
Object
[]
dummyFrameArgs
=
RArguments
.
createUnitialized
();
VirtualFrame
dummyFrame
=
Truffle
.
getRuntime
().
createVirtualFrame
(
dummyFrameArgs
,
emptyFrameDescriptor
);
Object
[]
convertedArguments
=
new
Object
[
arguments
.
length
];
Object
[]
convertedArguments
=
new
Object
[
arguments
.
length
];
for
(
int
i
=
0
;
i
<
arguments
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
arguments
.
length
;
i
++)
{
convertedArguments
[
i
]
=
foreign2R
.
execute
(
arguments
[
i
]);
convertedArguments
[
i
]
=
foreign2R
.
execute
(
arguments
[
i
]);
}
}
RArgsValuesAndNames
actualArgs
=
new
RArgsValuesAndNames
(
convertedArguments
,
ArgumentsSignature
.
empty
(
arguments
.
length
));
MaterializedFrame
globalFrame
=
RContext
.
getInstance
().
stateREnvironment
.
getGlobalFrame
();
try
{
RArgsValuesAndNames
argsAndValues
=
new
RArgsValuesAndNames
(
convertedArguments
,
ArgumentsSignature
.
empty
(
arguments
.
length
));
FrameSlotChangeMonitor
.
setObject
(
dummyFrame
,
slot
,
actualArgs
);
Object
result
=
this
.
call
.
call
(
globalFrame
,
receiver
,
argsAndValues
);
FrameSlotChangeMonitor
.
setObject
(
dummyFrame
,
slotCaller
,
RNull
.
instance
);
return
r2Foreign
.
execute
(
result
);
Object
value
=
call
.
execute
(
dummyFrame
,
receiver
);
return
r2Foreign
.
execute
(
value
);
}
finally
{
FrameSlotChangeMonitor
.
setObject
(
dummyFrame
,
slot
,
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