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

Commits on Apr 12, 2018

  1. All in IR are symbols but scope name and calls. A little detour to fi…

    …x some
    
    parser spec failures...
    enebo committed Apr 12, 2018
    Copy the full SHA
    4204559 View commit details

Commits on Apr 14, 2018

  1. More symbolification of IR. Only oddity of this change was requirement

     to make a RubySymbol for each IRScript.  We maybe can change that later
     but we don't exactly load millions of files so the extra symbol creation
     is not the end of the world.  It cound even be argued we should do this
     to accurately create bytes filesystem expects but our interactions with
     java core libraries makes me wonder if we can really do that or not.
    enebo committed Apr 14, 2018
    Copy the full SHA
    29edb47 View commit details
Showing with 211 additions and 195 deletions.
  1. +1 −1 core/src/main/java/org/jruby/Ruby.java
  2. +7 −9 core/src/main/java/org/jruby/RubyModule.java
  3. +1 −1 core/src/main/java/org/jruby/ast/util/SexpMaker.java
  4. +1 −1 core/src/main/java/org/jruby/ext/jruby/JRubyLibrary.java
  5. +2 −2 core/src/main/java/org/jruby/internal/runtime/AbstractIRMethod.java
  6. +2 −2 core/src/main/java/org/jruby/internal/runtime/methods/InterpretedIRBodyMethod.java
  7. +3 −3 core/src/main/java/org/jruby/internal/runtime/methods/InterpretedIRMethod.java
  8. +2 −2 core/src/main/java/org/jruby/internal/runtime/methods/MixedModeIRMethod.java
  9. +1 −1 core/src/main/java/org/jruby/ir/Compiler.java
  10. +27 −24 core/src/main/java/org/jruby/ir/IRBuilder.java
  11. +2 −1 core/src/main/java/org/jruby/ir/IRClassBody.java
  12. +15 −15 core/src/main/java/org/jruby/ir/IRClosure.java
  13. +5 −4 core/src/main/java/org/jruby/ir/IRFor.java
  14. +5 −3 core/src/main/java/org/jruby/ir/IRManager.java
  15. +2 −2 core/src/main/java/org/jruby/ir/IRMetaClassBody.java
  16. +1 −2 core/src/main/java/org/jruby/ir/IRMethod.java
  17. +2 −2 core/src/main/java/org/jruby/ir/IRModuleBody.java
  18. +10 −10 core/src/main/java/org/jruby/ir/IRScope.java
  19. +6 −7 core/src/main/java/org/jruby/ir/IRScriptBody.java
  20. +5 −4 core/src/main/java/org/jruby/ir/instructions/BreakInstr.java
  21. +1 −1 core/src/main/java/org/jruby/ir/instructions/DefineClassInstr.java
  22. +1 −1 core/src/main/java/org/jruby/ir/instructions/DefineClassMethodInstr.java
  23. +1 −1 core/src/main/java/org/jruby/ir/instructions/DefineInstanceMethodInstr.java
  24. +1 −1 core/src/main/java/org/jruby/ir/instructions/DefineMetaClassInstr.java
  25. +1 −1 core/src/main/java/org/jruby/ir/instructions/DefineModuleInstr.java
  26. +11 −11 core/src/main/java/org/jruby/ir/instructions/InheritanceSearchConstInstr.java
  27. +1 −1 core/src/main/java/org/jruby/ir/instructions/InlinedLineNumberInstr.java
  28. +13 −13 core/src/main/java/org/jruby/ir/instructions/LexicalSearchConstInstr.java
  29. +1 −1 core/src/main/java/org/jruby/ir/instructions/LoadLocalVarInstr.java
  30. +4 −3 core/src/main/java/org/jruby/ir/instructions/NonlocalReturnInstr.java
  31. +5 −4 core/src/main/java/org/jruby/ir/instructions/PushBlockFrameInstr.java
  32. +6 −4 core/src/main/java/org/jruby/ir/instructions/PushMethodFrameInstr.java
  33. +1 −1 core/src/main/java/org/jruby/ir/instructions/StoreLocalVarInstr.java
  34. +5 −6 core/src/main/java/org/jruby/ir/instructions/TraceInstr.java
  35. +1 −1 core/src/main/java/org/jruby/ir/interpreter/Interpreter.java
  36. +2 −2 core/src/main/java/org/jruby/ir/interpreter/InterpreterContext.java
  37. +1 −1 core/src/main/java/org/jruby/ir/interpreter/Profiler.java
  38. +8 −9 core/src/main/java/org/jruby/ir/operands/SymbolProc.java
  39. +1 −1 core/src/main/java/org/jruby/ir/passes/BasicCompilerPassListener.java
  40. +3 −3 core/src/main/java/org/jruby/ir/persistence/IRDumper.java
  41. +3 −4 core/src/main/java/org/jruby/ir/persistence/IRReader.java
  42. +2 −2 core/src/main/java/org/jruby/ir/persistence/IRWriter.java
  43. +24 −15 core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
  44. +5 −4 core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
  45. +1 −1 core/src/main/java/org/jruby/runtime/InterpretedIRBlockBody.java
  46. +3 −3 core/src/main/java/org/jruby/runtime/MixedModeIRBlockBody.java
  47. +5 −4 core/src/main/java/org/jruby/util/JavaNameMangler.java
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
@@ -1216,7 +1216,7 @@ private void init() {
// FIXME: This registers itself into static scope as a side-effect. Let's make this
// relationship handled either more directly or through a descriptice method
// FIXME: We need a failing test case for this since removing it did not regress tests
IRScope top = new IRScriptBody(irManager, new ByteList("".getBytes()), context.getCurrentScope().getStaticScope());
IRScope top = new IRScriptBody(irManager, newSymbol(""), context.getCurrentScope().getStaticScope());
top.allocateInterpreterContext(new ArrayList<Instr>());

// Initialize the "dummy" class used as a marker
16 changes: 7 additions & 9 deletions core/src/main/java/org/jruby/RubyModule.java
Original file line number Diff line number Diff line change
@@ -2122,8 +2122,7 @@ private Visibility getCurrentVisibilityForDefineMethod(ThreadContext context) {

public IRubyObject defineMethodFromBlock(ThreadContext context, IRubyObject arg0, Block block, Visibility visibility) {
final Ruby runtime = context.runtime;
RubySymbol nameSym = TypeConverter.checkID(arg0);
String name = nameSym.toString();
RubySymbol name = TypeConverter.checkID(arg0);
DynamicMethod newMethod;

if (!block.isGiven()) {
@@ -2142,7 +2141,7 @@ public IRubyObject defineMethodFromBlock(ThreadContext context, IRubyObject arg0
if (method != null) {
newMethod = new DefineMethodMethod(method, visibility, this, context.getFrameBlock());
Helpers.addInstanceMethod(this, name, newMethod, visibility, context, runtime);
return nameSym;
return name;
}
}

@@ -2152,11 +2151,11 @@ public IRubyObject defineMethodFromBlock(ThreadContext context, IRubyObject arg0
// a normal block passed to define_method changes to do arity checking; make it a lambda
proc.getBlock().type = Block.Type.LAMBDA;

newMethod = createProcMethod(name, visibility, proc);
newMethod = createProcMethod(name.idString(), visibility, proc);

Helpers.addInstanceMethod(this, name, newMethod, visibility, context, runtime);

return nameSym;
return name;
}

@JRubyMethod(name = "define_method", visibility = PRIVATE, reads = VISIBILITY)
@@ -2168,15 +2167,14 @@ public IRubyObject define_method(ThreadContext context, IRubyObject arg0, IRubyO

public IRubyObject defineMethodFromCallable(ThreadContext context, IRubyObject arg0, IRubyObject arg1, Visibility visibility) {
final Ruby runtime = context.runtime;
RubySymbol nameSym = TypeConverter.checkID(arg0);
String name = nameSym.toString();
RubySymbol name = TypeConverter.checkID(arg0);
DynamicMethod newMethod;

if (runtime.getProc().isInstance(arg1)) {
// double-testing args.length here, but it avoids duplicating the proc-setup code in two places
RubyProc proc = (RubyProc)arg1;

newMethod = createProcMethod(name, visibility, proc);
newMethod = createProcMethod(name.idString(), visibility, proc);
} else if (arg1 instanceof AbstractRubyMethod) {
AbstractRubyMethod method = (AbstractRubyMethod)arg1;

@@ -2191,7 +2189,7 @@ public IRubyObject defineMethodFromCallable(ThreadContext context, IRubyObject a

Helpers.addInstanceMethod(this, name, newMethod, visibility, context, runtime);

return nameSym;
return name;
}

@Deprecated
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ast/util/SexpMaker.java
Original file line number Diff line number Diff line change
@@ -82,7 +82,7 @@ public static String sha1(IRScope scope) {

DigestBuilder db = new DigestBuilder(sha1);

db.append(scope.getName());
db.append(scope.getId());
db.append('\n');
// CON FIXME: We need a better way to uniquely identify this...right?
db.append(JITTED_METHOD_NUMBER.getAndIncrement());
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ext/jruby/JRubyLibrary.java
Original file line number Diff line number Diff line change
@@ -295,7 +295,7 @@ public static IRubyObject compile(ThreadContext context, IRubyObject recv, IRuby
// JRuby::CompiledScript#initialize(filename, class_name, content, bytes)
return CompiledScript.newInstance(context, new IRubyObject[] {
filename,
runtime.newString(scope.getName()),
scope.getName(),
content,
Java.getInstance(runtime, bytes)
}, Block.NULL_BLOCK);
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ public abstract class AbstractIRMethod extends DynamicMethod implements IRMethod
private MethodData methodData;

public AbstractIRMethod(IRScope method, Visibility visibility, RubyModule implementationClass) {
super(implementationClass, visibility, method.getName());
super(implementationClass, visibility, method.getId());
this.method = method;
this.staticScope = method.getStaticScope();
this.staticScope.determineModule();
@@ -119,7 +119,7 @@ public MethodData getMethodData() {
break;
}
}
methodData = new MethodData(method.getName(), method.getFileName(), ivarNames);
methodData = new MethodData(method.getId(), method.getFileName(), ivarNames);
}

return methodData;
Original file line number Diff line number Diff line change
@@ -46,8 +46,8 @@ protected IRubyObject callInternal(ThreadContext context, IRubyObject self, Ruby

try {
switch (method.getScopeType()) {
case MODULE_BODY: return INTERPRET_MODULE(ic, context, self, clazz, method.getName(), block);
case CLASS_BODY: return INTERPRET_CLASS(ic, context, self, clazz, method.getName(), block);
case MODULE_BODY: return INTERPRET_MODULE(ic, context, self, clazz, method.getId(), block);
case CLASS_BODY: return INTERPRET_CLASS(ic, context, self, clazz, method.getId(), block);
case METACLASS_BODY: return INTERPRET_METACLASS(ic, context, self, clazz, "singleton class", block);
default: throw new RuntimeException("invalid body method type: " + method);
}
Original file line number Diff line number Diff line change
@@ -76,7 +76,7 @@ public InterpreterContext ensureInstrsReady() {
if (IRRuntimeHelpers.shouldPrintIR(implementationClass.getRuntime())) {
ByteArrayOutputStream baos = IRDumper.printIR(method, false, true);

LOG.info("Printing simple IR for " + method.getName() + ":\n" + new String(baos.toByteArray()));
LOG.info("Printing simple IR for " + method.getId() + ":\n" + new String(baos.toByteArray()));
}
}

@@ -273,7 +273,7 @@ protected void doDebug() {
// FIXME: This is only printing out CFG once. If we keep applying more passes then we
// will want to print out after those new passes.
ensureInstrsReady();
LOG.info("Executing '" + method.getName() + "'");
LOG.info("Executing '" + method.getId() + "'");
if (!displayedCFG) {
LOG.info(method.debugOutput());
displayedCFG = true;
@@ -298,7 +298,7 @@ private void promoteToFullBuild(ThreadContext context) {
if (IRRuntimeHelpers.shouldPrintIR(implementationClass.getRuntime())) {
ByteArrayOutputStream baos = IRDumper.printIR(method, true, true);

LOG.info("Printing full IR for " + method.getName() + ":\n" + new String(baos.toByteArray()));
LOG.info("Printing full IR for " + method.getId() + ":\n" + new String(baos.toByteArray()));
}
}

Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ public InterpreterContext ensureInstrsReady() {
if (IRRuntimeHelpers.shouldPrintIR(implementationClass.getRuntime())) {
ByteArrayOutputStream baos = IRDumper.printIR(method, false);

LOG.info("Printing simple IR for " + method.getName() + ":\n" + new String(baos.toByteArray()));
LOG.info("Printing simple IR for " + method.getId() + ":\n" + new String(baos.toByteArray()));
}

return ic;
@@ -249,7 +249,7 @@ private void doDebug() {
// FIXME: This is only printing out CFG once. If we keep applying more passes then we
// will want to print out after those new passes.
ensureInstrsReady();
LOG.info("Executing '" + method.getName() + "'");
LOG.info("Executing '" + method.getId() + "'");
if (!displayedCFG) {
LOG.info(method.debugOutput());
displayedCFG = true;
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/ir/Compiler.java
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ protected ScriptAndCode execute(final Ruby runtime, final IRScriptBody scope, Cl
} catch (NotCompilableException nce) {
throw nce;
} catch (Throwable t) {
throw new NotCompilableException("failed to compile script " + scope.getName(), t);
throw new NotCompilableException("failed to compile script " + scope.getId(), t);
}

final MethodHandle compiledHandle = _compiledHandle;
Loading