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

Commits on Jun 13, 2017

  1. Copy the full SHA
    7d58bb4 View commit details
  2. Copy the full SHA
    1ff0cc9 View commit details
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
@@ -1674,7 +1674,7 @@ public RubyClass defineOrGetClassUnder(String name, RubyClass superClazz, Object

if (allocator == null) {
if (isReifiable(runtime, superClazz)) {
if (RubyInstanceConfig.REIFY_RUBY_CLASSES) {
if (Options.REIFY_CLASSES.load()) {
allocator = REIFYING_OBJECT_ALLOCATOR;
} else if (Options.REIFY_VARIABLES.load()) {
allocator = IVAR_INSPECTING_OBJECT_ALLOCATOR;
4 changes: 2 additions & 2 deletions core/src/main/java/org/jruby/ext/ffi/AutoPointer.java
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
import java.util.concurrent.ConcurrentMap;
import org.jruby.Ruby;
import org.jruby.RubyClass;
import org.jruby.RubyInstanceConfig;
import org.jruby.RubyModule;
import org.jruby.anno.JRubyClass;
import org.jruby.anno.JRubyMethod;
@@ -20,6 +19,7 @@
import org.jruby.runtime.callsite.CachingCallSite;
import org.jruby.runtime.callsite.FunctionalCachingCallSite;
import org.jruby.util.PhantomReferenceReaper;
import org.jruby.util.cli.Options;

import static org.jruby.runtime.Visibility.*;

@@ -38,7 +38,7 @@ public class AutoPointer extends Pointer {
public static RubyClass createAutoPointerClass(Ruby runtime, RubyModule module) {
RubyClass autoptrClass = module.defineClassUnder(AUTOPTR_CLASS_NAME,
module.getClass("Pointer"),
RubyInstanceConfig.REIFY_RUBY_CLASSES ? new ReifyingAllocator(AutoPointer.class) : AutoPointerAllocator.INSTANCE);
Options.REIFY_FFI.load() ? new ReifyingAllocator(AutoPointer.class) : AutoPointerAllocator.INSTANCE);
autoptrClass.defineAnnotatedMethods(AutoPointer.class);
autoptrClass.defineAnnotatedConstants(AutoPointer.class);
autoptrClass.setReifiedClass(AutoPointer.class);
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/ext/ffi/MemoryPointer.java
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.cli.Options;

import static org.jruby.runtime.Visibility.PRIVATE;

@@ -19,7 +20,7 @@ public class MemoryPointer extends Pointer {
public static RubyClass createMemoryPointerClass(Ruby runtime, RubyModule module) {
RubyClass memptrClass = module.defineClassUnder("MemoryPointer",
module.getClass("Pointer"),
RubyInstanceConfig.REIFY_RUBY_CLASSES ? new ReifyingAllocator(MemoryPointer.class) : MemoryPointerAllocator.INSTANCE);
Options.REIFY_FFI.load() ? new ReifyingAllocator(MemoryPointer.class) : MemoryPointerAllocator.INSTANCE);
memptrClass.defineAnnotatedMethods(MemoryPointer.class);
memptrClass.defineAnnotatedConstants(MemoryPointer.class);
memptrClass.setReifiedClass(MemoryPointer.class);
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/ext/ffi/Pointer.java
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
import org.jruby.internal.runtime.methods.DynamicMethod;
import org.jruby.runtime.*;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.cli.Options;

import static org.jruby.runtime.Visibility.*;

@@ -23,7 +24,7 @@ public class Pointer extends AbstractMemory {
public static RubyClass createPointerClass(Ruby runtime, RubyModule module) {
RubyClass pointerClass = module.defineClassUnder("Pointer",
module.getClass(AbstractMemory.ABSTRACT_MEMORY_RUBY_CLASS),
RubyInstanceConfig.REIFY_RUBY_CLASSES ? new ReifyingAllocator(Pointer.class) : PointerAllocator.INSTANCE);
Options.REIFY_FFI.load() ? new ReifyingAllocator(Pointer.class) : PointerAllocator.INSTANCE);

pointerClass.defineAnnotatedMethods(Pointer.class);
pointerClass.defineAnnotatedConstants(Pointer.class);
4 changes: 3 additions & 1 deletion core/src/main/java/org/jruby/ext/ffi/Struct.java
Original file line number Diff line number Diff line change
@@ -11,6 +11,8 @@
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.util.cli.Options;

import static org.jruby.runtime.Visibility.*;

@JRubyClass(name="FFI::Struct", parent="Object")
@@ -35,7 +37,7 @@ public final IRubyObject allocate(Ruby runtime, RubyClass klass) {
public static RubyClass createStructClass(Ruby runtime, RubyModule module) {

RubyClass structClass = runtime.defineClassUnder("Struct", runtime.getObject(),
RubyInstanceConfig.REIFY_RUBY_CLASSES ? new ReifyingAllocator(Struct.class): Allocator.INSTANCE, module);
Options.REIFY_FFI.load() ? new ReifyingAllocator(Struct.class): Allocator.INSTANCE, module);
structClass.defineAnnotatedMethods(Struct.class);
structClass.defineAnnotatedConstants(Struct.class);
structClass.setReifiedClass(Struct.class);
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/util/cli/Options.java
Original file line number Diff line number Diff line change
@@ -151,6 +151,7 @@ public class Options {
public static final Option<Boolean> JUMP_BACKTRACE = bool(MISCELLANEOUS, "jump.backtrace", false, "Make non-local flow jumps generate backtraces.");
public static final Option<Boolean> PROCESS_NOUNWRAP = bool(MISCELLANEOUS, "process.noUnwrap", false, "Do not unwrap process streams (issue on some recent JVMs).");
public static final Option<Boolean> REIFY_CLASSES = bool(MISCELLANEOUS, "reify.classes", false, "Before instantiation, stand up a real Java class for every Ruby class.");
public static final Option<Boolean> REIFY_FFI = bool(MISCELLANEOUS, "reify.ffi", false, "Reify FFI memory structures.");
public static final Option<Boolean> REIFY_LOGERRORS = bool(MISCELLANEOUS, "reify.logErrors", false, "Log errors during reification (reify.classes=true).");
public static final Option<Boolean> REFLECTED_HANDLES = bool(MISCELLANEOUS, "reflected.handles", false, "Use reflection for binding methods, not generated bytecode.");
public static final Option<Boolean> BACKTRACE_COLOR = bool(MISCELLANEOUS, "backtrace.color", false, "Enable colorized backtraces.");
@@ -163,7 +164,7 @@ public class Options {
public static final Option<Boolean> NATIVE_EXEC = bool(MISCELLANEOUS, "native.exec", true, "Do a true process-obliterating native exec for Kernel#exec.");
public static final Option<Boolean> ENUMERATOR_LIGHTWEIGHT = bool(MISCELLANEOUS, "enumerator.lightweight", true, "Use lightweight Enumerator#next logic when possible.");
public static final Option<Boolean> CONSISTENT_HASHING = bool(MISCELLANEOUS, "consistent.hashing", false, "Generate consistent object hashes across JVMs");
public static final Option<Boolean> REIFY_VARIABLES = bool(MISCELLANEOUS, "reify.variables", true, "Attempt to expand instance vars into Java fields");
public static final Option<Boolean> REIFY_VARIABLES = bool(MISCELLANEOUS, "reify.variables", !REIFY_CLASSES.load(), "Attempt to expand instance vars into Java fields");
public static final Option<Boolean> PREFER_IPV4 = bool(MISCELLANEOUS, "net.preferIPv4", true, "Prefer IPv4 network stack");
public static final Option<Boolean> FCNTL_LOCKING = bool(MISCELLANEOUS, "file.flock.fcntl", true, "Use fcntl rather than flock for File#flock");
public static final Option<Boolean> VOLATILE_VARIABLES = bool(MISCELLANEOUS, "volatile.variables", true, "Always ensure volatile semantics for instance variables.");