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: 40e1ead25282
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 68071f884085
Choose a head ref

Commits on Jan 15, 2016

  1. Copy the full SHA
    7046852 View commit details
  2. Copy the full SHA
    5d61a09 View commit details

Commits on Jan 16, 2016

  1. Copy the full SHA
    5f4b74c View commit details
  2. Copy the full SHA
    0c6960d View commit details
  3. Copy the full SHA
    28c6533 View commit details

Commits on Jan 17, 2016

  1. Copy the full SHA
    5cb811a View commit details

Commits on Jan 19, 2016

  1. Merge branch 'master' into truffle-head

    # Conflicts:
    #	.travis.yml
    chrisseaton committed Jan 19, 2016
    Copy the full SHA
    ad5f49e View commit details
  2. Copy the full SHA
    4ccfa3a View commit details

Commits on Jan 21, 2016

  1. Copy the full SHA
    a6d9e07 View commit details
  2. Copy the full SHA
    08da5de View commit details

Commits on Jan 22, 2016

  1. Copy the full SHA
    c757e7c View commit details
  2. Copy the full SHA
    7414a67 View commit details
  3. Copy the full SHA
    f7a77b6 View commit details

Commits on Jan 25, 2016

  1. Copy the full SHA
    cb0634a View commit details
  2. Copy the full SHA
    0a53b78 View commit details

Commits on Jan 26, 2016

  1. Copy the full SHA
    c465d06 View commit details
  2. Copy the full SHA
    718d8f2 View commit details

Commits on Jan 27, 2016

  1. Copy the full SHA
    1e4cfde View commit details
  2. Copy the full SHA
    e4d7808 View commit details
  3. Copy the full SHA
    3cd7d33 View commit details
  4. Copy the full SHA
    96daf26 View commit details

Commits on Jan 28, 2016

  1. Copy the full SHA
    f3460a2 View commit details

Commits on Jan 29, 2016

  1. Copy the full SHA
    fce1e57 View commit details
  2. [Truffle] Avoid creating a ByteList just to convert it to a Rope for …

    …Strings with unknown code ranges.
    nirvdrum committed Jan 29, 2016
    Copy the full SHA
    c6973d6 View commit details
  3. Copy the full SHA
    e624281 View commit details
  4. Copy the full SHA
    cc38367 View commit details
  5. Copy the full SHA
    20170dc View commit details
  6. Copy the full SHA
    c3e71c5 View commit details
  7. Copy the full SHA
    0765614 View commit details
  8. Copy the full SHA
    b9b49a4 View commit details
  9. Copy the full SHA
    598c472 View commit details
  10. Copy the full SHA
    d6bdc69 View commit details
  11. Copy the full SHA
    38f8acd View commit details
  12. Copy the full SHA
    221932a View commit details
  13. Copy the full SHA
    268f07b View commit details
  14. Copy the full SHA
    58f5d14 View commit details
  15. Copy the full SHA
    4ec1a7c View commit details
  16. 5
    Copy the full SHA
    ecf4c37 View commit details
  17. Copy the full SHA
    3aacbb5 View commit details
  18. Copy the full SHA
    7b166bc View commit details
  19. Copy the full SHA
    2a1a851 View commit details

Commits on Jan 30, 2016

  1. Copy the full SHA
    4b95c69 View commit details
  2. [Truffle] There's no need to force_encoding in Array#pack.

    While this may have had value with ByteLists, it seems to just duplicate work for Ropes. Moreover, StringSupport.force_encoding is a slow-path helper, so we should avoid it on fast paths if possible.
    nirvdrum committed Jan 30, 2016
    Copy the full SHA
    a9567d0 View commit details
  3. Copy the full SHA
    b59bdd5 View commit details
  4. Copy the full SHA
    f437c73 View commit details

Commits on Feb 1, 2016

  1. Improve constant caching and factor logic out.

    ConstantLookupSite now handles all constant lookup cases:
    
    * Lexical+hierarchical search in searchConst
    * Hierarchical search in inheritanceSearchConst
    * LexicalSearch in lexicalSearchConst (for defined?)
    
    Up to now, all three forms would cache one recent constant and
    replace that binding on invalidation. This is obviously slow
    when there are more than one possible constant value (lookups in
    different hierarchies, for example) so I have modified it to chain
    a series of bindings. This chain is currently not limited, and
    that should be fixed; but the current logic improves red/black by
    around 12%.
    headius committed Feb 1, 2016
    Copy the full SHA
    d0a40ba View commit details
  2. Bind attribute accessors as direct instance variable accesses.

    This works for both field-based (reified) and array-based instance
    variables. Performance of red/black improves by about 30% with
    this change.
    headius committed Feb 1, 2016
    Copy the full SHA
    628d386 View commit details
  3. Bind Class#new directly to initialize.

    The logic here to bind initialize when calling the basic Class#new
    is as follows:
    
    * Filter the incoming self (the class we're newing) with the class
      allocator.
    * Fold in a call site for the initialize method. This binds like
      a normal dynamic call with all appropriate guards.
    * Return the self produced by the allocate call.
    
    With this change, any Class#new call that uses the base new logic
    should go directly via MethodHandles to the associated initialize
    method, allowing everything to inline.
    headius committed Feb 1, 2016
    Copy the full SHA
    b4b7cd4 View commit details
  4. Copy the full SHA
    38ebd33 View commit details
  5. Bump up src dist size check.

    headius committed Feb 1, 2016
    Copy the full SHA
    5f715f0 View commit details
Showing 816 changed files with 7,414 additions and 5,994 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -40,7 +40,7 @@ For [`rbenv`](https://github.com/sstephenson/rbenv) you will need the
package manager can provide these. Then you can run:

```
$ rbenv install jruby-9.0.0.0-dev
$ rbenv install jruby-9.0.5.0
```

For [`rvm`](https://rvm.io) you can simply do:
5 changes: 1 addition & 4 deletions bin/jruby+truffle
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#!/usr/bin/env bash
"exec" "`dirname $BASH_SOURCE[0]`/jruby" "$0" "$@"

require File.join(JRuby.runtime.instance_config.jruby_home, 'lib/ruby/truffle/jruby+truffle/runner')

JRubyTruffleRunner.new
exec `dirname $BASH_SOURCE[0]`/jruby `dirname $BASH_SOURCE[0]`/../lib/ruby/truffle/jruby+truffle/bin/jruby+truffle "$@"
23 changes: 23 additions & 0 deletions core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -4854,6 +4854,24 @@ public Object constant() {
return constant;
}

/**
* Set the base Class#new method.
*
* @param baseNewMethod
*/
public void setBaseNewMethod(DynamicMethod baseNewMethod) {
this.baseNewMethod = baseNewMethod;
}

/**
* Get the base Class#new method.
*
* @return the base Class#new method
*/
public DynamicMethod getBaseNewMethod() {
return baseNewMethod;
}

@Deprecated
public int getSafeLevel() {
return 0;
@@ -5207,4 +5225,9 @@ public void addToObjectSpace(boolean useObjectSpace, IRubyObject object) {
* accesses.
*/
private final Object constant;

/**
* The built-in Class#new method, so we can bind more directly to allocate and initialize.
*/
private DynamicMethod baseNewMethod;
}
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.
2 changes: 2 additions & 0 deletions core/src/main/java/org/jruby/RubyClass.java
Original file line number Diff line number Diff line change
@@ -113,6 +113,8 @@ public static void createClassClass(Ruby runtime, RubyClass classClass) {
classClass.undefineMethod("extend_object");

classClass.defineAnnotatedMethods(RubyClass.class);

runtime.setBaseNewMethod(classClass.searchMethod("new"));
}

public static final ObjectAllocator CLASS_ALLOCATOR = new ObjectAllocator() {
10 changes: 0 additions & 10 deletions core/src/main/java/org/jruby/RubyObject.java
Original file line number Diff line number Diff line change
@@ -279,16 +279,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.
34 changes: 7 additions & 27 deletions core/src/main/java/org/jruby/RubyString.java
Original file line number Diff line number Diff line change
@@ -1497,40 +1497,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, new IRubyObject[] { 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, optional = 2)
public IRubyObject initialize19(ThreadContext context, IRubyObject[] args) {
if ( args.length == 0 ) return this;

IRubyObject arg = args[ args.length - 1 ];

final IRubyObject string; final IRubyObject encoding;
if ( arg instanceof RubyHash ) { // new encoding: ...
final RubySymbol enc = context.runtime.newSymbol("encoding");
encoding = ( (RubyHash) arg ).fastARef(enc);
string = args.length > 1 ? args[0] : null;
}
else {
string = arg; encoding = null;
}

if ( string != null ) replace19(string);
if ( encoding != null ) force_encoding(context, encoding);

return this;
@Deprecated
public IRubyObject initialize19(ThreadContext context, IRubyObject arg0) {
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
@@ -88,6 +88,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