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
79a3e14b
Commit
79a3e14b
authored
8 years ago
by
Lukas Stadler
Browse files
Options
Downloads
Patches
Plain Diff
cache CallTargets in PolyglotEngineRootNode
parent
3aadff8d
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
+10
-2
10 additions, 2 deletions
...fle.r.engine/src/com/oracle/truffle/r/engine/REngine.java
with
10 additions
and
2 deletions
com.oracle.truffle.r.engine/src/com/oracle/truffle/r/engine/REngine.java
+
10
−
2
View file @
79a3e14b
...
...
@@ -40,6 +40,8 @@ import com.oracle.truffle.api.frame.FrameDescriptor;
import
com.oracle.truffle.api.frame.MaterializedFrame
;
import
com.oracle.truffle.api.frame.VirtualFrame
;
import
com.oracle.truffle.api.interop.TruffleObject
;
import
com.oracle.truffle.api.nodes.DirectCallNode
;
import
com.oracle.truffle.api.nodes.ExplodeLoop
;
import
com.oracle.truffle.api.nodes.Node
;
import
com.oracle.truffle.api.nodes.RootNode
;
import
com.oracle.truffle.api.profiles.ConditionProfile
;
...
...
@@ -309,6 +311,7 @@ final class REngine implements Engine, Engine.Timings {
private
final
class
PolyglotEngineRootNode
extends
RootNode
{
private
final
List
<
RSyntaxNode
>
statements
;
@Children
private
final
DirectCallNode
[]
calls
;
private
final
boolean
printResult
;
@Child
private
Node
findContext
=
TruffleRLanguage
.
INSTANCE
.
actuallyCreateFindContextNode
();
...
...
@@ -318,6 +321,7 @@ final class REngine implements Engine, Engine.Timings {
// can't print if initializing the system in embedded mode (no builtins yet)
this
.
printResult
=
!
sourceSection
.
getSource
().
getName
().
equals
(
RSource
.
Internal
.
INIT_EMBEDDED
.
string
);
this
.
statements
=
statements
;
this
.
calls
=
new
DirectCallNode
[
statements
.
size
()];
}
/**
...
...
@@ -326,6 +330,7 @@ final class REngine implements Engine, Engine.Timings {
* control over what that might be when the call is initiated.
*/
@Override
@ExplodeLoop
public
Object
execute
(
VirtualFrame
frame
)
{
RContext
oldContext
=
RContext
.
getThreadLocalInstance
();
RContext
newContext
=
TruffleRLanguage
.
INSTANCE
.
actuallyFindContext0
(
findContext
);
...
...
@@ -334,8 +339,11 @@ final class REngine implements Engine, Engine.Timings {
Object
lastValue
=
RNull
.
instance
;
for
(
int
i
=
0
;
i
<
statements
.
size
();
i
++)
{
RSyntaxNode
node
=
statements
.
get
(
i
);
RootCallTarget
callTarget
=
doMakeCallTarget
(
node
.
asRNode
(),
RSource
.
Internal
.
REPL_WRAPPER
.
string
,
printResult
,
true
);
lastValue
=
callTarget
.
call
(
newContext
.
stateREnvironment
.
getGlobalFrame
());
if
(
calls
[
i
]
==
null
)
{
CompilerDirectives
.
transferToInterpreterAndInvalidate
();
calls
[
i
]
=
insert
(
Truffle
.
getRuntime
().
createDirectCallNode
(
doMakeCallTarget
(
node
.
asRNode
(),
RSource
.
Internal
.
REPL_WRAPPER
.
string
,
printResult
,
true
)));
}
lastValue
=
calls
[
i
].
call
(
frame
,
new
Object
[]{
newContext
.
stateREnvironment
.
getGlobalFrame
()});
}
return
lastValue
;
}
catch
(
ReturnException
ex
)
{
...
...
This diff is collapsed.
Click to expand it.
Julien Lopez
@jlopez
mentioned in commit
7154e299
·
8 years ago
mentioned in commit
7154e299
mentioned in commit 7154e299849ee6499837bff552820f7b589c1323
Toggle commit list
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