Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a11416177d1c
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: aa84fc89ed09
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Feb 11, 2015

  1. Copy the full SHA
    35d6c95 View commit details
  2. [Truffle] Simplify Thread#value.

    * RubyThread.join() already raises if needed.
    * A node returning null is a bug.
    eregon committed Feb 11, 2015
    Copy the full SHA
    e268782 View commit details
  3. Revert "[Truffle] Simplify logic in ThreadManager.runOnce."

    * This reverts commit b2446b7.
    * The current SafepointManager needs for threads to have the global lock to know which RubyThread it is.
    eregon committed Feb 11, 2015
    Copy the full SHA
    aa84fc8 View commit details
Original file line number Diff line number Diff line change
@@ -319,15 +319,7 @@ public Object value(RubyThread self) {

self.join();

if (self.getException() != null) {
throw new RaiseException(self.getException());
}

if (self.getValue() == null) {
return getContext().getCoreLibrary().getNilObject();
} else {
return self.getValue();
}
return self.getValue();
}

}
Original file line number Diff line number Diff line change
@@ -40,8 +40,8 @@ public class RubyThread extends RubyBasicObject {
private volatile Thread thread;
private volatile Status status = Status.RUN;

private RubyException exception;
private Object value;
private volatile RubyException exception;
private volatile Object value;

private RubyBasicObject threadLocals;

@@ -84,6 +84,7 @@ public void run(final RubyContext context, RubyNode currentNode, String info, Ru
try {
task.run();
} catch (ThreadExitException e) {
value = context.getCoreLibrary().getNilObject();
return;
} catch (RaiseException e) {
exception = e.getRubyException();
Original file line number Diff line number Diff line change
@@ -59,10 +59,6 @@ public void poll() {
poll(true);
}

public void pollWithoutGlobalLock() {
poll(false);
}

private void poll(boolean holdsGlobalLock) {
try {
assumption.check();
Original file line number Diff line number Diff line change
@@ -112,20 +112,21 @@ public <T> T runUntilResult(BlockingActionWithoutGlobalLock<T> action) {
@CompilerDirectives.TruffleBoundary
public <T> T runOnce(BlockingActionWithoutGlobalLock<T> action) {
T result = null;

final RubyThread runningThread = leaveGlobalLock();
runningThread.setStatus(Status.SLEEP);

try {
runningThread.setStatus(Status.SLEEP);
result = action.block();
try {
result = action.block();
} finally {
runningThread.setStatus(Status.RUN);
// We need to enter the global lock before anything else!
enterGlobalLock(runningThread);
}
} catch (InterruptedException e) {
// We were interrupted, possibly by the SafepointManager.
context.getSafepointManager().pollWithoutGlobalLock();
} finally {
runningThread.setStatus(Status.RUN);
enterGlobalLock(runningThread);
context.getSafepointManager().poll();
}

return result;
}