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

Commits on Jan 26, 2016

  1. Copy the full SHA
    1bfa42d View commit details
  2. Copy the full SHA
    e322d64 View commit details
  3. Copy the full SHA
    a665a0b View commit details
  4. Copy the full SHA
    42901a3 View commit details
  5. Copy the full SHA
    c08684a View commit details
1 change: 1 addition & 0 deletions core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -224,6 +224,7 @@ public class Options {
public static final Option<Boolean> TRUFFLE_COVERAGE_GLOBAL = bool(TRUFFLE, "truffle.coverage.global", false, "Run coverage for all code and print results on exit.");

public static final Option<String> TRUFFLE_CORE_LOAD_PATH = string(TRUFFLE, "truffle.core.load_path", "truffle:/jruby-truffle", "Location to load the Truffle core library from.");
public static final Option<Boolean> TRUFFLE_POSIX_USE_JAVA = bool(TRUFFLE, "truffle.posix.use_java", false, "Use a Java emulation of POSIX.");

public static final Option<Integer> TRUFFLE_ARRAY_UNINITIALIZED_SIZE = integer(TRUFFLE, "truffle.array.uninitialized_size", 32, "How large an Array to allocate when we have no other information to go on.");
public static final Option<Integer> TRUFFLE_ARRAY_SMALL = integer(TRUFFLE, "truffle.array.small", 3, "Maximum size of an Array to consider small for optimisations.");
540 changes: 540 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/runtime/BaseLibC.java

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/runtime/JavaLibC.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.runtime;

import jnr.posix.LibC;

public class JavaLibC extends BaseLibC implements LibC {

public static final JavaLibC INSTANCE = new JavaLibC();

private JavaLibC() {
}

@Override
public int isatty(int fd) {
return System.console() != null ? 1 : 0;
}
}
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ public class Options {
// Resources

public final String CORE_LOAD_PATH = org.jruby.util.cli.Options.TRUFFLE_CORE_LOAD_PATH.load();
public final boolean POSIX_USE_JAVA = org.jruby.util.cli.Options.TRUFFLE_POSIX_USE_JAVA.load();

// Data structures

636 changes: 636 additions & 0 deletions truffle/src/main/java/org/jruby/truffle/runtime/POSIXDelegator.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -168,8 +168,11 @@ public RubyContext(Ruby runtime, TruffleLanguage.Env env) {

this.runtime = runtime;

// JRuby+Truffle uses POSIX for all IO - we need the native version
posix = POSIXFactory.getNativePOSIX(new TrufflePOSIXHandler(this));
if (options.POSIX_USE_JAVA) {
posix = new TruffleJavaPOSIX(this, POSIXFactory.getJavaPOSIX(new TrufflePOSIXHandler(this)));
} else {
posix = POSIXFactory.getNativePOSIX(new TrufflePOSIXHandler(this));
}

nativeSockets = LibraryLoader.create(NativeSockets.class).library("c").load();

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.runtime;

import jnr.constants.platform.Fcntl;
import jnr.posix.LibC;
import jnr.posix.POSIX;

public class TruffleJavaPOSIX extends POSIXDelegator implements POSIX {

private final RubyContext context;

public TruffleJavaPOSIX(RubyContext context, POSIX delegateTo) {
super(delegateTo);
this.context = context;
}

@Override
public int fcntlInt(int fd, Fcntl fcntlConst, int arg) {
if (fcntlConst.longValue() == Fcntl.F_GETFL.longValue()) {
switch (fd) {
case 0:
case 1:
case 2:
return 0;
}
}

return super.fcntlInt(fd, fcntlConst, arg);
}

@Override
public int getpid() {
return context.hashCode();
}

@Override
public LibC libc() {
return JavaLibC.INSTANCE;
}

}