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

Commits on Nov 10, 2014

  1. [Truffle] Kernel#pretty_inspect should call #inspect rather than #to_s.

    * Especially useful for nil.
    eregon committed Nov 10, 2014
    Copy the full SHA
    6140817 View commit details
  2. Copy the full SHA
    9c70781 View commit details
  3. [Truffle] Fix module/class constructors so they automatically set the…

    … constant in the lexical parent.
    
    * Rename lexicalParentModule to lexicalParent for argument names.
    eregon committed Nov 10, 2014
    Copy the full SHA
    15b169b View commit details
Showing with 170 additions and 217 deletions.
  1. +2 −1 core/src/main/java/org/jruby/truffle/nodes/core/CoreMethodNodeManager.java
  2. +4 −4 core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  3. +3 −3 core/src/main/java/org/jruby/truffle/nodes/core/ModuleNodes.java
  4. +5 −7 core/src/main/java/org/jruby/truffle/nodes/objects/DefineOrGetClassNode.java
  5. +3 −4 core/src/main/java/org/jruby/truffle/nodes/objects/DefineOrGetModuleNode.java
  6. +78 −140 core/src/main/java/org/jruby/truffle/runtime/core/CoreLibrary.java
  7. +3 −2 core/src/main/java/org/jruby/truffle/runtime/core/RubyArray.java
  8. +10 −10 core/src/main/java/org/jruby/truffle/runtime/core/RubyClass.java
  9. +2 −2 core/src/main/java/org/jruby/truffle/runtime/core/RubyEncoding.java
  10. +3 −2 core/src/main/java/org/jruby/truffle/runtime/core/RubyEncodingConverter.java
  11. +3 −2 core/src/main/java/org/jruby/truffle/runtime/core/RubyException.java
  12. +3 −2 core/src/main/java/org/jruby/truffle/runtime/core/RubyFiber.java
  13. +3 −2 core/src/main/java/org/jruby/truffle/runtime/core/RubyHash.java
  14. +22 −14 core/src/main/java/org/jruby/truffle/runtime/core/RubyModule.java
  15. +3 −2 core/src/main/java/org/jruby/truffle/runtime/core/RubyProc.java
  16. +2 −2 core/src/main/java/org/jruby/truffle/runtime/core/RubyRegexp.java
  17. +3 −2 core/src/main/java/org/jruby/truffle/runtime/core/RubyString.java
  18. +2 −2 core/src/main/java/org/jruby/truffle/runtime/core/RubyThread.java
  19. +3 −2 core/src/main/java/org/jruby/truffle/runtime/core/RubyTime.java
  20. +12 −11 core/src/main/java/org/jruby/truffle/runtime/rubinius/RubiniusLibrary.java
  21. +1 −1 core/src/main/java/org/jruby/truffle/runtime/subsystems/FeatureManager.java
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@
import org.jruby.truffle.nodes.methods.ExceptionTranslatingNode;
import org.jruby.truffle.nodes.methods.arguments.*;
import org.jruby.truffle.nodes.objects.SelfNode;
import org.jruby.truffle.runtime.LexicalScope;
import org.jruby.truffle.runtime.ModuleOperations;
import org.jruby.truffle.runtime.util.ArrayUtils;
import org.jruby.truffle.runtime.RubyContext;
@@ -64,7 +65,7 @@ private static void addMethod(RubyClass rubyObjectClass, MethodDetails methodDet
module = rubyObjectClass;

for (String moduleName : methodDetails.getClassAnnotation().name().split("::")) {
module = (RubyModule) ModuleOperations.lookupConstant(context, null, module, moduleName).getValue();
module = (RubyModule) ModuleOperations.lookupConstant(context, LexicalScope.NONE, module, moduleName).getValue();
}
}

Original file line number Diff line number Diff line change
@@ -1249,21 +1249,21 @@ public RubyNilClass printf(Object[] args) {
@CoreMethod(names = "pretty_inspect")
public abstract static class PrettyInspectNode extends CoreMethodNode {

@Child protected DispatchHeadNode toS;
@Child protected DispatchHeadNode inspectNode;

public PrettyInspectNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
toS = DispatchHeadNode.onSelf(context);
inspectNode = DispatchHeadNode.onSelf(context);
}

public PrettyInspectNode(PrettyInspectNode prev) {
super(prev);
toS = prev.toS;
inspectNode = prev.inspectNode;
}

@Specialization
public Object prettyInspect(VirtualFrame frame, Object self) {
return toS.call(frame, self, "to_s", null);
return inspectNode.call(frame, self, "inspect", null);
}
}

Original file line number Diff line number Diff line change
@@ -492,15 +492,15 @@ public ConstDefinedNode(ConstDefinedNode prev) {
public boolean isConstDefined(RubyModule module, RubyString name, @SuppressWarnings("unused") UndefinedPlaceholder inherit) {
notDesignedForCompilation();

return ModuleOperations.lookupConstant(getContext(), null, module, name.toString()) != null;
return ModuleOperations.lookupConstant(getContext(), LexicalScope.NONE, module, name.toString()) != null;
}

@Specialization
public boolean isConstDefined(RubyModule module, RubyString name, boolean inherit) {
notDesignedForCompilation();

if (inherit) {
return ModuleOperations.lookupConstant(getContext(), null, module, name.toString()) != null;
return ModuleOperations.lookupConstant(getContext(), LexicalScope.NONE, module, name.toString()) != null;
} else {
return module.getConstants().containsKey(name.toString());
}
@@ -510,7 +510,7 @@ public boolean isConstDefined(RubyModule module, RubyString name, boolean inheri
public boolean isConstDefined(RubyModule module, RubySymbol name, @SuppressWarnings("unused") UndefinedPlaceholder inherit) {
notDesignedForCompilation();

return ModuleOperations.lookupConstant(getContext(), null, module, name.toString()) != null;
return ModuleOperations.lookupConstant(getContext(), LexicalScope.NONE, module, name.toString()) != null;
}

}
Original file line number Diff line number Diff line change
@@ -23,8 +23,8 @@ public class DefineOrGetClassNode extends DefineOrGetModuleNode {

@Child protected RubyNode superClass;

public DefineOrGetClassNode(RubyContext context, SourceSection sourceSection, String name, RubyNode lexicalParentModule, RubyNode superClass) {
super(context, sourceSection, name, lexicalParentModule);
public DefineOrGetClassNode(RubyContext context, SourceSection sourceSection, String name, RubyNode lexicalParent, RubyNode superClass) {
super(context, sourceSection, name, lexicalParent);
this.superClass = superClass;
}

@@ -44,14 +44,12 @@ public Object execute(VirtualFrame frame) {

if (constant == null) {
if (superClassObject instanceof RubyException.RubyExceptionClass) {
definingClass = new RubyException.RubyExceptionClass(superClassObject, name);
definingClass = new RubyException.RubyExceptionClass(context, lexicalParent, superClassObject, name);
} else if (superClassObject instanceof RubyString.RubyStringClass) {
definingClass = new RubyString.RubyStringClass(superClassObject);
definingClass = new RubyString.RubyStringClass(context, lexicalParent, superClassObject, name);
} else {
definingClass = new RubyClass(lexicalParent, superClassObject, name);
definingClass = new RubyClass(context, lexicalParent, superClassObject, name);
}

lexicalParent.setConstant(this, name, definingClass);
} else {
if (constant.getValue() instanceof RubyClass) {
definingClass = (RubyClass) constant.getValue();
Original file line number Diff line number Diff line change
@@ -25,10 +25,10 @@ public class DefineOrGetModuleNode extends RubyNode {
protected final String name;
@Child protected RubyNode lexicalParentModule;

public DefineOrGetModuleNode(RubyContext context, SourceSection sourceSection, String name, RubyNode lexicalParentModule) {
public DefineOrGetModuleNode(RubyContext context, SourceSection sourceSection, String name, RubyNode lexicalParent) {
super(context, sourceSection);
this.name = name;
this.lexicalParentModule = lexicalParentModule;
this.lexicalParentModule = lexicalParent;
}

@Override
@@ -43,8 +43,7 @@ public Object execute(VirtualFrame frame) {
RubyModule definingModule;

if (constant == null) {
definingModule = new RubyModule(getContext().getCoreLibrary().getModuleClass(), lexicalParent, name);
lexicalParent.setConstant(this, name, definingModule);
definingModule = new RubyModule(getContext(), lexicalParent, name, this);
} else {
Object module = constant.getValue();
if (!(module instanceof RubyModule) || !((RubyModule) module).isOnlyAModule()) {
Loading