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

Commits on Dec 4, 2016

  1. Copy the full SHA
    e2a34cc View commit details
  2. [Truffle] Privatisation.

    chrisseaton committed Dec 4, 2016
    Copy the full SHA
    a01e381 View commit details
1 change: 1 addition & 0 deletions spec/truffle/tags/command_line/rubyopt_tags.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fails:Processing RUBYOPT prints the version number for '-v'
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@
import org.jruby.truffle.RubyLanguage;
import org.jruby.truffle.language.loader.SourceLoader;
import org.jruby.util.FileResource;
import org.jruby.util.SafePropertyAccessor;
import org.jruby.truffle.util.SafePropertyAccessor;

import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
115 changes: 108 additions & 7 deletions truffle/src/main/java/org/jruby/truffle/core/VMPrimitiveNodes.java
Original file line number Diff line number Diff line change
@@ -80,7 +80,7 @@
import org.jruby.truffle.platform.signal.Signal;
import org.jruby.truffle.platform.signal.SignalHandler;
import org.jruby.truffle.platform.signal.SignalManager;
import org.jruby.util.io.PosixShim;
import org.jruby.truffle.util.Platform;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean;
@@ -579,18 +579,119 @@ public Object waitPID(int input_pid, boolean no_hang) {

final int status = statusReference[0];

if (PosixShim.WAIT_MACROS.WIFEXITED(status)) {
output = PosixShim.WAIT_MACROS.WEXITSTATUS(status);
} else if (PosixShim.WAIT_MACROS.WIFSIGNALED(status)) {
termsig = PosixShim.WAIT_MACROS.WTERMSIG(status);
} else if (PosixShim.WAIT_MACROS.WIFSTOPPED(status)) {
stopsig = PosixShim.WAIT_MACROS.WSTOPSIG(status);
if (WAIT_MACROS.WIFEXITED(status)) {
output = WAIT_MACROS.WEXITSTATUS(status);
} else if (WAIT_MACROS.WIFSIGNALED(status)) {
termsig = WAIT_MACROS.WTERMSIG(status);
} else if (WAIT_MACROS.WIFSTOPPED(status)) {
stopsig = WAIT_MACROS.WSTOPSIG(status);
}

Object[] objects = new Object[]{ output, termsig, stopsig, pid };
return createArray(objects, objects.length);
}

public interface WaitMacros {
public abstract boolean WIFEXITED(long status);
public abstract boolean WIFSIGNALED(long status);
public abstract int WTERMSIG(long status);
public abstract int WEXITSTATUS(long status);
public abstract int WSTOPSIG(long status);
public abstract boolean WIFSTOPPED(long status);
public abstract boolean WCOREDUMP(long status);
}

public static class BSDWaitMacros implements WaitMacros {
public final long _WSTOPPED = 0177;

// Only confirmed on Darwin
public final long WCOREFLAG = 0200;

public long _WSTATUS(long status) {
return status & _WSTOPPED;
}

public boolean WIFEXITED(long status) {
return _WSTATUS(status) == 0;
}

public boolean WIFSIGNALED(long status) {
return _WSTATUS(status) != _WSTOPPED && _WSTATUS(status) != 0;
}

public int WTERMSIG(long status) {
return (int)_WSTATUS(status);
}

public int WEXITSTATUS(long status) {
// not confirmed on all platforms
return (int)((status >>> 8) & 0xFF);
}

public int WSTOPSIG(long status) {
return (int)(status >>> 8);
}

public boolean WIFSTOPPED(long status) {
return _WSTATUS(status) == _WSTOPPED && WSTOPSIG(status) != 0x13;
}

public boolean WCOREDUMP(long status) {
return (status & WCOREFLAG) != 0;
}
}

public static class LinuxWaitMacros implements WaitMacros {
private int __WAIT_INT(long status) { return (int)status; }

private int __W_EXITCODE(int ret, int sig) { return (ret << 8) | sig; }
private int __W_STOPCODE(int sig) { return (sig << 8) | 0x7f; }
private static int __W_CONTINUED = 0xffff;
private static int __WCOREFLAG = 0x80;

/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */
private int __WEXITSTATUS(long status) { return (int)((status & 0xff00) >> 8); }

/* If WIFSIGNALED(STATUS), the terminating signal. */
private int __WTERMSIG(long status) { return (int)(status & 0x7f); }

/* If WIFSTOPPED(STATUS), the signal that stopped the child. */
private int __WSTOPSIG(long status) { return __WEXITSTATUS(status); }

/* Nonzero if STATUS indicates normal termination. */
private boolean __WIFEXITED(long status) { return __WTERMSIG(status) == 0; }

/* Nonzero if STATUS indicates termination by a signal. */
private boolean __WIFSIGNALED(long status) {
return ((status & 0x7f) + 1) >> 1 > 0;
}

/* Nonzero if STATUS indicates the child is stopped. */
private boolean __WIFSTOPPED(long status) { return (status & 0xff) == 0x7f; }

/* Nonzero if STATUS indicates the child dumped core. */
private boolean __WCOREDUMP(long status) { return (status & __WCOREFLAG) != 0; }

/* Macros for constructing status values. */
public int WEXITSTATUS(long status) { return __WEXITSTATUS (__WAIT_INT (status)); }
public int WTERMSIG(long status) { return __WTERMSIG(__WAIT_INT(status)); }
public int WSTOPSIG(long status) { return __WSTOPSIG(__WAIT_INT(status)); }
public boolean WIFEXITED(long status) { return __WIFEXITED(__WAIT_INT(status)); }
public boolean WIFSIGNALED(long status) { return __WIFSIGNALED(__WAIT_INT(status)); }
public boolean WIFSTOPPED(long status) { return __WIFSTOPPED(__WAIT_INT(status)); }
public boolean WCOREDUMP(long status) { return __WCOREDUMP(__WAIT_INT(status)); }
}

public static final WaitMacros WAIT_MACROS;
static {
if (Platform.IS_BSD) {
WAIT_MACROS = new BSDWaitMacros();
} else {
// need other platforms
WAIT_MACROS = new LinuxWaitMacros();
}
}

}

@Primitive(name = "vm_set_class", needsSelf = false)
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
import org.jruby.truffle.core.format.FormatNode;
import org.jruby.truffle.core.format.printf.PrintfSimpleTreeBuilder;
import org.jruby.util.ByteList;
import org.jruby.util.Sprintf;
import org.jruby.truffle.util.Sprintf;

import java.text.NumberFormat;
import java.util.Locale;
Original file line number Diff line number Diff line change
@@ -74,7 +74,7 @@
import org.jruby.truffle.platform.FDSet;
import org.jruby.truffle.platform.UnsafeGroup;
import org.jruby.util.ByteList;
import org.jruby.util.Dir;
import org.jruby.truffle.util.Dir;
import org.jruby.truffle.util.UnsafeHolder;

import java.nio.ByteBuffer;
Original file line number Diff line number Diff line change
@@ -152,7 +152,7 @@ public static String getVersionString() {
SafePropertyAccessor.getProperty("java.vm.version", "Unknown JVM version"),
SafePropertyAccessor.getProperty("java.runtime.version", SafePropertyAccessor.getProperty("java.version", "Unknown version")),
org.jruby.util.cli.Options.COMPILE_INVOKEDYNAMIC.load() ? " +indy" : "",
"truffle",
"",
Platform.getOSName(),
Platform.getArchitecture()
);
Original file line number Diff line number Diff line change
@@ -35,10 +35,8 @@
import org.jruby.util.FileResource;
import org.jruby.util.InputStreamMarkCursor;
import org.jruby.util.JRubyFile;
import org.jruby.util.KCode;
import org.jruby.util.SafePropertyAccessor;
import org.jruby.truffle.util.SafePropertyAccessor;
import org.jruby.util.cli.Options;
import org.jruby.util.cli.OutputStrings;

import java.io.BufferedInputStream;
import java.io.BufferedReader;
@@ -729,7 +727,6 @@ public static ClassLoader defaultClassLoader() {
private boolean shouldRunInterpreter = true;
private boolean shouldPrintUsage = Options.CLI_HELP.load();
private boolean shouldPrintProperties=Options.CLI_PROPERTIES.load();
private KCode kcode = Options.CLI_KCODE.load();
private boolean shouldCheckSyntax = Options.CLI_CHECK_SYNTAX.load();
private String inputFieldSeparator = Options.CLI_AUTOSPLIT_SEPARATOR.load();
private String inPlaceBackupExtension = Options.CLI_BACKUP_EXTENSION.load();
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ public final class Constants {
*/
public static final int JIT_THRESHOLD = 50;

private static String jruby_revision = "046edbf";
private static String jruby_revision = "unknown";

@Deprecated
public static final String JRUBY_PROPERTIES = "/org/jruby/jruby.properties";
Loading