Skip to content

Commit 4f0f612

Browse files
committed
Pass the initial FiberStatus explicitly for new RubyFiber()
1 parent 601930d commit 4f0f612

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

src/main/java/org/truffleruby/core/fiber/FiberManager.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ public void safepoint(RubyFiber fromFiber, RubyFiber fiber, SafepointAction acti
342342
public void start(RubyFiber fiber, Thread javaThread) {
343343
if (fiber.isRootFiber()) {
344344
fiber.thread = javaThread;
345-
fiber.status = FiberStatus.RESUMED;
346345
} else {
347346
// fiber.thread set by createThreadToReceiveFirstMessage()
348347
}

src/main/java/org/truffleruby/core/fiber/FiberNodes.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ protected RubyFiber allocate(RubyClass rubyClass) {
109109
getContext(),
110110
getLanguage(),
111111
thread,
112+
FiberStatus.CREATED,
112113
"<uninitialized>");
113114
AllocationTracing.trace(fiber, this);
114115
return fiber;

src/main/java/org/truffleruby/core/fiber/RubyFiber.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public enum FiberStatus {
8585
/** the most recently-resumed Fiber by this Fiber */
8686
volatile RubyFiber resumingFiber = null;
8787
volatile boolean yielding = false;
88-
volatile FiberStatus status = FiberStatus.CREATED;
88+
volatile FiberStatus status;
8989
public Thread thread = null;
9090
public volatile Throwable uncaughtException = null;
9191
String sourceLocation;
@@ -107,6 +107,7 @@ public RubyFiber(
107107
RubyContext context,
108108
RubyLanguage language,
109109
RubyThread rubyThread,
110+
FiberStatus status,
110111
String sourceLocation) {
111112
super(rubyClass, shape);
112113
assert rubyThread != null;
@@ -116,6 +117,7 @@ public RubyFiber(
116117
language.basicObjectShape);
117118
this.catchTags = ArrayHelpers.createEmptyArray(context, language);
118119
this.rubyThread = rubyThread;
120+
this.status = status;
119121
this.sourceLocation = sourceLocation;
120122
extensionCallStack = new MarkingService.ExtensionCallStack(null, Nil.INSTANCE);
121123
handleData = new ValueWrapperManager.HandleBlockHolder();

src/main/java/org/truffleruby/core/thread/RubyThread.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import org.truffleruby.core.InterruptMode;
2626
import org.truffleruby.core.exception.RubyException;
2727
import org.truffleruby.core.fiber.RubyFiber;
28+
import org.truffleruby.core.fiber.RubyFiber.FiberStatus;
2829
import org.truffleruby.core.hash.HashOperations;
2930
import org.truffleruby.core.hash.RubyHash;
3031
import org.truffleruby.core.klass.RubyClass;
@@ -110,6 +111,7 @@ public RubyThread(
110111
context,
111112
language,
112113
this,
114+
FiberStatus.RESUMED,
113115
"root");
114116
this.currentFiber = rootFiber;
115117
}

0 commit comments

Comments
 (0)