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
8b8fc3b8
Commit
8b8fc3b8
authored
8 years ago
by
stepan
Browse files
Options
Downloads
Patches
Plain Diff
FastR Grid: helper to run internal R code from outside of fast path
parent
e5e3f7ed
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.library/src/com/oracle/truffle/r/library/fastrGrid/GridContext.java
+18
-0
18 additions, 0 deletions
...c/com/oracle/truffle/r/library/fastrGrid/GridContext.java
with
18 additions
and
0 deletions
com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/fastrGrid/GridContext.java
+
18
−
0
View file @
8b8fc3b8
...
...
@@ -30,14 +30,21 @@ import com.oracle.truffle.r.library.fastrGrid.device.GridDevice.DeviceCloseExcep
import
com.oracle.truffle.r.library.fastrGrid.device.awt.BufferedJFrameDevice
;
import
com.oracle.truffle.r.library.fastrGrid.device.awt.JFrameDevice
;
import
com.oracle.truffle.r.library.fastrGrid.graphics.RGridGraphicsAdapter
;
import
com.oracle.truffle.r.runtime.RCaller
;
import
com.oracle.truffle.r.runtime.RError
;
import
com.oracle.truffle.r.runtime.RError.Message
;
import
com.oracle.truffle.r.runtime.RInternalCode
;
import
com.oracle.truffle.r.runtime.context.RContext
;
import
com.oracle.truffle.r.runtime.data.RFunction
;
import
com.oracle.truffle.r.runtime.env.REnvironment
;
/**
* Encapsulated the access to the global grid state.
*/
public
final
class
GridContext
{
private
static
final
GridContext
INSTANCE
=
new
GridContext
();
private
RInternalCode
internalCode
;
private
final
GridState
gridState
=
new
GridState
();
/**
* This list should correspond to the names inside {@code .Devices} variable in R.
...
...
@@ -100,6 +107,17 @@ public final class GridContext {
}
}
/**
* Runs arbitrary function from 'fastrGrid.R' file and returns its result.
*/
public
Object
evalInternalRFunction
(
String
functionName
,
Object
...
args
)
{
if
(
internalCode
==
null
)
{
internalCode
=
RInternalCode
.
lookup
(
RContext
.
getInstance
(),
"grid"
,
RInternalCode
.
loadSourceRelativeTo
(
LInitGrid
.
class
,
"fastrGrid.R"
));
}
RFunction
redrawAll
=
internalCode
.
lookupFunction
(
functionName
);
return
RContext
.
getEngine
().
evalFunction
(
redrawAll
,
REnvironment
.
baseEnv
().
getFrame
(),
RCaller
.
topLevel
,
null
,
args
);
}
private
static
final
class
DeviceAndState
{
final
GridDevice
device
;
final
GridDeviceState
state
;
...
...
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