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
ba2bbbbb
Commit
ba2bbbbb
authored
10 years ago
by
Michael Haupt
Browse files
Options
Downloads
Patches
Plain Diff
initial version of builtin that dumps function ASTs to IGV before and after calling
parent
17d7a66e
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/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRRunDump.java
+58
-0
58 additions, 0 deletions
...om/oracle/truffle/r/nodes/builtin/fastr/FastRRunDump.java
with
58 additions
and
0 deletions
com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRRunDump.java
0 → 100644
+
58
−
0
View file @
ba2bbbbb
package
com.oracle.truffle.r.nodes.builtin.fastr
;
import
static
com
.
oracle
.
truffle
.
r
.
runtime
.
RBuiltinKind
.*;
import
com.oracle.graal.debug.*
;
import
com.oracle.graal.debug.Debug.Scope
;
import
com.oracle.truffle.api.*
;
import
com.oracle.truffle.api.dsl.*
;
import
com.oracle.truffle.api.frame.*
;
import
com.oracle.truffle.api.nodes.*
;
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.runtime.*
;
import
com.oracle.truffle.r.runtime.data.*
;
/**
* Run a FastR function, and dump its AST to IGV before and after running. If no function is passed,
* this builtin does not do anything.
*/
@RBuiltin
(
name
=
"fastr.rundump"
,
parameterNames
=
{
"function"
},
kind
=
PRIMITIVE
)
public
abstract
class
FastRRunDump
extends
RInvisibleBuiltinNode
{
// TODO Make this more versatile by allowing actual function calls with arguments to be
// observed. This requires ... to work properly.
@Child
private
IndirectCallNode
call
=
Truffle
.
getRuntime
().
createIndirectCallNode
();
private
final
GraphPrintVisitor
graphPrinter
=
new
GraphPrintVisitor
();
@Override
public
RNode
[]
getParameterValues
()
{
return
new
RNode
[]{
ConstantNode
.
create
(
RNull
.
instance
)};
}
@Specialization
public
Object
runDump
(
RNull
function
)
{
return
function
;
}
@Specialization
public
Object
runDump
(
VirtualFrame
frame
,
RFunction
function
)
{
controlVisibility
();
Object
r
=
RNull
.
instance
;
graphPrinter
.
beginGroup
(
RRuntime
.
toString
(
function
));
try
(
Scope
s
=
Debug
.
scope
(
"FastR"
))
{
graphPrinter
.
beginGraph
(
"before"
).
visit
(
function
.
getTarget
().
getRootNode
());
r
=
call
.
call
(
frame
,
function
.
getTarget
(),
RArguments
.
create
(
function
));
graphPrinter
.
beginGraph
(
"after"
).
visit
(
function
.
getTarget
().
getRootNode
());
}
catch
(
Throwable
t
)
{
Debug
.
handle
(
t
);
}
finally
{
graphPrinter
.
printToNetwork
(
true
);
}
return
r
;
}
}
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