Skip to content
Snippets Groups Projects
Commit 3da2f470 authored by Florian Angerer's avatar Florian Angerer
Browse files

Fix: Initialization of eval threads already accesses multi slots.

parent 694eb3da
No related branches found
No related tags found
No related merge requests found
......@@ -140,16 +140,26 @@ public class FastRContext {
EvalThread[] threads = new EvalThread[length];
int[] data = new int[length];
int[] multiSlotIndices = new int[length];
// first, create context infos
ChildContextInfo[] childContextInfos = new ChildContextInfo[length];
for (int i = 0; i < length; i++) {
ChildContextInfo info = createContextInfo(contextKind);
threads[i] = new EvalThread(RContext.getInstance().threads, info, RSource.fromTextInternalInvisible(exprs.getDataAt(i % exprs.getLength()), RSource.Internal.CONTEXT_EVAL),
FastROptions.SpawnUsesPolyglot.getBooleanValue());
data[i] = info.getId();
multiSlotIndices[i] = info.getMultiSlotInd();
childContextInfos[i] = createContextInfo(contextKind);
data[i] = childContextInfos[i].getId();
multiSlotIndices[i] = childContextInfos[i].getMultiSlotInd();
}
// convert shared slots to multi slots
if (contextKind == ContextKind.SHARE_ALL) {
REnvironment.convertSearchpathToMultiSlot(multiSlotIndices);
}
// create eval threads which may already set values to shared slots
for (int i = 0; i < length; i++) {
threads[i] = new EvalThread(RContext.getInstance().threads, childContextInfos[i],
RSource.fromTextInternalInvisible(exprs.getDataAt(i % exprs.getLength()), RSource.Internal.CONTEXT_EVAL),
FastROptions.SpawnUsesPolyglot.getBooleanValue());
}
for (int i = 0; i < length; i++) {
threads[i].start();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment