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
3e460be5
Commit
3e460be5
authored
10 years ago
by
Mick Jordan
Browse files
Options
Downloads
Patches
Plain Diff
add optional tracing of REngine.makeCallTarget
parent
7d560a6a
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/REngine.java
+24
-0
24 additions, 0 deletions
...fle.r.engine/src/com/oracle/truffle/r/engine/REngine.java
with
24 additions
and
0 deletions
com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java
+
24
−
0
View file @
3e460be5
...
...
@@ -33,6 +33,7 @@ import com.oracle.truffle.api.frame.*;
import
com.oracle.truffle.api.nodes.*
;
import
com.oracle.truffle.api.source.*
;
import
com.oracle.truffle.r.nodes.*
;
import
com.oracle.truffle.r.nodes.access.*
;
import
com.oracle.truffle.r.nodes.builtin.*
;
import
com.oracle.truffle.r.nodes.function.*
;
import
com.oracle.truffle.r.options.*
;
...
...
@@ -335,6 +336,8 @@ public final class REngine implements RContext.Engine {
return
result
;
}
private
static
boolean
traceMakeCallTarget
;
/**
* Wraps the Truffle AST in {@code node} in an anonymous function and returns a
* {@link RootCallTarget} for it. We define the
...
...
@@ -350,12 +353,33 @@ public final class REngine implements RContext.Engine {
*/
@SlowPath
private
static
RootCallTarget
makeCallTarget
(
RNode
body
)
{
if
(
traceMakeCallTarget
)
{
doTraceMakeCallTarget
(
body
);
}
REnvironment
.
FunctionDefinition
rootNodeEnvironment
=
new
REnvironment
.
FunctionDefinition
(
REnvironment
.
emptyEnv
());
FunctionDefinitionNode
rootNode
=
new
FunctionDefinitionNode
(
null
,
rootNodeEnvironment
,
body
,
FormalArguments
.
NO_ARGS
,
"<wrapper>"
,
true
);
RootCallTarget
callTarget
=
Truffle
.
getRuntime
().
createCallTarget
(
rootNode
);
return
callTarget
;
}
private
static
void
doTraceMakeCallTarget
(
RNode
body
)
{
String
nodeClassName
=
body
.
getClass
().
getSimpleName
();
SourceSection
ss
=
body
.
getSourceSection
();
String
trace
;
if
(
ss
==
null
)
{
System
.
console
();
if
(
body
instanceof
ConstantNode
)
{
trace
=
((
ConstantNode
)
body
).
getValue
().
toString
();
}
else
{
trace
=
"not constant/no source"
;
}
}
else
{
trace
=
ss
.
toString
();
}
RContext
.
getInstance
().
getConsoleHandler
().
printf
(
"makeCallTarget: node: %s, %s%n"
,
nodeClassName
,
trace
);
}
/**
* Execute {@code callTarget} in {@code frame}, optionally printing any result. N.B.
* {@code callTarget.call} will create a new {@link VirtualFrame} called, say, {@code newFrame},
...
...
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