Skip to content

Commit

Permalink
Merge branch 'master' into truffle-head
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Dec 30, 2014
2 parents 7567b0b + 44d7c49 commit a5b1f0a
Show file tree
Hide file tree
Showing 23 changed files with 61 additions and 390 deletions.
9 changes: 8 additions & 1 deletion core/src/main/java/org/jruby/Ruby.java
Expand Up @@ -1694,7 +1694,6 @@ private void initBuiltins() {
addLazyBuiltin("stringio.jar", "stringio", "org.jruby.ext.stringio.StringIOLibrary");
addLazyBuiltin("strscan.jar", "strscan", "org.jruby.ext.strscan.StringScannerLibrary");
addLazyBuiltin("zlib.jar", "zlib", "org.jruby.ext.zlib.ZlibLibrary");
addLazyBuiltin("enumerator.jar", "enumerator", "org.jruby.ext.enumerator.EnumeratorLibrary");
addLazyBuiltin("thread.jar", "thread", "org.jruby.ext.thread.ThreadLibrary");
addLazyBuiltin("thread.rb", "thread", "org.jruby.ext.thread.ThreadLibrary");
addLazyBuiltin("digest.jar", "digest.so", "org.jruby.ext.digest.DigestLibrary");
Expand Down Expand Up @@ -1731,6 +1730,14 @@ public void load(Ruby runtime, boolean wrap) throws IOException {
addBuiltinIfAllowed("continuation.rb", dummy);
addBuiltinIfAllowed("io/nonblock.rb", dummy);

// rb_provide logic, in a roundabout way
addLazyBuiltin("enumerator.jar", "enumerator", "org.jruby.ext.enumerator.EnumeratorLibrary");
loadService.require("enumerator.jar");
addBuiltinIfAllowed("rational.jar", dummy);
loadService.require("rational.jar");
addBuiltinIfAllowed("complex.jar", dummy);
loadService.require("complex.jar");

if(RubyInstanceConfig.NATIVE_NET_PROTOCOL) {
addLazyBuiltin("net/protocol.rb", "net/protocol", "org.jruby.ext.net.protocol.NetProtocolBufferedIOLibrary");
}
Expand Down
40 changes: 0 additions & 40 deletions core/src/main/java/org/jruby/ast/ArgsNoArgNode.java

This file was deleted.

40 changes: 0 additions & 40 deletions core/src/main/java/org/jruby/ast/ArgsPreOneArgNode.java

This file was deleted.

40 changes: 0 additions & 40 deletions core/src/main/java/org/jruby/ast/ArgsPreTwoArgNode.java

This file was deleted.

8 changes: 0 additions & 8 deletions core/src/main/java/org/jruby/ast/ArrayNode.java
Expand Up @@ -66,12 +66,4 @@ public NodeType getNodeType() {
public <T> T accept(NodeVisitor<T> iVisitor) {
return iVisitor.visitArrayNode(this);
}

public void setLightweight(boolean lightweight) {
this.lightweight = lightweight;
}

public boolean isLightweight() {
return lightweight;
}
}
65 changes: 3 additions & 62 deletions core/src/main/java/org/jruby/ast/AttrAssignNode.java
Expand Up @@ -53,7 +53,7 @@ public AttrAssignNode(ISourcePosition position, Node receiverNode, String name,

this.receiverNode = receiverNode;
this.name = name;
setArgsInternal(argsNode);
this.argsNode = argsNode;
}

public NodeType getNodeType() {
Expand Down Expand Up @@ -95,74 +95,15 @@ public Node getArgsNode() {
return argsNode;
}


protected Node newAttrAssignNode(ArrayNode argsNode) {
int size = argsNode.size();

switch (size) {
case 1:
return new AttrAssignOneArgNode(getPosition(), receiverNode, name, argsNode);
case 2:
return new AttrAssignTwoArgNode(getPosition(), receiverNode, name, argsNode);
case 3:
return new AttrAssignThreeArgNode(getPosition(), receiverNode, name, argsNode);
default:
return new AttrAssignNode(getPosition(), receiverNode, name, argsNode);
}
}

protected Node newMutatedAttrAssignNode(ArrayNode argsNode) {
int size = argsNode.size();

switch (size) {
case 1:
if (!(this instanceof AttrAssignOneArgNode)) {
return new AttrAssignOneArgNode(getPosition(), receiverNode, name, argsNode);
} else {
return this;
}
case 2:
if (!(this instanceof AttrAssignTwoArgNode)) {
return new AttrAssignTwoArgNode(getPosition(), receiverNode, name, argsNode);
} else {
return this;
}
case 3:
if (!(this instanceof AttrAssignThreeArgNode)) {
return new AttrAssignThreeArgNode(getPosition(), receiverNode, name, argsNode);
} else {
return this;
}
default:
return new AttrAssignNode(getPosition(), receiverNode, name, argsNode);
}
}

/**
* Set the argsNode
*
* @param argsNode set the arguments for this node.
*/
public Node setArgsNode(Node argsNode) {
// Empirical Observations:
// null -> Some arity
// argsNode == this.argsNode then check for arity changes
// newline(splatnode) -> argspushnode
if (this.argsNode == null && argsNode instanceof ArrayNode) {
return newAttrAssignNode((ArrayNode) argsNode);
} else if (this.argsNode == argsNode) {
return newMutatedAttrAssignNode((ArrayNode)argsNode);
}

setArgsInternal(argsNode);

return this;
}

private void setArgsInternal(Node argsNode) {
this.argsNode = argsNode;
if (argsNode instanceof ArrayNode) ((ArrayNode)argsNode).setLightweight(true);

return this;
}

public List<Node> childNodes() {
Expand Down
29 changes: 0 additions & 29 deletions core/src/main/java/org/jruby/ast/AttrAssignOneArgNode.java

This file was deleted.

33 changes: 0 additions & 33 deletions core/src/main/java/org/jruby/ast/AttrAssignThreeArgNode.java

This file was deleted.

31 changes: 0 additions & 31 deletions core/src/main/java/org/jruby/ast/AttrAssignTwoArgNode.java

This file was deleted.

8 changes: 2 additions & 6 deletions core/src/main/java/org/jruby/ast/CallNode.java
Expand Up @@ -55,7 +55,7 @@ public CallNode(ISourcePosition position, Node receiverNode, String name, Node a

this.name = name;
this.receiverNode = receiverNode;
setArgsNode(argsNode);
this.argsNode = argsNode;
this.iterNode = iterNode;
}

Expand Down Expand Up @@ -96,11 +96,7 @@ public Node getArgsNode() {
*/
public Node setArgsNode(Node argsNode) {
this.argsNode = argsNode;
// If we have more than one arg, make sure the array created to contain them is not ObjectSpaced
if (argsNode instanceof ArrayNode) {
((ArrayNode)argsNode).setLightweight(true);
}


return argsNode;
}

Expand Down
11 changes: 3 additions & 8 deletions core/src/main/java/org/jruby/ast/FCallNode.java
Expand Up @@ -51,7 +51,7 @@ public FCallNode(ISourcePosition position, String name) {
public FCallNode(ISourcePosition position, String name, Node argsNode, Node iterNode) {
super(position);
this.name = name;
setArgsNode(argsNode);
this.argsNode = argsNode;
this.iterNode = iterNode;
}

Expand Down Expand Up @@ -89,16 +89,11 @@ public Node getArgsNode() {
}

/**
* Set the argsNode. This is for re-writer and general interpretation.
*
* @param argsNode set the arguments for this node.
* Set the argsNode. Changes to parser means fcall is made before actual
* args are associated with fcall so we need a setter.
*/
public Node setArgsNode(Node argsNode) {
this.argsNode = argsNode;
// If we have more than one arg, make sure the array created to contain them is not ObjectSpaced
if (argsNode instanceof ArrayNode) {
((ArrayNode)argsNode).setLightweight(true);
}

return argsNode;
}
Expand Down

0 comments on commit a5b1f0a

Please sign in to comment.