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: 99da5720ee1f
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2bca15b8ed34
Choose a head ref
  • 3 commits
  • 16 files changed
  • 1 contributor

Commits on Mar 1, 2016

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6910c39 View commit details
  2. Copy the full SHA
    4ae93d2 View commit details
  3. Copy the full SHA
    2bca15b View commit details
Original file line number Diff line number Diff line change
@@ -19,11 +19,11 @@
import com.oracle.truffle.api.source.SourceSection;
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.cast.DefaultValueNodeGen;
import org.jruby.truffle.core.ffi.TimeSpec;
import org.jruby.truffle.platform.posix.TimeSpec;
import org.jruby.truffle.language.RubyGuards;
import org.jruby.truffle.language.RubyNode;
import org.jruby.truffle.language.control.RaiseException;
import org.jruby.truffle.platform.ClockGetTime;
import org.jruby.truffle.platform.posix.ClockGetTime;
import org.jruby.truffle.platform.signal.Signal;

@CoreClass(name = "Process")
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@
import org.jruby.truffle.core.rope.Rope;
import org.jruby.truffle.core.string.CoreStrings;
import org.jruby.truffle.core.string.StringOperations;
import org.jruby.truffle.platform.Sockets;
import org.jruby.truffle.platform.posix.Sockets;
import org.jruby.util.ByteList;

@TypeSystemReference(RubyTypes.class)
Original file line number Diff line number Diff line change
@@ -13,6 +13,8 @@
import jnr.posix.POSIX;
import org.jruby.truffle.core.queue.ArrayBlockingQueueLocksConditions;
import org.jruby.truffle.core.queue.LinkedBlockingQueueLocksConditions;
import org.jruby.truffle.platform.posix.ClockGetTime;
import org.jruby.truffle.platform.posix.Sockets;
import org.jruby.truffle.platform.signal.SignalManager;

public interface NativePlatform {
Original file line number Diff line number Diff line change
@@ -17,13 +17,13 @@
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.queue.ArrayBlockingQueueLocksConditions;
import org.jruby.truffle.core.queue.LinkedBlockingQueueLocksConditions;
import org.jruby.truffle.platform.ClockGetTime;
import org.jruby.truffle.platform.posix.ClockGetTime;
import org.jruby.truffle.platform.DefaultRubiniusConfiguration;
import org.jruby.truffle.platform.NativePlatform;
import org.jruby.truffle.platform.ProcessName;
import org.jruby.truffle.platform.RubiniusConfiguration;
import org.jruby.truffle.platform.Sockets;
import org.jruby.truffle.platform.TrufflePOSIXHandler;
import org.jruby.truffle.platform.posix.Sockets;
import org.jruby.truffle.platform.posix.TrufflePOSIXHandler;
import org.jruby.truffle.platform.java.JavaClockGetTime;
import org.jruby.truffle.platform.openjdk.OpenJDKArrayBlockingQueueLocksConditions;
import org.jruby.truffle.platform.openjdk.OpenJDKLinkedBlockingQueueLocksConditions;
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ public class DarwinProcessName implements ProcessName {
* When we call _NSGetArgv we seem to always get a string that looks like what we'd expect from running ps, but
* with a null character inserted early. I don't know where this comes from, but it means I don't know how to get
* the length of space available for writing in the new program name. We therefore about 40 characters, which is
* a number without any foundation, but it at leaast allows the specs to pass, the functionality to be useful,
* a number without any foundation, but it at least allows the specs to pass, the functionality to be useful,
* and probably avoid crashing anyone's programs. I can't pretend this is great engineering.
*/
private static final int MAX_PROGRAM_NAME_LENGTH = 40;
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@
*/
package org.jruby.truffle.platform.java;

import org.jruby.truffle.core.ffi.TimeSpec;
import org.jruby.truffle.platform.ClockGetTime;
import org.jruby.truffle.platform.posix.TimeSpec;
import org.jruby.truffle.platform.posix.ClockGetTime;

public class JavaClockGetTime implements ClockGetTime {

Original file line number Diff line number Diff line change
@@ -15,13 +15,13 @@
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.queue.ArrayBlockingQueueLocksConditions;
import org.jruby.truffle.core.queue.LinkedBlockingQueueLocksConditions;
import org.jruby.truffle.platform.ClockGetTime;
import org.jruby.truffle.platform.posix.ClockGetTime;
import org.jruby.truffle.platform.DefaultRubiniusConfiguration;
import org.jruby.truffle.platform.NativePlatform;
import org.jruby.truffle.platform.ProcessName;
import org.jruby.truffle.platform.RubiniusConfiguration;
import org.jruby.truffle.platform.Sockets;
import org.jruby.truffle.platform.TrufflePOSIXHandler;
import org.jruby.truffle.platform.posix.Sockets;
import org.jruby.truffle.platform.posix.TrufflePOSIXHandler;
import org.jruby.truffle.platform.linux.LinuxRubiniusConfiguration;
import org.jruby.truffle.platform.openjdk.OpenJDKArrayBlockingQueueLocksConditions;
import org.jruby.truffle.platform.openjdk.OpenJDKLinkedBlockingQueueLocksConditions;
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@

import jnr.ffi.Pointer;
import jnr.posix.Timeval;
import org.jruby.truffle.platform.Sockets;
import org.jruby.truffle.platform.posix.Sockets;

public class JavaSockets implements Sockets {

Original file line number Diff line number Diff line change
@@ -17,13 +17,13 @@
import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.queue.ArrayBlockingQueueLocksConditions;
import org.jruby.truffle.core.queue.LinkedBlockingQueueLocksConditions;
import org.jruby.truffle.platform.ClockGetTime;
import org.jruby.truffle.platform.posix.ClockGetTime;
import org.jruby.truffle.platform.DefaultRubiniusConfiguration;
import org.jruby.truffle.platform.NativePlatform;
import org.jruby.truffle.platform.ProcessName;
import org.jruby.truffle.platform.RubiniusConfiguration;
import org.jruby.truffle.platform.Sockets;
import org.jruby.truffle.platform.TrufflePOSIXHandler;
import org.jruby.truffle.platform.posix.Sockets;
import org.jruby.truffle.platform.posix.TrufflePOSIXHandler;
import org.jruby.truffle.platform.java.JavaProcessName;
import org.jruby.truffle.platform.openjdk.OpenJDKArrayBlockingQueueLocksConditions;
import org.jruby.truffle.platform.openjdk.OpenJDKLinkedBlockingQueueLocksConditions;
Original file line number Diff line number Diff line change
@@ -17,11 +17,17 @@
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;

public class OpenJDKArrayBlockingQueueLocksConditions<T> extends DelegatingBlockingQueue<T> implements ArrayBlockingQueueLocksConditions<T> {
public class OpenJDKArrayBlockingQueueLocksConditions<T>
extends DelegatingBlockingQueue<T> implements ArrayBlockingQueueLocksConditions<T> {

private static final MethodHandle LOCK_FIELD_GETTER = MethodHandleUtils.getPrivateGetter(ArrayBlockingQueue.class, "lock");
private static final MethodHandle NOT_EMPTY_CONDITION_FIELD_GETTER = MethodHandleUtils.getPrivateGetter(ArrayBlockingQueue.class, "notEmpty");
private static final MethodHandle NOT_FULL_CONDITION_FIELD_GETTER = MethodHandleUtils.getPrivateGetter(ArrayBlockingQueue.class, "notFull");
private static final MethodHandle LOCK_FIELD_GETTER
= MethodHandleUtils.getPrivateGetter(ArrayBlockingQueue.class, "lock");

private static final MethodHandle NOT_EMPTY_CONDITION_FIELD_GETTER
= MethodHandleUtils.getPrivateGetter(ArrayBlockingQueue.class, "notEmpty");

private static final MethodHandle NOT_FULL_CONDITION_FIELD_GETTER
= MethodHandleUtils.getPrivateGetter(ArrayBlockingQueue.class, "notFull");

private final ReentrantLock lock;
private final Condition notEmptyCondition;
Original file line number Diff line number Diff line change
@@ -17,10 +17,14 @@
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;

public class OpenJDKLinkedBlockingQueueLocksConditions<T> extends DelegatingBlockingQueue<T> implements LinkedBlockingQueueLocksConditions<T> {
public class OpenJDKLinkedBlockingQueueLocksConditions<T>
extends DelegatingBlockingQueue<T> implements LinkedBlockingQueueLocksConditions<T> {

private static final MethodHandle TAKE_LOCK_FIELD_GETTER = MethodHandleUtils.getPrivateGetter(LinkedBlockingQueue.class, "takeLock");
private static final MethodHandle NOT_EMPTY_CONDITION_FIELD_GETTER = MethodHandleUtils.getPrivateGetter(LinkedBlockingQueue.class, "notEmpty");
private static final MethodHandle TAKE_LOCK_FIELD_GETTER
= MethodHandleUtils.getPrivateGetter(LinkedBlockingQueue.class, "takeLock");

private static final MethodHandle NOT_EMPTY_CONDITION_FIELD_GETTER
= MethodHandleUtils.getPrivateGetter(LinkedBlockingQueue.class, "notEmpty");

private final ReentrantLock lock;
private final Condition notEmptyCondition;
Original file line number Diff line number Diff line change
@@ -7,10 +7,10 @@
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.platform;

import org.jruby.truffle.core.ffi.TimeSpec;
package org.jruby.truffle.platform.posix;

public interface ClockGetTime {

int clock_gettime(int clock_id, TimeSpec timeSpec);

}
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.platform;
package org.jruby.truffle.platform.posix;

import jnr.ffi.Pointer;
import jnr.posix.Timeval;
Original file line number Diff line number Diff line change
@@ -7,11 +7,12 @@
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.core.ffi;
package org.jruby.truffle.platform.posix;

import jnr.ffi.Struct;

public final class TimeSpec extends Struct {

public final time_t tv_sec = new time_t();
public final SignedLong tv_nsec = new SignedLong();

@@ -26,4 +27,5 @@ public long getTVsec() {
public long getTVnsec() {
return tv_nsec.get();
}

}
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.platform;
package org.jruby.truffle.platform.posix;

import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import jnr.constants.platform.Errno;
Original file line number Diff line number Diff line change
@@ -21,15 +21,7 @@

public class SunMiscSignalManager implements SignalManager {

public final Map<String, Integer> SIGNALS_LIST = Collections.unmodifiableMap(RubySignal.list());

public final SignalHandler IGNORE_HANDLER = new SignalHandler() {
@Override
public void handle(Signal arg0) {
// Just ignore the signal.
}
};
private final ConcurrentMap<sun.misc.Signal, sun.misc.SignalHandler> DEFAULT_HANDLERS = new ConcurrentHashMap<sun.misc.Signal, sun.misc.SignalHandler>();
private final ConcurrentMap<sun.misc.Signal, sun.misc.SignalHandler> DEFAULT_HANDLERS = new ConcurrentHashMap<>();

@Override
public Signal createSignal(String name) {
@@ -38,18 +30,21 @@ public Signal createSignal(String name) {

@Override
public void watchSignal(Signal signal, SignalHandler newHandler) throws IllegalArgumentException {
handle((SunMiscSignal) signal, newHandler);
handle(signal, newHandler);
}

@Override
public void watchDefaultForSignal(Signal signal) throws IllegalArgumentException {
handleDefault((SunMiscSignal) signal);
handleDefault(signal);
}

@Override
public void handle(final Signal signal, final SignalHandler newHandler) throws IllegalArgumentException {
final SunMiscSignal smSignal = (SunMiscSignal) signal;
final sun.misc.SignalHandler oldSunHandler = sun.misc.Signal.handle(smSignal.getSunMiscSignal(), wrapHandler(signal, newHandler));

final sun.misc.SignalHandler oldSunHandler = sun.misc.Signal.handle(
smSignal.getSunMiscSignal(), wrapHandler(signal, newHandler));

DEFAULT_HANDLERS.putIfAbsent(smSignal.getSunMiscSignal(), oldSunHandler);
}