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
3395fb8f
Commit
3395fb8f
authored
9 years ago
by
Mick Jordan
Browse files
Options
Downloads
Patches
Plain Diff
slight refactor of DoCall (for R-3.2.3)
parent
971983bf
Branches
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/DoCall.java
+24
-1
24 additions, 1 deletion
...n/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java
with
24 additions
and
1 deletion
com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/base/DoCall.java
+
24
−
1
View file @
3395fb8f
...
@@ -73,6 +73,10 @@ public abstract class DoCall extends RBuiltinNode {
...
@@ -73,6 +73,10 @@ public abstract class DoCall extends RBuiltinNode {
@Specialization
@Specialization
protected
Object
doDoCall
(
VirtualFrame
frame
,
Object
what
,
RList
argsAsList
,
REnvironment
env
)
{
protected
Object
doDoCall
(
VirtualFrame
frame
,
Object
what
,
RList
argsAsList
,
REnvironment
env
)
{
/*
* Step 1: handle the variants of "what" (could be done in extra specializations) and assign
* "func".
*/
RFunction
func
;
RFunction
func
;
if
(
what
instanceof
RFunction
)
{
if
(
what
instanceof
RFunction
)
{
func
=
(
RFunction
)
what
;
func
=
(
RFunction
)
what
;
...
@@ -87,11 +91,14 @@ public abstract class DoCall extends RBuiltinNode {
...
@@ -87,11 +91,14 @@ public abstract class DoCall extends RBuiltinNode {
throw
RError
.
error
(
this
,
RError
.
Message
.
MUST_BE_STRING_OR_FUNCTION
,
"what"
);
throw
RError
.
error
(
this
,
RError
.
Message
.
MUST_BE_STRING_OR_FUNCTION
,
"what"
);
}
}
/*
* Step 2: To re-create the illusion of a normal call, turn the values in argsAsList into
* promises.
*/
Object
[]
argValues
=
argsAsList
.
getDataCopy
();
Object
[]
argValues
=
argsAsList
.
getDataCopy
();
RStringVector
n
=
argsAsList
.
getNames
(
attrProfiles
);
RStringVector
n
=
argsAsList
.
getNames
(
attrProfiles
);
String
[]
argNames
=
n
==
null
?
new
String
[
argValues
.
length
]
:
n
.
getDataNonShared
();
String
[]
argNames
=
n
==
null
?
new
String
[
argValues
.
length
]
:
n
.
getDataNonShared
();
ArgumentsSignature
signature
=
ArgumentsSignature
.
get
(
argNames
);
ArgumentsSignature
signature
=
ArgumentsSignature
.
get
(
argNames
);
RBuiltinDescriptor
builtin
=
func
.
getRBuiltin
();
MaterializedFrame
callerFrame
=
null
;
MaterializedFrame
callerFrame
=
null
;
for
(
int
i
=
0
;
i
<
argValues
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
argValues
.
length
;
i
++)
{
Object
arg
=
argValues
[
i
];
Object
arg
=
argValues
[
i
];
...
@@ -111,6 +118,21 @@ public abstract class DoCall extends RBuiltinNode {
...
@@ -111,6 +118,21 @@ public abstract class DoCall extends RBuiltinNode {
}
}
}
}
}
}
/* Step 3: Perform the actual evaluation, checking for builtin special cases. */
return
executeCall
(
frame
,
func
,
argValues
,
signature
,
callerFrame
);
}
/* This exists solely for forceAndCall builtin (R3.2.3) */
@Specialization
protected
Object
doDoCall
(
VirtualFrame
frame
,
RFunction
func
,
RArgsValuesAndNames
args
,
@SuppressWarnings
(
"unused"
)
RNull
env
)
{
return
executeCall
(
frame
,
func
,
args
.
getArguments
(),
args
.
getSignature
(),
null
);
}
private
Object
executeCall
(
VirtualFrame
frame
,
RFunction
funcArg
,
Object
[]
argValues
,
ArgumentsSignature
signature
,
MaterializedFrame
callerFrameArg
)
{
RFunction
func
=
funcArg
;
MaterializedFrame
callerFrame
=
callerFrameArg
;
RBuiltinDescriptor
builtin
=
func
.
getRBuiltin
();
if
(
func
.
isBuiltin
()
&&
builtin
.
getDispatch
()
==
RDispatch
.
INTERNAL_GENERIC
)
{
if
(
func
.
isBuiltin
()
&&
builtin
.
getDispatch
()
==
RDispatch
.
INTERNAL_GENERIC
)
{
if
(
dispatchLookup
==
null
)
{
if
(
dispatchLookup
==
null
)
{
dispatchLookup
=
insert
(
S3FunctionLookupNode
.
create
(
true
,
false
));
dispatchLookup
=
insert
(
S3FunctionLookupNode
.
create
(
true
,
false
));
...
@@ -169,6 +191,7 @@ public abstract class DoCall extends RBuiltinNode {
...
@@ -169,6 +191,7 @@ public abstract class DoCall extends RBuiltinNode {
Object
[]
callArgs
=
argsNode
.
execute
(
func
,
caller
,
callerFrame
,
RArguments
.
getDepth
(
frame
)
+
1
,
reorderedArgs
.
getArguments
(),
reorderedArgs
.
getSignature
(),
null
);
Object
[]
callArgs
=
argsNode
.
execute
(
func
,
caller
,
callerFrame
,
RArguments
.
getDepth
(
frame
)
+
1
,
reorderedArgs
.
getArguments
(),
reorderedArgs
.
getSignature
(),
null
);
RArguments
.
setIsIrregular
(
callArgs
,
true
);
RArguments
.
setIsIrregular
(
callArgs
,
true
);
return
callCache
.
execute
(
frame
,
func
.
getTarget
(),
callArgs
);
return
callCache
.
execute
(
frame
,
func
.
getTarget
(),
callArgs
);
}
}
private
MaterializedFrame
getCallerFrame
(
VirtualFrame
frame
,
MaterializedFrame
callerFrame
)
{
private
MaterializedFrame
getCallerFrame
(
VirtualFrame
frame
,
MaterializedFrame
callerFrame
)
{
...
...
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