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

Commits on Feb 4, 2016

  1. Copy the full SHA
    960a4f1 View commit details
  2. Copy the full SHA
    903168e View commit details
  3. Copy the full SHA
    43d4e25 View commit details
  4. Copy the full SHA
    ee198e7 View commit details
  5. Copy the full SHA
    f549917 View commit details
  6. deprecated initialize19 ... should be uniform - in all of the other p…

    …laces there's initialize
    kares committed Feb 4, 2016
    Copy the full SHA
    4bbc204 View commit details
11 changes: 10 additions & 1 deletion core/src/main/java/org/jruby/RubyBasicObject.java
Original file line number Diff line number Diff line change
@@ -233,10 +233,19 @@ static void recacheBuiltinMethods(Ruby runtime) {
}

@JRubyMethod(name = "initialize", visibility = PRIVATE)
public IRubyObject initialize19(ThreadContext context) {
public IRubyObject initialize(ThreadContext context) {
return context.nil;
}

@Deprecated
public IRubyObject initialize19(ThreadContext context) {
return initialize(context);
}

//public IRubyObject initialize(ThreadContext context, IRubyObject[] args) {
// return initialize(context);
//}

/**
* Standard path for object creation. Objects are entered into ObjectSpace
* only if ObjectSpace is enabled.
10 changes: 0 additions & 10 deletions core/src/main/java/org/jruby/RubyObject.java
Original file line number Diff line number Diff line change
@@ -278,16 +278,6 @@ public IRubyObject allocate(Ruby runtime, RubyClass klass) {
}
};

@Deprecated
@Override
public IRubyObject initialize() {
return getRuntime().getNil();
}

public IRubyObject initialize(ThreadContext context) {
return initialize19(context);
}

/**
* Will make sure that this object is added to the current object
* space.
16 changes: 6 additions & 10 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -1461,24 +1461,20 @@ public static RubyString newInstance(IRubyObject recv, IRubyObject[] args, Block
}

@Override
@JRubyMethod(name = "initialize", visibility = PRIVATE)
public IRubyObject initialize(ThreadContext context) {
return initialize19(context);
}

public IRubyObject initialize(ThreadContext context, IRubyObject arg0) {
return initialize19(context, arg0);
return this;
}

@JRubyMethod(name = "initialize", visibility = PRIVATE)
@Override
public IRubyObject initialize19(ThreadContext context) {
public IRubyObject initialize(ThreadContext context, IRubyObject arg0) {
replace19(arg0);
return this;
}

@JRubyMethod(name = "initialize", visibility = PRIVATE)
@Deprecated
public IRubyObject initialize19(ThreadContext context, IRubyObject arg0) {
replace19(arg0);
return this;
return initialize(context, arg0);
}

public IRubyObject casecmp(ThreadContext context, IRubyObject other) {
40 changes: 21 additions & 19 deletions core/src/main/java/org/jruby/compiler/JITCompiler.java
Original file line number Diff line number Diff line change
@@ -49,10 +49,12 @@
import org.jruby.util.JavaNameMangler;
import org.jruby.util.OneShotClassLoader;
import org.jruby.util.cli.Options;
import org.jruby.util.collections.IntHashMap;
import org.jruby.util.log.Logger;
import org.jruby.util.log.LoggerFactory;
import org.objectweb.asm.Opcodes;

import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.security.MessageDigest;
@@ -185,9 +187,9 @@ public void buildThresholdReached(ThreadContext context, final Compilable method
private static final MethodHandles.Lookup PUBLIC_LOOKUP = MethodHandles.publicLookup().in(Ruby.class);

private class FullBuildTask implements Runnable {
private final Compilable method;
private final Compilable<InterpreterContext> method;

public FullBuildTask(Compilable method) {
FullBuildTask(Compilable<InterpreterContext> method) {
this.method = method;
}

@@ -278,41 +280,41 @@ public void run() {
}

if (config.isJitLogging()) {
log(method.getImplementationClass(), method.getFile(), method.getLine(), className + "." + methodName, "done jitting");
log(method.getImplementationClass(), method.getFile(), method.getLine(), className + '.' + methodName, "done jitting");
}

Map<Integer, MethodType> signatures = context.getNativeSignatures();
String jittedName = context.getJittedName();
if (signatures.size() == 1) {
final String jittedName = context.getJittedName();
MethodHandle variable = PUBLIC_LOOKUP.findStatic(sourceClass, jittedName, context.getNativeSignature(-1));
IntHashMap<MethodType> signatures = context.getNativeSignaturesExceptVariable();

if (signatures.size() == 0) {
// only variable-arity
method.completeBuild(
new CompiledIRMethod(
PUBLIC_LOOKUP.findStatic(sourceClass, jittedName, signatures.get(-1)),
variable,
method.getIRScope(),
method.getVisibility(),
method.getImplementationClass(),
method.getIRScope().receivesKeywordArgs()));

} else {
// also specific-arity
for (Map.Entry<Integer, MethodType> entry : signatures.entrySet()) {
if (entry.getKey() == -1) continue; // variable arity handle pushed above

for (IntHashMap.Entry<MethodType> entry : signatures.entrySet()) {
method.completeBuild(
new CompiledIRMethod(
PUBLIC_LOOKUP.findStatic(sourceClass, jittedName, signatures.get(-1)),
variable,
PUBLIC_LOOKUP.findStatic(sourceClass, jittedName, entry.getValue()),
entry.getKey(),
method.getIRScope(),
method.getVisibility(),
method.getImplementationClass(),
method.getIRScope().receivesKeywordArgs()));
break;
break; // FIXME: only supports one arity
}
}
} catch (Throwable t) {
if (config.isJitLogging()) {
log(method.getImplementationClass(), method.getFile(), method.getLine(), className + "." + methodName, "Could not compile; passes run: " + method.getIRScope().getExecutedPasses(), t.getMessage());
log(method.getImplementationClass(), method.getFile(), method.getLine(), className + '.' + methodName, "Could not compile; passes run: " + method.getIRScope().getExecutedPasses(), t.getMessage());
if (config.isJitLoggingVerbose()) {
t.printStackTrace();
}
@@ -475,7 +477,7 @@ public String name() {

@Override
public String toString() {
return methodName + "() at " + method.getFile() + ":" + method.getLine();
return methodName + "() at " + method.getFile() + ':' + method.getLine();
}

private final String packageName;
@@ -487,7 +489,7 @@ public String toString() {

private byte[] bytecode;
private long compileTime;
private String name;
private final String name;
}

public static class BlockJITClassGenerator {
@@ -505,8 +507,8 @@ public BlockJITClassGenerator(String className, String methodName, String key, R
} else {
digestString = key;
}
this.className = packageName + "/" + className.replace('.', '/') + CLASS_METHOD_DELIMITER + JavaNameMangler.mangleMethodName(methodName) + "_" + digestString;
this.name = this.className.replaceAll("/", ".");
this.className = packageName + '/' + className.replace('.', '/') + CLASS_METHOD_DELIMITER + JavaNameMangler.mangleMethodName(methodName) + '_' + digestString;
this.name = this.className.replace('/', '.');
this.methodName = methodName;
this.body = body;
this.visitor = visitor;
@@ -562,7 +564,7 @@ public String name() {

@Override
public String toString() {
return "{} at " + body.getFile() + ":" + body.getLine();
return "{} at " + body.getFile() + ':' + body.getLine();
}

private final String packageName;
@@ -574,7 +576,7 @@ public String toString() {

private byte[] bytecode;
private long compileTime;
private String name;
private final String name;
}

static void log(RubyModule implementationClass, String file, int line, String name, String message, String... reason) {
3 changes: 1 addition & 2 deletions core/src/main/java/org/jruby/ext/ffi/Struct.java
Original file line number Diff line number Diff line change
@@ -123,11 +123,10 @@ static final StructLayout getStructLayout(Ruby runtime, IRubyObject structClass)
}
}

@Override
@JRubyMethod(name = "initialize", visibility = PRIVATE)
public IRubyObject initialize(ThreadContext context) {

memory = MemoryPointer.allocate(context.runtime, layout.getSize(), 1, true);

return this;
}

1 change: 1 addition & 0 deletions core/src/main/java/org/jruby/ext/socket/RubyUDPSocket.java
Original file line number Diff line number Diff line change
@@ -86,6 +86,7 @@ public RubyUDPSocket(Ruby runtime, RubyClass type) {
super(runtime, type);
}

@Override
@JRubyMethod(visibility = Visibility.PRIVATE)
public IRubyObject initialize(ThreadContext context) {
Ruby runtime = context.runtime;
Loading