Skip to content

Commit 6973c1b

Browse files
committed
renamed PythonContext.SharedContextData to SharedMultiprocessingData
1 parent 9862b43 commit 6973c1b

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/MultiprocessingModuleBuiltins.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
import com.oracle.graal.python.nodes.util.CastToJavaStringNode;
7878
import com.oracle.graal.python.runtime.GilNode;
7979
import com.oracle.graal.python.runtime.PythonContext;
80-
import com.oracle.graal.python.runtime.PythonContext.SharedContextData;
80+
import com.oracle.graal.python.runtime.PythonContext.SharedMultiprocessingData;
8181
import com.oracle.graal.python.runtime.sequence.PSequence;
8282
import com.oracle.graal.python.runtime.sequence.storage.SequenceStorage;
8383
import com.oracle.graal.python.util.ArrayBuilder;
@@ -271,7 +271,7 @@ abstract static class PipeNode extends PythonBuiltinNode {
271271
PTuple pipe(@Cached GilNode gil) {
272272
int[] pipe;
273273
PythonContext ctx = getContext();
274-
SharedContextData sharedData = ctx.getSharedContextData();
274+
SharedMultiprocessingData sharedData = ctx.getSharedMultiprocessingData();
275275
gil.release(true);
276276
try {
277277
pipe = sharedData.pipe();
@@ -291,7 +291,7 @@ public abstract static class WriteNode extends PythonBinaryBuiltinNode {
291291
Object doWrite(int fd, PBytes data,
292292
@CachedLibrary("data") PythonBufferAccessLibrary bufferLib,
293293
@Cached GilNode gil) {
294-
SharedContextData sharedData = getContext().getSharedContextData();
294+
SharedMultiprocessingData sharedData = getContext().getSharedMultiprocessingData();
295295
gil.release(true);
296296
try {
297297
byte[] bytes = bufferLib.getCopiedByteArray(data);
@@ -322,7 +322,7 @@ public abstract static class ReadNode extends PythonBinaryBuiltinNode {
322322
@Specialization
323323
Object doRead(int fd, @SuppressWarnings("unused") Object length,
324324
@Cached GilNode gil) {
325-
SharedContextData sharedData = getContext().getSharedContextData();
325+
SharedMultiprocessingData sharedData = getContext().getSharedMultiprocessingData();
326326
gil.release(true);
327327
try {
328328
Object data = sharedData.takePipeData(this, fd, () -> {
@@ -350,7 +350,7 @@ public abstract static class CloseNode extends PythonUnaryBuiltinNode {
350350
@Specialization
351351
PNone close(@SuppressWarnings("unused") int fd) {
352352
assert fd < 0;
353-
SharedContextData sharedData = getContext().getSharedContextData();
353+
SharedMultiprocessingData sharedData = getContext().getSharedMultiprocessingData();
354354
if (!sharedData.decrementFDRefCount(fd)) {
355355
sharedData.closePipe(fd);
356356
}
@@ -374,7 +374,7 @@ Object doGeneric(VirtualFrame frame, Object rlist,
374374
@Cached CastToJavaIntLossyNode castToJava,
375375
@Cached GilNode gil) {
376376
ArrayBuilder<Integer> notEmpty = new ArrayBuilder<>();
377-
SharedContextData sharedData = getContext().getSharedContextData();
377+
SharedMultiprocessingData sharedData = getContext().getSharedMultiprocessingData();
378378
gil.release(true);
379379
try {
380380
PSequence pSequence = constructListNode.execute(frame, rlist);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/PosixModuleBuiltins.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ PNone close(VirtualFrame frame, int fd,
526526
@CachedLibrary("getPosixSupport()") PosixSupportLibrary posixLib) {
527527
try {
528528
PythonContext ctx = getContext();
529-
if (ctx.getSharedContextData().decrementFDRefCount(fd)) {
529+
if (ctx.getSharedMultiprocessingData().decrementFDRefCount(fd)) {
530530
return PNone.NONE;
531531
}
532532
posixLib.close(getPosixSupport(), fd);

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PythonContext.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ public Thread getOwner() {
468468
public static final String CHILD_CONTEXT_DATA = "childContextData";
469469
@CompilationFinal private List<Integer> childContextFDs;
470470
private final ChildContextData childContextData;
471-
private final SharedContextData sharedContextData;
471+
private final SharedMultiprocessingData sharedMultiprocessingData;
472472

473473
public static final class ChildContextData {
474474
private int exitCode = 0;
@@ -519,7 +519,7 @@ public boolean compareAndSetExiting(boolean expect, boolean update) {
519519
}
520520
}
521521

522-
public static final class SharedContextData {
522+
public static final class SharedMultiprocessingData {
523523

524524
private int fdCounter = 0;
525525

@@ -552,7 +552,7 @@ private void incrementFDRefCount(int fd) {
552552
/**
553553
* Decreases reference count for the given file descriptor.
554554
*
555-
* @return {@code true} if ref count was decreased, {@link false} if ref count isn't tracked
555+
* @return {@code true} if ref count was decreased, {@code false} if ref count isn't tracked
556556
* anymore.
557557
*/
558558
@TruffleBoundary
@@ -676,7 +676,7 @@ public PythonContext(PythonLanguage language, TruffleLanguage.Env env, Python3Co
676676
this.core = core;
677677
this.env = env;
678678
this.childContextData = (ChildContextData) env.getConfig().get(CHILD_CONTEXT_DATA);
679-
this.sharedContextData = this.childContextData == null ? new SharedContextData() : childContextData.parentCtx.sharedContextData;
679+
this.sharedMultiprocessingData = this.childContextData == null ? new SharedMultiprocessingData() : childContextData.parentCtx.sharedMultiprocessingData;
680680
this.handler = new AsyncHandler(this);
681681
this.sharedFinalizer = new AsyncHandler.SharedFinalizer(this);
682682
this.optionValues = PythonOptions.createOptionValuesStorage(env);
@@ -706,8 +706,8 @@ public ChildContextData getChildContextData() {
706706
return childContextData;
707707
}
708708

709-
public SharedContextData getSharedContextData() {
710-
return sharedContextData;
709+
public SharedMultiprocessingData getSharedMultiprocessingData() {
710+
return sharedMultiprocessingData;
711711
}
712712

713713
public long spawnTruffleContext(int fd, int sentinel, int[] fdsToKeep) {
@@ -728,7 +728,7 @@ public long spawnTruffleContext(int fd, int sentinel, int[] fdsToKeep) {
728728
for (int fdToKeep : fdsToKeep) {
729729
// prevent file descriptors from being closed when passed to another "process",
730730
// equivalent to fds_to_keep arg in posix fork_exec
731-
getSharedContextData().incrementFDRefCount(fdToKeep);
731+
getSharedMultiprocessingData().incrementFDRefCount(fdToKeep);
732732
}
733733
start(thread);
734734
return tid;
@@ -786,7 +786,7 @@ public void run() {
786786
LOGGER.log(Level.FINE, t, () -> "exception while closing spawned child context");
787787
}
788788
}
789-
data.parentCtx.sharedContextData.closePipe(sentinel);
789+
data.parentCtx.sharedMultiprocessingData.closePipe(sentinel);
790790
}
791791
} catch (ThreadDeath td) {
792792
// as a result of of TruffleContext.closeCancelled()
@@ -1403,8 +1403,8 @@ public void finalizeContext() {
14031403
}
14041404
cleanupHPyResources();
14051405
for (int fd : getChildContextFDs()) {
1406-
if (!getSharedContextData().decrementFDRefCount(fd)) {
1407-
getSharedContextData().closePipe(fd);
1406+
if (!getSharedMultiprocessingData().decrementFDRefCount(fd)) {
1407+
getSharedMultiprocessingData().closePipe(fd);
14081408
}
14091409
}
14101410
mainThread = null;

0 commit comments

Comments
 (0)