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
67668105
Commit
67668105
authored
8 years ago
by
Mick Jordan
Browse files
Options
Downloads
Patches
Plain Diff
remove args arg from .fastr.context.create/spawn
parent
34478f44
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.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java
+12
-11
12 additions, 11 deletions
...om/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java
with
12 additions
and
11 deletions
com.oracle.truffle.r.nodes.builtin/src/com/oracle/truffle/r/nodes/builtin/fastr/FastRContext.java
+
12
−
11
View file @
67668105
...
...
@@ -47,6 +47,7 @@ import com.oracle.truffle.r.runtime.data.RIntVector;
import
com.oracle.truffle.r.runtime.data.RList
;
import
com.oracle.truffle.r.runtime.data.RMissing
;
import
com.oracle.truffle.r.runtime.data.RNull
;
import
com.oracle.truffle.r.runtime.data.RStringVector
;
import
com.oracle.truffle.r.runtime.data.model.RAbstractIntVector
;
import
com.oracle.truffle.r.runtime.data.model.RAbstractStringVector
;
...
...
@@ -55,6 +56,8 @@ import com.oracle.truffle.r.runtime.data.model.RAbstractStringVector;
*/
public
class
FastRContext
{
private
static
final
RStringVector
EMPTY
=
RDataFactory
.
createEmptyStringVector
();
private
abstract
static
class
CastHelper
extends
RBuiltinNode
{
protected
void
exprs
(
CastBuilder
casts
)
{
casts
.
arg
(
"exprs"
).
asStringVector
().
mustBe
(
nullValue
().
not
().
and
(
notEmpty
()));
...
...
@@ -89,11 +92,11 @@ public class FastRContext {
* {@code .fastr.context.join}.
*
*/
@RBuiltin
(
name
=
".fastr.context.spawn"
,
kind
=
PRIMITIVE
,
parameterNames
=
{
"exprs"
,
"pc"
,
"kind"
,
"args"
},
behavior
=
COMPLEX
)
@RBuiltin
(
name
=
".fastr.context.spawn"
,
kind
=
PRIMITIVE
,
parameterNames
=
{
"exprs"
,
"pc"
,
"kind"
},
behavior
=
COMPLEX
)
public
abstract
static
class
Spawn
extends
CastHelper
{
@Override
public
Object
[]
getDefaultParameterValues
()
{
return
new
Object
[]{
RMissing
.
instance
,
1
,
"SHARE_NOTHING"
,
""
};
return
new
Object
[]{
RMissing
.
instance
,
1
,
"SHARE_NOTHING"
};
}
@Override
...
...
@@ -101,17 +104,16 @@ public class FastRContext {
exprs
(
casts
);
pc
(
casts
);
kind
(
casts
);
args
(
casts
);
}
@Specialization
@TruffleBoundary
protected
RIntVector
spawn
(
RAbstractStringVector
exprs
,
int
pc
,
String
kind
,
RAbstractStringVector
args
)
{
protected
RIntVector
spawn
(
RAbstractStringVector
exprs
,
int
pc
,
String
kind
)
{
RContext
.
ContextKind
contextKind
=
RContext
.
ContextKind
.
valueOf
(
kind
);
RContext
.
EvalThread
[]
threads
=
new
RContext
.
EvalThread
[
pc
];
int
[]
data
=
new
int
[
pc
];
for
(
int
i
=
0
;
i
<
pc
;
i
++)
{
ContextInfo
info
=
createContextInfo
(
contextKind
,
args
);
ContextInfo
info
=
createContextInfo
(
contextKind
,
EMPTY
);
threads
[
i
]
=
new
RContext
.
EvalThread
(
info
,
RSource
.
fromTextInternal
(
exprs
.
getDataAt
(
i
%
exprs
.
getLength
()),
RSource
.
Internal
.
CONTEXT_EVAL
));
data
[
i
]
=
info
.
getId
();
}
...
...
@@ -162,11 +164,11 @@ public class FastRContext {
* sublist contains the result of the evaluation with name "result". It may also have an
* attribute "error" if the evaluation threw an exception, in which case the result will be NA.
*/
@RBuiltin
(
name
=
".fastr.context.eval"
,
kind
=
PRIMITIVE
,
parameterNames
=
{
"exprs"
,
"pc"
,
"kind"
,
"args"
},
behavior
=
COMPLEX
)
@RBuiltin
(
name
=
".fastr.context.eval"
,
kind
=
PRIMITIVE
,
parameterNames
=
{
"exprs"
,
"pc"
,
"kind"
},
behavior
=
COMPLEX
)
public
abstract
static
class
Eval
extends
CastHelper
{
@Override
public
Object
[]
getDefaultParameterValues
()
{
return
new
Object
[]{
RMissing
.
instance
,
1
,
"SHARE_NOTHING"
,
""
};
return
new
Object
[]{
RMissing
.
instance
,
1
,
"SHARE_NOTHING"
};
}
@Override
...
...
@@ -174,24 +176,23 @@ public class FastRContext {
exprs
(
casts
);
pc
(
casts
);
kind
(
casts
);
args
(
casts
);
}
@Specialization
@TruffleBoundary
protected
Object
eval
(
RAbstractStringVector
exprs
,
int
pc
,
String
kind
,
RAbstractStringVector
args
)
{
protected
Object
eval
(
RAbstractStringVector
exprs
,
int
pc
,
String
kind
)
{
RContext
.
ContextKind
contextKind
=
RContext
.
ContextKind
.
valueOf
(
kind
);
Object
[]
results
=
new
Object
[
pc
];
if
(
pc
==
1
)
{
ContextInfo
info
=
createContextInfo
(
contextKind
,
args
);
ContextInfo
info
=
createContextInfo
(
contextKind
,
EMPTY
);
PolyglotEngine
vm
=
info
.
createVM
();
results
[
0
]
=
RContext
.
EvalThread
.
run
(
vm
,
info
,
RSource
.
fromTextInternal
(
exprs
.
getDataAt
(
0
),
RSource
.
Internal
.
CONTEXT_EVAL
));
}
else
{
// separate threads that run in parallel; invoking thread waits for completion
RContext
.
EvalThread
[]
threads
=
new
RContext
.
EvalThread
[
pc
];
for
(
int
i
=
0
;
i
<
pc
;
i
++)
{
ContextInfo
info
=
createContextInfo
(
contextKind
,
args
);
ContextInfo
info
=
createContextInfo
(
contextKind
,
EMPTY
);
threads
[
i
]
=
new
RContext
.
EvalThread
(
info
,
RSource
.
fromTextInternal
(
exprs
.
getDataAt
(
i
%
exprs
.
getLength
()),
RSource
.
Internal
.
CONTEXT_EVAL
));
}
for
(
int
i
=
0
;
i
<
pc
;
i
++)
{
...
...
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