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

Commits on Aug 11, 2017

  1. Copy the full SHA
    3296a53 View commit details
  2. Copy the full SHA
    5cea38b View commit details
6 changes: 3 additions & 3 deletions core/src/main/java/org/jruby/ir/instructions/AliasInstr.java
Original file line number Diff line number Diff line change
@@ -45,9 +45,9 @@ public Instr clone(CloneInfo ii) {

@Override
public Object interpret(ThreadContext context, StaticScope currScope, DynamicScope currDynScope, IRubyObject self, Object[] temp) {
String newNameString = getNewName().retrieve(context, self, currScope, currDynScope, temp).toString();
String oldNameString = getOldName().retrieve(context, self, currScope, currDynScope, temp).toString();
IRRuntimeHelpers.defineAlias(context, self, currDynScope, newNameString, oldNameString);
IRubyObject newName = (IRubyObject) getNewName().retrieve(context, self, currScope, currDynScope, temp);
IRubyObject oldName = (IRubyObject) getOldName().retrieve(context, self, currScope, currDynScope, temp);
IRRuntimeHelpers.defineAlias(context, self, currDynScope, newName, oldName);
return null;
}

5 changes: 2 additions & 3 deletions core/src/main/java/org/jruby/ir/runtime/IRRuntimeHelpers.java
Original file line number Diff line number Diff line change
@@ -716,14 +716,13 @@ public static IRubyObject nthMatch(ThreadContext context, int matchNumber) {
return RubyRegexp.nth_match(matchNumber, context.getBackRef());
}

public static void defineAlias(ThreadContext context, IRubyObject self, DynamicScope currDynScope, String newNameString, String oldNameString) {
public static void defineAlias(ThreadContext context, IRubyObject self, DynamicScope currDynScope, IRubyObject newNameString, IRubyObject oldNameString) {
if (self == null || self instanceof RubyFixnum || self instanceof RubySymbol) {
throw context.runtime.newTypeError("no class to make alias");
}

RubyModule module = findInstanceMethodContainer(context, currDynScope, self);
module.defineAlias(newNameString, oldNameString);
module.callMethod(context, "method_added", context.runtime.newSymbol(newNameString));
module.alias_method(context, newNameString, oldNameString);
}

public static RubyModule getModuleFromScope(ThreadContext context, StaticScope scope, IRubyObject arg) {
5 changes: 1 addition & 4 deletions core/src/main/java/org/jruby/ir/targets/JVMVisitor.java
Original file line number Diff line number Diff line change
@@ -545,12 +545,9 @@ public void AliasInstr(AliasInstr aliasInstr) {
m.loadContext();
m.loadSelf();
jvmLoadLocal(DYNAMIC_SCOPE);
// CON FIXME: Ideally this would not have to pass through RubyString and toString
visit(aliasInstr.getNewName());
jvmAdapter().invokevirtual(p(Object.class), "toString", sig(String.class));
visit(aliasInstr.getOldName());
jvmAdapter().invokevirtual(p(Object.class), "toString", sig(String.class));
m.invokeIRHelper("defineAlias", sig(void.class, ThreadContext.class, IRubyObject.class, DynamicScope.class, String.class, String.class));
m.invokeIRHelper("defineAlias", sig(void.class, ThreadContext.class, IRubyObject.class, DynamicScope.class, IRubyObject.class, IRubyObject.class));
}

@Override