Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

First stab at serializable AST via Externalizable. Still not faster t…

…han parsing.
  • Loading branch information...
commit ee7db8e38fe04921f2ee74947f97ef6ceee71b11 1 parent 60f553c
@headius headius authored
Showing with 3,029 additions and 180 deletions.
  1. +4 −1 lib/ruby/site_ruby/1.8/rubygems/source_index.rb
  2. +2 −0  lib/ruby/site_ruby/1.8/rubygems/specification.rb
  3. +69 −4 src/org/jruby/Ruby.java
  4. +12 −0 src/org/jruby/RubyInstanceConfig.java
  5. +20 −0 src/org/jruby/ast/AliasNode.java
  6. +22 −2 src/org/jruby/ast/AndNode.java
  7. +20 −0 src/org/jruby/ast/ArgAuxillaryNode.java
  8. +22 −2 src/org/jruby/ast/ArgsCatNode.java
  9. +5 −0 src/org/jruby/ast/ArgsNoArgNode.java
  10. +60 −13 src/org/jruby/ast/ArgsNode.java
  11. +5 −0 src/org/jruby/ast/ArgsPreOneArgNode.java
  12. +5 −0 src/org/jruby/ast/ArgsPreTwoArgNode.java
  13. +20 −0 src/org/jruby/ast/ArgsPushNode.java
  14. +18 −0 src/org/jruby/ast/ArgumentNode.java
  15. +18 −0 src/org/jruby/ast/ArrayNode.java
  16. +18 −0 src/org/jruby/ast/AssignableNode.java
  17. +27 −1 src/org/jruby/ast/AttrAssignNode.java
  18. +18 −0 src/org/jruby/ast/AttrAssignOneArgNode.java
  19. +23 −1 src/org/jruby/ast/AttrAssignThreeArgNode.java
  20. +20 −0 src/org/jruby/ast/AttrAssignTwoArgNode.java
  21. +19 −1 src/org/jruby/ast/BackRefNode.java
  22. +19 −1 src/org/jruby/ast/BeginNode.java
  23. +18 −0 src/org/jruby/ast/BignumNode.java
  24. +19 −0 src/org/jruby/ast/BlockArg18Node.java
  25. +21 −1 src/org/jruby/ast/BlockArgNode.java
  26. +5 −0 src/org/jruby/ast/BlockNode.java
  27. +21 −1 src/org/jruby/ast/BlockPassNode.java
  28. +19 −1 src/org/jruby/ast/BreakNode.java
  29. +5 −0 src/org/jruby/ast/CallManyArgsBlockNode.java
  30. +5 −0 src/org/jruby/ast/CallManyArgsBlockPassNode.java
  31. +6 −1 src/org/jruby/ast/CallManyArgsNode.java
  32. +5 −0 src/org/jruby/ast/CallNoArgBlockNode.java
  33. +5 −0 src/org/jruby/ast/CallNoArgBlockPassNode.java
  34. +5 −0 src/org/jruby/ast/CallNoArgNode.java
  35. +25 −1 src/org/jruby/ast/CallNode.java
  36. +18 −0 src/org/jruby/ast/CallOneArgBlockNode.java
  37. +18 −0 src/org/jruby/ast/CallOneArgBlockPassNode.java
  38. +18 −0 src/org/jruby/ast/CallOneArgFixnumNode.java
  39. +19 −1 src/org/jruby/ast/CallOneArgNode.java
  40. +5 −0 src/org/jruby/ast/CallSpecialArgBlockNode.java
  41. +5 −0 src/org/jruby/ast/CallSpecialArgBlockPassNode.java
  42. +5 −0 src/org/jruby/ast/CallSpecialArgNode.java
  43. +23 −1 src/org/jruby/ast/CallThreeArgBlockNode.java
  44. +23 −1 src/org/jruby/ast/CallThreeArgBlockPassNode.java
  45. +22 −0 src/org/jruby/ast/CallThreeArgNode.java
  46. +21 −1 src/org/jruby/ast/CallTwoArgBlockNode.java
  47. +21 −1 src/org/jruby/ast/CallTwoArgBlockPassNode.java
  48. +20 −0 src/org/jruby/ast/CallTwoArgNode.java
  49. +24 −2 src/org/jruby/ast/CaseNode.java
  50. +28 −4 src/org/jruby/ast/ClassNode.java
  51. +18 −0 src/org/jruby/ast/ClassVarAsgnNode.java
  52. +18 −0 src/org/jruby/ast/ClassVarDeclNode.java
  53. +18 −0 src/org/jruby/ast/ClassVarNode.java
  54. +6 −4 src/org/jruby/ast/Colon2ConstNode.java
  55. +5 −0 src/org/jruby/ast/Colon2ImplicitNode.java
  56. +5 −1 src/org/jruby/ast/Colon2MethodNode.java
  57. +19 −1 src/org/jruby/ast/Colon2Node.java
  58. +20 −2 src/org/jruby/ast/Colon3Node.java
  59. +22 −2 src/org/jruby/ast/ConstDeclNode.java
  60. +19 −1 src/org/jruby/ast/ConstNode.java
  61. +20 −0 src/org/jruby/ast/DAsgnNode.java
  62. +23 −3 src/org/jruby/ast/DRegexpNode.java
  63. +5 −0 src/org/jruby/ast/DStrNode.java
  64. +5 −0 src/org/jruby/ast/DSymbolNode.java
  65. +20 −0 src/org/jruby/ast/DVarNode.java
  66. +5 −0 src/org/jruby/ast/DXStrNode.java
  67. +19 −1 src/org/jruby/ast/DefinedNode.java
  68. +5 −0 src/org/jruby/ast/DefnNode.java
  69. +20 −1 src/org/jruby/ast/DefsNode.java
  70. +28 −4 src/org/jruby/ast/DotNode.java
  71. +5 −0 src/org/jruby/ast/EncodingNode.java
  72. +22 −2 src/org/jruby/ast/EnsureNode.java
  73. +19 −1 src/org/jruby/ast/EvStrNode.java
  74. +5 −0 src/org/jruby/ast/FCallManyArgsBlockNode.java
  75. +5 −0 src/org/jruby/ast/FCallManyArgsBlockPassNode.java
  76. +5 −1 src/org/jruby/ast/FCallManyArgsNode.java
  77. +5 −0 src/org/jruby/ast/FCallNoArgBlockNode.java
  78. +5 −0 src/org/jruby/ast/FCallNoArgBlockPassNode.java
  79. +5 −0 src/org/jruby/ast/FCallNoArgNode.java
  80. +22 −0 src/org/jruby/ast/FCallNode.java
  81. +18 −0 src/org/jruby/ast/FCallOneArgBlockNode.java
  82. +18 −0 src/org/jruby/ast/FCallOneArgBlockPassNode.java
  83. +18 −0 src/org/jruby/ast/FCallOneArgNode.java
  84. +5 −0 src/org/jruby/ast/FCallSpecialArgBlockNode.java
  85. +5 −0 src/org/jruby/ast/FCallSpecialArgBlockPassNode.java
  86. +5 −0 src/org/jruby/ast/FCallSpecialArgNode.java
  87. +22 −0 src/org/jruby/ast/FCallThreeArgBlockNode.java
  88. +22 −0 src/org/jruby/ast/FCallThreeArgBlockPassNode.java
  89. +22 −0 src/org/jruby/ast/FCallThreeArgNode.java
  90. +20 −0 src/org/jruby/ast/FCallTwoArgBlockNode.java
  91. +20 −0 src/org/jruby/ast/FCallTwoArgBlockPassNode.java
  92. +20 −0 src/org/jruby/ast/FCallTwoArgNode.java
  93. +5 −0 src/org/jruby/ast/FalseNode.java
  94. +5 −0 src/org/jruby/ast/FileNode.java
  95. +17 −1 src/org/jruby/ast/FixnumNode.java
  96. +28 −4 src/org/jruby/ast/FlipNode.java
  97. +18 −0 src/org/jruby/ast/FloatNode.java
  98. +18 −0 src/org/jruby/ast/ForNode.java
  99. +18 −0 src/org/jruby/ast/GlobalAsgnNode.java
  100. +18 −0 src/org/jruby/ast/GlobalVarNode.java
  101. +4 −0 src/org/jruby/ast/Hash19Node.java
  102. +19 −1 src/org/jruby/ast/HashNode.java
  103. +25 −3 src/org/jruby/ast/IfNode.java
  104. +19 −1 src/org/jruby/ast/InstAsgnNode.java
  105. +19 −1 src/org/jruby/ast/InstVarNode.java
  106. +30 −4 src/org/jruby/ast/IterNode.java
  107. +5 −0 src/org/jruby/ast/LambdaNode.java
  108. +26 −0 src/org/jruby/ast/ListNode.java
  109. +17 −0 src/org/jruby/ast/LiteralNode.java
  110. +21 −1 src/org/jruby/ast/LocalAsgnNode.java
  111. +21 −1 src/org/jruby/ast/LocalVarNode.java
  112. +22 −2 src/org/jruby/ast/Match2Node.java
  113. +23 −3 src/org/jruby/ast/Match3Node.java
  114. +19 −1 src/org/jruby/ast/MatchNode.java
  115. +28 −4 src/org/jruby/ast/MethodDefNode.java
  116. +25 −3 src/org/jruby/ast/ModuleNode.java
  117. +28 −4 src/org/jruby/ast/MultipleAsgn19Node.java
  118. +22 −2 src/org/jruby/ast/MultipleAsgnNode.java
  119. +19 −1 src/org/jruby/ast/NewlineNode.java
  120. +19 −1 src/org/jruby/ast/NextNode.java
  121. +1 −0  src/org/jruby/ast/NilImplicitNode.java
  122. +5 −0 src/org/jruby/ast/NilNode.java
  123. +17 −1 src/org/jruby/ast/Node.java
  124. +19 −1 src/org/jruby/ast/NotNode.java
  125. +19 −1 src/org/jruby/ast/NthRefNode.java
  126. +22 −2 src/org/jruby/ast/OpAsgnAndNode.java
  127. +31 −5 src/org/jruby/ast/OpAsgnNode.java
  128. +22 −2 src/org/jruby/ast/OpAsgnOrNode.java
  129. +34 −6 src/org/jruby/ast/OpElementAsgnNode.java
  130. +18 −0 src/org/jruby/ast/OpElementOneArgAndAsgnNode.java
  131. +18 −0 src/org/jruby/ast/OpElementOneArgAsgnNode.java
  132. +18 −0 src/org/jruby/ast/OpElementOneArgOrAsgnNode.java
  133. +17 −0 src/org/jruby/ast/OptArgNode.java
  134. +22 −2 src/org/jruby/ast/OrNode.java
  135. +5 −0 src/org/jruby/ast/PostExeNode.java
  136. +5 −0 src/org/jruby/ast/PreExeNode.java
  137. +5 −0 src/org/jruby/ast/RedoNode.java
  138. +23 −3 src/org/jruby/ast/RegexpNode.java
  139. +25 −3 src/org/jruby/ast/RescueBodyNode.java
  140. +25 −3 src/org/jruby/ast/RescueNode.java
  141. +18 −0 src/org/jruby/ast/RestArgNode.java
  142. +5 −0 src/org/jruby/ast/RetryNode.java
  143. +22 −4 src/org/jruby/ast/ReturnNode.java
  144. +20 −0 src/org/jruby/ast/RootNode.java
  145. +25 −3 src/org/jruby/ast/SClassNode.java
  146. +5 −1 src/org/jruby/ast/SValue19Node.java
  147. +19 −1 src/org/jruby/ast/SValueNode.java
  148. +5 −0 src/org/jruby/ast/SelfNode.java
  149. +4 −0 src/org/jruby/ast/Splat19Node.java
  150. +19 −1 src/org/jruby/ast/SplatNode.java
  151. +5 −0 src/org/jruby/ast/StarNode.java
  152. +19 −1 src/org/jruby/ast/StrNode.java
  153. +22 −3 src/org/jruby/ast/SuperNode.java
  154. +19 −1 src/org/jruby/ast/SymbolNode.java
  155. +19 −1 src/org/jruby/ast/ToAryNode.java
  156. +5 −0 src/org/jruby/ast/TrueNode.java
  157. +18 −0 src/org/jruby/ast/TypedArgumentNode.java
  158. +18 −0 src/org/jruby/ast/UndefNode.java
  159. +5 −0 src/org/jruby/ast/UnnamedRestArgNode.java
  160. +27 −3 src/org/jruby/ast/UntilNode.java
  161. +20 −0 src/org/jruby/ast/VAliasNode.java
  162. +19 −1 src/org/jruby/ast/VCallNode.java
  163. +26 −4 src/org/jruby/ast/WhenNode.java
  164. +5 −0 src/org/jruby/ast/WhenOneArgNode.java
  165. +27 −3 src/org/jruby/ast/WhileNode.java
  166. +19 −1 src/org/jruby/ast/XStrNode.java
  167. +22 −2 src/org/jruby/ast/YieldNode.java
  168. +19 −1 src/org/jruby/ast/YieldOneNode.java
  169. +25 −3 src/org/jruby/ast/YieldThreeNode.java
  170. +22 −2 src/org/jruby/ast/YieldTwoNode.java
  171. +5 −0 src/org/jruby/ast/ZArrayNode.java
  172. +19 −2 src/org/jruby/ast/ZSuperNode.java
  173. +5 −0 src/org/jruby/ast/ZYieldNode.java
  174. +5 −0 src/org/jruby/ast/ZeroArgNode.java
  175. +20 −3 src/org/jruby/lexer/yacc/ISourcePosition.java
  176. +21 −2 src/org/jruby/lexer/yacc/SimpleSourcePosition.java
  177. +4 −0 src/org/jruby/parser/BlockStaticScope.java
  178. +5 −0 src/org/jruby/parser/EvalStaticScope.java
  179. +4 −0 src/org/jruby/parser/LocalStaticScope.java
  180. +47 −3 src/org/jruby/parser/StaticScope.java
  181. +34 −1 src/org/jruby/runtime/load/ExternalScript.java
View
5 lib/ruby/site_ruby/1.8/rubygems/source_index.rb
@@ -92,7 +92,10 @@ def load_specification(file_name)
end.untaint
begin
- gemspec = eval spec_code, binding, file_name
+ p "loading: #{file_name}"
+ Kernel.load file_name
+ gemspec = $last_gemspec
+ # gemspec = eval spec_code, binding, file_name
if gemspec.is_a?(Gem::Specification)
gemspec.loaded_from = file_name
View
2  lib/ruby/site_ruby/1.8/rubygems/specification.rb
@@ -425,6 +425,8 @@ def initialize name = nil, version = nil
yield self if block_given?
@@gather.call(self) if @@gather
+
+ $last_gemspec = self
end
##
View
73 src/org/jruby/Ruby.java
@@ -57,7 +57,6 @@
import java.util.Stack;
import java.util.Vector;
import java.util.WeakHashMap;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
@@ -126,9 +125,12 @@
import com.kenai.constantine.platform.Errno;
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.util.Arrays;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.ObjectOutputStream;
import java.util.EnumSet;
import java.util.concurrent.atomic.AtomicLong;
+import java.util.zip.GZIPOutputStream;
import org.jruby.ast.RootNode;
import org.jruby.exceptions.Unrescuable;
import org.jruby.internal.runtime.methods.DynamicMethod;
@@ -2529,11 +2531,33 @@ private void printErrorPos(ThreadContext context, PrintStream errorStream) {
}
}
}
-
+
public void loadFile(String scriptName, InputStream in, boolean wrap) {
IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this) : getTopSelf();
ThreadContext context = getCurrentContext();
String file = context.getFile();
+
+ try {
+ secure(4); /* should alter global state */
+
+ context.setFile(scriptName);
+ context.preNodeEval(objectClass, self, scriptName);
+
+ Node node = parseFile(in, scriptName, null);
+
+ node.interpret(this, context, self, Block.NULL_BLOCK);
+ } catch (JumpException.ReturnJump rj) {
+ return;
+ } finally {
+ context.postNodeEval();
+ context.setFile(file);
+ }
+ }
+
+ public void loadFile(String scriptName, String filename, InputStream in, boolean wrap) {
+ IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this) : getTopSelf();
+ ThreadContext context = getCurrentContext();
+ String file = context.getFile();
try {
secure(4); /* should alter global state */
@@ -2541,7 +2565,48 @@ public void loadFile(String scriptName, InputStream in, boolean wrap) {
context.setFile(scriptName);
context.preNodeEval(objectClass, self, scriptName);
- parseFile(in, scriptName, null).interpret(this, context, self, Block.NULL_BLOCK);
+ Node node = parseFile(in, scriptName, null);
+
+ if (config.getSaveRbjFiles()) {
+ try {
+ System.out.println("saving: " + filename + "j");
+ FileOutputStream fos = new FileOutputStream(filename + "j");
+// GZIPOutputStream zos = new GZIPOutputStream(fos);
+ ObjectOutputStream oos = new ObjectOutputStream(fos);
+ oos.writeObject(node);
+ oos.close();
+// zos.close();
+ fos.close();
+ } catch (FileNotFoundException fnfe) {
+ fnfe.printStackTrace();
+ } catch (IOException ioe) {
+ // ignore
+ ioe.printStackTrace();
+// } catch (Exception e) {
+// e.printStackTrace();
+ }
+ }
+ node.interpret(this, context, self, Block.NULL_BLOCK);
+ } catch (JumpException.ReturnJump rj) {
+ return;
+ } finally {
+ context.postNodeEval();
+ context.setFile(file);
+ }
+ }
+
+ public void loadFile(String scriptName, Node node, boolean wrap) {
+ IRubyObject self = wrap ? TopSelfFactory.createTopSelf(this) : getTopSelf();
+ ThreadContext context = getCurrentContext();
+ String file = context.getFile();
+
+ try {
+ secure(4); /* should alter global state */
+
+ context.setFile(scriptName);
+ context.preNodeEval(objectClass, self, scriptName);
+
+ node.interpret(this, context, self, Block.NULL_BLOCK);
} catch (JumpException.ReturnJump rj) {
return;
} finally {
View
12 src/org/jruby/RubyInstanceConfig.java
@@ -202,6 +202,7 @@ public boolean shouldPrecompileAll() {
private String inPlaceBackupExtension = null;
private boolean parserDebug = false;
private String threadDumpSignal = null;
+ private boolean saveRbjFiles = false;
private int safeLevel = 0;
@@ -1171,6 +1172,9 @@ private void processArgument() {
INLINE_DYNCALL_ENABLED = true;
RubyException.TRACE_TYPE = RubyException.RUBY_COMPILED;
break FOR;
+ } else if (argument.equals("--rbj")) {
+ saveRbjFiles = true;
+ break FOR;
} else if (argument.equals("--1.9")) {
setCompatVersion(CompatVersion.RUBY1_9);
break FOR;
@@ -1548,4 +1552,12 @@ public ASTCompiler newCompiler() {
public String getThreadDumpSignal() {
return threadDumpSignal;
}
+
+ public boolean getSaveRbjFiles() {
+ return saveRbjFiles;
+ }
+
+ public void setSaveRbjFiles(boolean saveRbjFiles) {
+ this.saveRbjFiles = saveRbjFiles;
+ }
}
View
20 src/org/jruby/ast/AliasNode.java
@@ -31,6 +31,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.Ruby;
@@ -44,9 +47,14 @@
/** Represents an alias statement (<code>alias newName oldName</code>).
*/
public class AliasNode extends Node {
+ private static final long serialVersionUID = 0L;
private Node oldName;
private Node newName;
+ public AliasNode() {
+ super();
+ }
+
public AliasNode(ISourcePosition position, Node newName, Node oldName) {
super(position);
this.oldName = oldName;
@@ -92,4 +100,16 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
return RuntimeHelpers.defineAlias(context, newerName, olderName);
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(oldName);
+ out.writeObject(newName);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ oldName = (Node)in.readObject();
+ newName = (Node)in.readObject();
+ }
}
View
24 src/org/jruby/ast/AndNode.java
@@ -31,6 +31,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.Ruby;
@@ -44,8 +47,13 @@
* Represents a && (and) operator.
*/
public class AndNode extends Node implements BinaryOperatorNode {
- private final Node firstNode;
- private final Node secondNode;
+ private static final long serialVersionUID = 0L;
+ private Node firstNode;
+ private Node secondNode;
+
+ public AndNode() {
+ super();
+ }
public AndNode(ISourcePosition position, Node firstNode, Node secondNode) {
super(position);
@@ -93,4 +101,16 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
return secondNode.interpret(runtime, context, self, aBlock);
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(firstNode);
+ out.writeObject(secondNode);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ firstNode = (Node)in.readObject();
+ secondNode = (Node)in.readObject();
+ }
}
View
20 src/org/jruby/ast/ArgAuxillaryNode.java
@@ -27,6 +27,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.ast.visitor.NodeVisitor;
import org.jruby.lexer.yacc.ISourcePosition;
@@ -35,9 +38,14 @@
* @author enebo
*/
public class ArgAuxillaryNode extends Node {
+ private static final long serialVersionUID = 0L;
private String name;
private int offset;
+ public ArgAuxillaryNode() {
+ super();
+ }
+
public ArgAuxillaryNode(ISourcePosition position, String name, int offset) {
super(position);
this.name = name;
@@ -65,4 +73,16 @@ public Object accept(NodeVisitor visitor) {
public List<Node> childNodes() {
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeUTF(name);
+ out.writeInt(offset);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ name = in.readUTF();
+ offset = in.readInt();
+ }
}
View
24 src/org/jruby/ast/ArgsCatNode.java
@@ -31,6 +31,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.Ruby;
@@ -42,8 +45,13 @@
import org.jruby.runtime.builtin.IRubyObject;
public class ArgsCatNode extends Node {
- private final Node firstNode;
- private final Node secondNode;
+ private static final long serialVersionUID = 0L;
+ private Node firstNode;
+ private Node secondNode;
+
+ public ArgsCatNode() {
+ super();
+ }
public ArgsCatNode(ISourcePosition position, Node firstNode, Node secondNode) {
super(position);
@@ -89,4 +97,16 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
return RuntimeHelpers.ensureRubyArray(runtime, args).concat(secondArgs);
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(firstNode);
+ out.writeObject(secondNode);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ firstNode = (Node)in.readObject();
+ secondNode = (Node)in.readObject();
+ }
}
View
5 src/org/jruby/ast/ArgsNoArgNode.java
@@ -38,6 +38,11 @@
* @author enebo
*/
public class ArgsNoArgNode extends ArgsNode {
+ private static final long serialVersionUID = 0L;
+ public ArgsNoArgNode() {
+ super();
+ }
+
public ArgsNoArgNode(ISourcePosition position) {
super(position, null, null, null, null, null);
}
View
73 src/org/jruby/ast/ArgsNode.java
@@ -42,6 +42,9 @@
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.Ruby;
@@ -65,23 +68,29 @@
* q1...qn = post arguments (only in 1.9)
*/
public class ArgsNode extends Node {
- private final ListNode pre;
- private final int preCount;
- private final ListNode optArgs;
- protected final ArgumentNode restArgNode;
- protected final int restArg;
- private final BlockArgNode blockArgNode;
+ private static final long serialVersionUID = 0L;
+ private ListNode pre;
+ private int preCount;
+ private ListNode optArgs;
+ protected ArgumentNode restArgNode;
+ protected int restArg;
+ private BlockArgNode blockArgNode;
protected Arity arity;
- private final int requiredArgsCount;
- protected final boolean hasOptArgs;
- protected final boolean hasMasgnArgs;
+ private int requiredArgsCount;
+ protected boolean hasOptArgs;
+ protected boolean hasMasgnArgs;
protected int maxArgsCount;
- protected final boolean isSimple;
+ protected boolean isSimple;
// Only in ruby 1.9 methods
- private final ListNode post;
- private final int postCount;
- private final int postIndex;
+ private ListNode post;
+ private int postCount;
+ private int postIndex;
+
+ public ArgsNode() {
+ super();
+ }
+
/**
*
* @param optionalArguments Node describing the optional arguments
@@ -443,4 +452,42 @@ protected void processBlockArg(DynamicScope scope, Ruby runtime, Block block) {
return Node.createList(pre, optArgs, restArgNode, blockArgNode);
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(pre);
+ out.writeInt(preCount);
+ out.writeObject(optArgs);
+ out.writeObject(restArgNode);
+ out.writeInt(restArg);
+ out.writeObject(blockArgNode);
+ out.writeObject(arity);
+ out.writeInt(requiredArgsCount);
+ out.writeBoolean(hasOptArgs);
+ out.writeBoolean(hasMasgnArgs);
+ out.writeInt(maxArgsCount);
+ out.writeBoolean(isSimple);
+ out.writeObject(post);
+ out.writeInt(postCount);
+ out.writeInt(postIndex);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ pre = (ListNode)in.readObject();
+ preCount = in.readInt();
+ optArgs = (ListNode)in.readObject();
+ restArgNode = (ArgumentNode)in.readObject();
+ restArg = in.readInt();
+ blockArgNode = (BlockArgNode)in.readObject();
+ arity = (Arity)in.readObject();
+ requiredArgsCount = in.readInt();
+ hasOptArgs = in.readBoolean();
+ hasMasgnArgs = in.readBoolean();
+ maxArgsCount = in.readInt();
+ isSimple = in.readBoolean();
+ post = (ListNode)in.readObject();
+ postCount = in.readInt();
+ postIndex = in.readInt();
+ }
}
View
5 src/org/jruby/ast/ArgsPreOneArgNode.java
@@ -37,6 +37,11 @@
*
*/
public class ArgsPreOneArgNode extends ArgsNode {
+ private static final long serialVersionUID = 0L;
+ public ArgsPreOneArgNode() {
+ super();
+ }
+
public ArgsPreOneArgNode(ISourcePosition position, ListNode pre) {
super(position, pre, null, null, null, null);
}
View
5 src/org/jruby/ast/ArgsPreTwoArgNode.java
@@ -37,6 +37,11 @@
* @author enebo
*/
public class ArgsPreTwoArgNode extends ArgsNode {
+ private static final long serialVersionUID = 0L;
+ public ArgsPreTwoArgNode() {
+ super();
+ }
+
public ArgsPreTwoArgNode(ISourcePosition position, ListNode pre) {
super(position, pre, null, null, null, null);
}
View
20 src/org/jruby/ast/ArgsPushNode.java
@@ -28,6 +28,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.Ruby;
@@ -39,8 +42,13 @@
import org.jruby.runtime.builtin.IRubyObject;
public class ArgsPushNode extends Node {
+ private static final long serialVersionUID = 0L;
private Node firstNode;
private Node secondNode;
+
+ public ArgsPushNode() {
+ super();
+ }
public ArgsPushNode(ISourcePosition position, Node firstNode, Node secondNode) {
super(position);
@@ -78,4 +86,16 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
return args.append(secondNode.interpret(runtime, context, self, aBlock));
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(firstNode);
+ out.writeObject(secondNode);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ firstNode = (Node)in.readObject();
+ secondNode = (Node)in.readObject();
+ }
}
View
18 src/org/jruby/ast/ArgumentNode.java
@@ -28,6 +28,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.ast.types.INameNode;
@@ -39,8 +42,13 @@
* (evaluation does not need this).
*/
public class ArgumentNode extends Node implements INameNode {
+ private static final long serialVersionUID = 0L;
private String identifier;
+ public ArgumentNode() {
+ super();
+ }
+
public ArgumentNode(ISourcePosition position, String identifier) {
super(position);
@@ -66,4 +74,14 @@ public void setName(String name) {
public List<Node> childNodes() {
return EMPTY_LIST;
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeUTF(identifier);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ identifier = in.readUTF();
+ }
}
View
18 src/org/jruby/ast/ArrayNode.java
@@ -32,6 +32,9 @@
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.ast.types.ILiteralNode;
import org.jruby.ast.visitor.NodeVisitor;
@@ -44,9 +47,14 @@
* Represents an array. This could be an array literal, quoted words or some args stuff.
*/
public class ArrayNode extends ListNode implements ILiteralNode {
+ private static final long serialVersionUID = 0L;
// This field is used during argument processing to avoid putting RubyArray
// instances that are purely for utility purposes into ObjectSpace.
private boolean lightweight = false;
+
+ public ArrayNode() {
+ super();
+ }
public ArrayNode(ISourcePosition position, Node firstNode) {
super(position, firstNode);
@@ -96,4 +104,14 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
return array;
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeBoolean(lightweight);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ lightweight = in.readBoolean();
+ }
}
View
18 src/org/jruby/ast/AssignableNode.java
@@ -30,6 +30,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.ast.types.IArityNode;
import org.jruby.lexer.yacc.ISourcePosition;
@@ -42,7 +45,12 @@
* Base class of any node which can be assigned to.
*/
public abstract class AssignableNode extends Node implements IArityNode {
+ private static final long serialVersionUID = 0L;
private Node valueNode;
+
+ public AssignableNode() {
+ super();
+ }
public AssignableNode(ISourcePosition position) {
super(position);
@@ -83,4 +91,14 @@ public Arity getArity() {
public String definition(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
return "assignment";
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(valueNode);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ valueNode = (Node)in.readObject();
+ }
}
View
28 src/org/jruby/ast/AttrAssignNode.java
@@ -28,6 +28,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.Ruby;
@@ -52,12 +55,17 @@
* Node that represents an assignment of either an array element or attribute.
*/
public class AttrAssignNode extends Node implements INameNode, IArgumentNode {
- protected final Node receiverNode;
+ private static final long serialVersionUID = 0L;
+ protected Node receiverNode;
private String name;
private Node argsNode;
public CallSite variableCallAdapter;
public CallSite normalCallAdapter;
+ public AttrAssignNode() {
+ super();
+ }
+
public AttrAssignNode(ISourcePosition position, Node receiverNode, String name, Node argsNode) {
super(position);
@@ -275,4 +283,22 @@ public String definition(Ruby runtime, ThreadContext context, IRubyObject self,
return null;
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(receiverNode);
+ out.writeUTF(name);
+ out.writeObject(argsNode);
+ out.writeUTF(variableCallAdapter.methodName);
+ out.writeUTF(normalCallAdapter.methodName);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ receiverNode = (Node)in.readObject();
+ name = in.readUTF();
+ argsNode = (Node)in.readObject();
+ this.normalCallAdapter = MethodIndex.getCallSite(in.readUTF());
+ this.variableCallAdapter = MethodIndex.getVariableCallSite(in.readUTF());
+ }
}
View
18 src/org/jruby/ast/AttrAssignOneArgNode.java
@@ -5,6 +5,9 @@
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.lexer.yacc.ISourcePosition;
import org.jruby.runtime.Block;
@@ -17,7 +20,12 @@
* @author enebo
*/
public class AttrAssignOneArgNode extends AttrAssignNode {
+ private static final long serialVersionUID = 0L;
private Node arg1;
+
+ public AttrAssignOneArgNode() {
+ super();
+ }
public AttrAssignOneArgNode(ISourcePosition position, Node receiverNode, String name, ArrayNode argsNode) {
super(position, receiverNode, name, argsNode);
@@ -55,4 +63,14 @@ public IRubyObject assign(Ruby runtime, ThreadContext context, IRubyObject self,
return runtime.getNil();
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(arg1);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ arg1 = (Node)in.readObject();
+ }
}
View
24 src/org/jruby/ast/AttrAssignThreeArgNode.java
@@ -5,6 +5,9 @@
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.lexer.yacc.ISourcePosition;
import org.jruby.runtime.Block;
@@ -17,9 +20,14 @@
* @author enebo
*/
public class AttrAssignThreeArgNode extends AttrAssignNode {
+ private static final long serialVersionUID = 0L;
private Node arg1;
private Node arg2;
private Node arg3;
+
+ public AttrAssignThreeArgNode() {
+ super();
+ }
public AttrAssignThreeArgNode(ISourcePosition position, Node receiverNode, String name, ArrayNode argsNode) {
super(position, receiverNode, name, argsNode);
@@ -63,5 +71,19 @@ public IRubyObject assign(Ruby runtime, ThreadContext context, IRubyObject self,
callSite.call(context, self, receiver, param1, param2, param3, value);
return runtime.getNil();
- }
+ }
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(arg1);
+ out.writeObject(arg2);
+ out.writeObject(arg3);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ arg1 = (Node)in.readObject();
+ arg2 = (Node)in.readObject();
+ arg3 = (Node)in.readObject();
+ }
}
View
20 src/org/jruby/ast/AttrAssignTwoArgNode.java
@@ -5,6 +5,9 @@
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.lexer.yacc.ISourcePosition;
import org.jruby.runtime.Block;
@@ -17,8 +20,13 @@
* @author enebo
*/
public class AttrAssignTwoArgNode extends AttrAssignNode {
+ private static final long serialVersionUID = 0L;
private Node arg1;
private Node arg2;
+
+ public AttrAssignTwoArgNode() {
+ super();
+ }
public AttrAssignTwoArgNode(ISourcePosition position, Node receiverNode, String name, ArrayNode argsNode) {
super(position, receiverNode, name, argsNode);
@@ -59,4 +67,16 @@ public IRubyObject assign(Ruby runtime, ThreadContext context, IRubyObject self,
return runtime.getNil();
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(arg1);
+ out.writeObject(arg2);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ arg1 = (Node)in.readObject();
+ arg2 = (Node)in.readObject();
+ }
}
View
20 src/org/jruby/ast/BackRefNode.java
@@ -31,6 +31,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.Ruby;
@@ -50,10 +53,15 @@
* - $' what follows the last successful match
*/
public class BackRefNode extends Node {
+ private static final long serialVersionUID = 0L;
/**
* the character which generated the back reference
**/
- private final char type;
+ private char type;
+
+ public BackRefNode() {
+ super();
+ }
public BackRefNode(ISourcePosition position, int type) {
super(position);
@@ -110,4 +118,14 @@ public String definition(Ruby runtime, ThreadContext context, IRubyObject self,
return backref instanceof RubyMatchData ? "$" + type : null;
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeChar(type);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ type = in.readChar();
+ }
}
View
20 src/org/jruby/ast/BeginNode.java
@@ -31,6 +31,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.Ruby;
@@ -44,7 +47,12 @@
* Begin/End block. A Begin ... End block without rescue.
*/
public class BeginNode extends Node {
- private final Node bodyNode;
+ private static final long serialVersionUID = 0L;
+ private Node bodyNode;
+
+ public BeginNode() {
+ super();
+ }
public BeginNode(ISourcePosition position, Node bodyNode) {
super(position);
@@ -82,4 +90,14 @@ public Node getBodyNode() {
public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
return bodyNode.interpret(runtime, context, self, aBlock);
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(bodyNode);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ bodyNode = (Node)in.readObject();
+ }
}
View
18 src/org/jruby/ast/BignumNode.java
@@ -32,6 +32,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.math.BigInteger;
import java.util.List;
@@ -48,8 +51,13 @@
* Represents a big integer literal.
*/
public class BignumNode extends Node implements ILiteralNode {
+ private static final long serialVersionUID = 0L;
private BigInteger value;
+ public BignumNode() {
+ super();
+ }
+
public BignumNode(ISourcePosition position, BigInteger value) {
super(position);
this.value = value;
@@ -83,4 +91,14 @@ public void setValue(BigInteger value) {
public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) {
return RubyBignum.newBignum(runtime, value);
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(value);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ value = (BigInteger)in.readObject();
+ }
}
View
19 src/org/jruby/ast/BlockArg18Node.java
@@ -1,5 +1,8 @@
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.ast.visitor.NodeVisitor;
import org.jruby.lexer.yacc.ISourcePosition;
@@ -14,9 +17,14 @@
*
*/
public class BlockArg18Node extends Node {
+ private static final long serialVersionUID = 0L;
private Node normalBlockArgs;
private Node blockArgAssignee;
+ public BlockArg18Node() {
+ super();
+ }
+
public BlockArg18Node(ISourcePosition position, Node blockArgAssignee,
Node normalBlockArgs) {
super(position);
@@ -50,4 +58,15 @@ public NodeType getNodeType() {
return NodeType.BLOCKARG18NODE;
}
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(normalBlockArgs);
+ out.writeObject(blockArgAssignee);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ normalBlockArgs = (Node)in.readObject();
+ blockArgAssignee = (Node)in.readObject();
+ }
}
View
22 src/org/jruby/ast/BlockArgNode.java
@@ -31,6 +31,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.ast.types.INameNode;
@@ -41,9 +44,14 @@
* An explicit block argument (&amp;my_block) in parameter list.
*/
public class BlockArgNode extends Node implements INameNode {
- private final int count;
+ private static final long serialVersionUID = 0L;
+ private int count;
private String name;
+ public BlockArgNode() {
+ super();
+ }
+
public BlockArgNode(ISourcePosition position, int count, String name) {
super(position);
this.count = count;
@@ -86,4 +94,16 @@ public void setName(String name) {
public List<Node> childNodes() {
return EMPTY_LIST;
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeInt(count);
+ out.writeUTF(name);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ count = in.readInt();
+ name = in.readUTF();
+ }
}
View
5 src/org/jruby/ast/BlockNode.java
@@ -44,6 +44,11 @@
* Represents a block of nodes (read that as list).
*/
public class BlockNode extends ListNode {
+ private static final long serialVersionUID = 0L;
+ public BlockNode() {
+ super();
+ }
+
public BlockNode(ISourcePosition position) {
super(position);
}
View
22 src/org/jruby/ast/BlockPassNode.java
@@ -31,6 +31,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.Ruby;
@@ -49,7 +52,8 @@
* coercible to a proc.
*/
public class BlockPassNode extends Node {
- private final Node bodyNode;
+ private static final long serialVersionUID = 0L;
+ private Node bodyNode;
/** Used by the arg_blk_pass and new_call, new_fcall and new_super
* methods in ParserSupport to temporary save the args node. This should
@@ -57,6 +61,10 @@
*/
private Node argsNode;
+ public BlockPassNode() {
+ super();
+ }
+
public BlockPassNode(ISourcePosition position, Node bodyNode) {
super(position);
this.bodyNode = bodyNode;
@@ -106,4 +114,16 @@ public void setArgsNode(Node argsNode) {
public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block block) {
return bodyNode == null ? runtime.getNil() : bodyNode.interpret(runtime, context, self, block);
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(bodyNode);
+ out.writeObject(argsNode);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ bodyNode = (Node)in.readObject();
+ argsNode = (Node)in.readObject();
+ }
}
View
20 src/org/jruby/ast/BreakNode.java
@@ -31,6 +31,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.Ruby;
@@ -45,7 +48,12 @@
* Represents a 'break' statement.
*/
public class BreakNode extends Node implements NonLocalControlFlowNode {
- private final Node valueNode;
+ private static final long serialVersionUID = 0L;
+ private Node valueNode;
+
+ public BreakNode() {
+ super();
+ }
public BreakNode(ISourcePosition position, Node valueNode) {
super(position);
@@ -89,4 +97,14 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
return RuntimeHelpers.breakJump(context, result);
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(valueNode);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ valueNode = (Node)in.readObject();
+ }
}
View
5 src/org/jruby/ast/CallManyArgsBlockNode.java
@@ -45,6 +45,11 @@
* A method or operator call.
*/
public final class CallManyArgsBlockNode extends CallNode {
+ private static final long serialVersionUID = 0L;
+ public CallManyArgsBlockNode() {
+ super();
+ }
+
public CallManyArgsBlockNode(ISourcePosition position, Node receiverNode, String name, Node args, IterNode iter) {
super(position, receiverNode, name, args, iter);
}
View
5 src/org/jruby/ast/CallManyArgsBlockPassNode.java
@@ -43,6 +43,11 @@
* A method or operator call.
*/
public final class CallManyArgsBlockPassNode extends CallNode {
+ private static final long serialVersionUID = 0L;
+ public CallManyArgsBlockPassNode() {
+ super();
+ }
+
// For 'b.foo()'. Args are only significant in maintaining backwards compatible AST structure
public CallManyArgsBlockPassNode(ISourcePosition position, Node receiverNode, String name, Node args, BlockPassNode iter) {
super(position, receiverNode, name, args, iter);
View
7 src/org/jruby/ast/CallManyArgsNode.java
@@ -41,7 +41,12 @@
/**
* A method or operator call.
*/
-public final class CallManyArgsNode extends CallNode {
+public final class CallManyArgsNode extends CallNode {
+ private static final long serialVersionUID = 0L;
+ public CallManyArgsNode() {
+ super();
+ }
+
public CallManyArgsNode(ISourcePosition position, Node receiverNode, String name, Node args) {
super(position, receiverNode, name, args, null);
}
View
5 src/org/jruby/ast/CallNoArgBlockNode.java
@@ -45,6 +45,11 @@
* A method or operator call.
*/
public final class CallNoArgBlockNode extends CallNode {
+ private static final long serialVersionUID = 0L;
+ public CallNoArgBlockNode() {
+ super();
+ }
+
// For b.foo
public CallNoArgBlockNode(ISourcePosition position, Node receiverNode, String name, IterNode iter) {
super(position, receiverNode, name, null, iter);
View
5 src/org/jruby/ast/CallNoArgBlockPassNode.java
@@ -43,6 +43,11 @@
* A method or operator call.
*/
public final class CallNoArgBlockPassNode extends CallNode {
+ private static final long serialVersionUID = 0L;
+ public CallNoArgBlockPassNode() {
+ super();
+ }
+
// For 'b.foo()'. Args are only significant in maintaining backwards compatible AST structure
public CallNoArgBlockPassNode(ISourcePosition position, Node receiverNode, String name, Node args, BlockPassNode iter) {
super(position, receiverNode, name, args, iter);
View
5 src/org/jruby/ast/CallNoArgNode.java
@@ -46,6 +46,11 @@
* A method or operator call.
*/
public final class CallNoArgNode extends CallNode {
+ private static final long serialVersionUID = 0L;
+ public CallNoArgNode() {
+ super();
+ }
+
// For 'b.foo'
public CallNoArgNode(ISourcePosition position, Node receiverNode, String name) {
super(position, receiverNode, name, null, null);
View
26 src/org/jruby/ast/CallNode.java
@@ -32,6 +32,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.util.List;
import org.jruby.Ruby;
@@ -56,11 +59,16 @@
* A method or operator call.
*/
public class CallNode extends Node implements INameNode, IArgumentNode, BlockAcceptingNode {
- private final Node receiverNode;
+ private static final long serialVersionUID = 0L;
+ private Node receiverNode;
private Node argsNode;
protected Node iterNode;
public CallSite callAdapter;
+ public CallNode() {
+ super();
+ }
+
@Deprecated
public CallNode(ISourcePosition position, Node receiverNode, String name, Node argsNode) {
this(position, receiverNode, name, argsNode, null);
@@ -190,4 +198,20 @@ public String definition(Ruby runtime, ThreadContext context, IRubyObject self,
return null;
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(receiverNode);
+ out.writeObject(argsNode);
+ out.writeObject(iterNode);
+ out.writeUTF(callAdapter.methodName);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ receiverNode = (Node)in.readObject();
+ argsNode = (Node)in.readObject();
+ iterNode = (Node)in.readObject();
+ callAdapter = MethodIndex.getCallSite(in.readUTF());
+ }
}
View
18 src/org/jruby/ast/CallOneArgBlockNode.java
@@ -32,6 +32,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.javasupport.util.RuntimeHelpers;
import org.jruby.lexer.yacc.ISourcePosition;
@@ -43,7 +46,12 @@
* A method or operator call.
*/
public final class CallOneArgBlockNode extends CallNode {
+ private static final long serialVersionUID = 0L;
private Node arg1;
+
+ public CallOneArgBlockNode() {
+ super();
+ }
public CallOneArgBlockNode(ISourcePosition position, Node receiverNode, String name, ArrayNode args, IterNode iter) {
super(position, receiverNode, name, args, iter);
@@ -61,4 +69,14 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
arg1.interpret(runtime, context, self, aBlock),
RuntimeHelpers.getBlock(context, self, iterNode));
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(arg1);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ arg1 = (Node)in.readObject();
+ }
}
View
18 src/org/jruby/ast/CallOneArgBlockPassNode.java
@@ -32,6 +32,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.javasupport.util.RuntimeHelpers;
import org.jruby.lexer.yacc.ISourcePosition;
@@ -43,7 +46,12 @@
* A method or operator call.
*/
public final class CallOneArgBlockPassNode extends CallNode {
+ private static final long serialVersionUID = 0L;
private Node arg1;
+
+ public CallOneArgBlockPassNode() {
+ super();
+ }
public CallOneArgBlockPassNode(ISourcePosition position, Node receiverNode, String name, ArrayNode args, BlockPassNode iter) {
super(position, receiverNode, name, args, iter);
@@ -61,4 +69,14 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
arg1.interpret(runtime, context, self, aBlock),
RuntimeHelpers.getBlock(runtime, context, self, iterNode, aBlock));
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(arg1);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ arg1 = (Node)in.readObject();
+ }
}
View
18 src/org/jruby/ast/CallOneArgFixnumNode.java
@@ -32,6 +32,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.lexer.yacc.ISourcePosition;
import org.jruby.runtime.Block;
@@ -43,7 +46,12 @@
* A method or operator call.
*/
public final class CallOneArgFixnumNode extends CallNode {
+ private static final long serialVersionUID = 0L;
private long arg1;
+
+ public CallOneArgFixnumNode() {
+ super();
+ }
public CallOneArgFixnumNode(ISourcePosition position, Node receiverNode, String name, ArrayNode args) {
super(position, receiverNode, name, args, null);
@@ -64,4 +72,14 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
public Node setIterNode(Node iterNode) {
return new CallOneArgBlockNode(getPosition(), getReceiverNode(), getName(), (ArrayNode) getArgsNode(), (IterNode) iterNode);
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeLong(arg1);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ arg1 = in.readLong();
+ }
}
View
20 src/org/jruby/ast/CallOneArgNode.java
@@ -32,6 +32,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.lexer.yacc.ISourcePosition;
import org.jruby.runtime.Block;
@@ -42,7 +45,12 @@
* A method or operator call.
*/
public final class CallOneArgNode extends CallNode {
- private Node arg1;
+ private static final long serialVersionUID = 0L;
+ private Node arg1;
+
+ public CallOneArgNode() {
+ super();
+ }
public CallOneArgNode(ISourcePosition position, Node receiverNode, String name, ArrayNode args) {
super(position, receiverNode, name, args, null);
@@ -62,4 +70,14 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
public Node setIterNode(Node iterNode) {
return new CallOneArgBlockNode(getPosition(), getReceiverNode(), getName(), (ArrayNode) getArgsNode(), (IterNode) iterNode);
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(arg1);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ arg1 = (Node)in.readObject();
+ }
}
View
5 src/org/jruby/ast/CallSpecialArgBlockNode.java
@@ -44,6 +44,11 @@
* A method or operator call.
*/
public final class CallSpecialArgBlockNode extends CallNode {
+ private static final long serialVersionUID = 0L;
+ public CallSpecialArgBlockNode() {
+ super();
+ }
+
public CallSpecialArgBlockNode(ISourcePosition position, Node receiverNode, String name, Node args, IterNode iter) {
super(position, receiverNode, name, args, iter);
}
View
5 src/org/jruby/ast/CallSpecialArgBlockPassNode.java
@@ -44,6 +44,11 @@
* A method or operator call.
*/
public final class CallSpecialArgBlockPassNode extends CallNode {
+ private static final long serialVersionUID = 0L;
+ public CallSpecialArgBlockPassNode() {
+ super();
+ }
+
public CallSpecialArgBlockPassNode(ISourcePosition position, Node receiverNode, String name, Node args, BlockPassNode iter) {
super(position, receiverNode, name, args, iter);
}
View
5 src/org/jruby/ast/CallSpecialArgNode.java
@@ -43,6 +43,11 @@
* A method or operator call.
*/
public final class CallSpecialArgNode extends CallNode {
+ private static final long serialVersionUID = 0L;
+ public CallSpecialArgNode() {
+ super();
+ }
+
public CallSpecialArgNode(ISourcePosition position, Node receiverNode, String name, Node args) {
super(position, receiverNode, name, args, null);
}
View
24 src/org/jruby/ast/CallThreeArgBlockNode.java
@@ -32,6 +32,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.javasupport.util.RuntimeHelpers;
import org.jruby.lexer.yacc.ISourcePosition;
@@ -43,9 +46,14 @@
* A method or operator call.
*/
public final class CallThreeArgBlockNode extends CallNode {
+ private static final long serialVersionUID = 0L;
private Node arg1;
private Node arg2;
- private Node arg3;
+ private Node arg3;
+
+ public CallThreeArgBlockNode() {
+ super();
+ }
public CallThreeArgBlockNode(ISourcePosition position, Node receiverNode, String name, ArrayNode args, IterNode iter) {
super(position, receiverNode, name, args, iter);
@@ -67,4 +75,18 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
arg3.interpret(runtime, context, self, aBlock),
RuntimeHelpers.getBlock(context, self, iterNode));
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(arg1);
+ out.writeObject(arg2);
+ out.writeObject(arg3);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ arg1 = (Node)in.readObject();
+ arg2 = (Node)in.readObject();
+ arg3 = (Node)in.readObject();
+ }
}
View
24 src/org/jruby/ast/CallThreeArgBlockPassNode.java
@@ -32,6 +32,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.javasupport.util.RuntimeHelpers;
import org.jruby.lexer.yacc.ISourcePosition;
@@ -43,9 +46,14 @@
* A method or operator call.
*/
public final class CallThreeArgBlockPassNode extends CallNode {
+ private static final long serialVersionUID = 0L;
private Node arg1;
private Node arg2;
- private Node arg3;
+ private Node arg3;
+
+ public CallThreeArgBlockPassNode() {
+ super();
+ }
public CallThreeArgBlockPassNode(ISourcePosition position, Node receiverNode, String name, ArrayNode args, BlockPassNode iter) {
super(position, receiverNode, name, args, iter);
@@ -67,4 +75,18 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
arg3.interpret(runtime, context, self, aBlock),
RuntimeHelpers.getBlock(runtime, context, self, iterNode, aBlock));
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(arg1);
+ out.writeObject(arg2);
+ out.writeObject(arg3);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ arg1 = (Node)in.readObject();
+ arg2 = (Node)in.readObject();
+ arg3 = (Node)in.readObject();
+ }
}
View
22 src/org/jruby/ast/CallThreeArgNode.java
@@ -32,6 +32,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.lexer.yacc.ISourcePosition;
import org.jruby.runtime.Block;
@@ -42,9 +45,14 @@
* A method or operator call.
*/
public final class CallThreeArgNode extends CallNode {
+ private static final long serialVersionUID = 0L;
private Node arg1;
private Node arg2;
private Node arg3;
+
+ public CallThreeArgNode() {
+ super();
+ }
public CallThreeArgNode(ISourcePosition position, Node receiverNode, String name, ArrayNode args) {
super(position, receiverNode, name, args, null);
@@ -68,4 +76,18 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
public Node setIterNode(Node iterNode) {
return new CallThreeArgBlockNode(getPosition(), getReceiverNode(), getName(), (ArrayNode) getArgsNode(), (IterNode) iterNode);
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(arg1);
+ out.writeObject(arg2);
+ out.writeObject(arg3);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ arg1 = (Node)in.readObject();
+ arg2 = (Node)in.readObject();
+ arg3 = (Node)in.readObject();
+ }
}
View
22 src/org/jruby/ast/CallTwoArgBlockNode.java
@@ -32,6 +32,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.javasupport.util.RuntimeHelpers;
import org.jruby.lexer.yacc.ISourcePosition;
@@ -43,8 +46,13 @@
* A method or operator call.
*/
public final class CallTwoArgBlockNode extends CallNode {
+ private static final long serialVersionUID = 0L;
private Node arg1;
- private Node arg2;
+ private Node arg2;
+
+ public CallTwoArgBlockNode() {
+ super();
+ }
public CallTwoArgBlockNode(ISourcePosition position, Node receiverNode, String name, ArrayNode args, IterNode iter) {
super(position, receiverNode, name, args, iter);
@@ -64,4 +72,16 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
arg2.interpret(runtime, context, self, aBlock),
RuntimeHelpers.getBlock(context, self, iterNode));
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(arg1);
+ out.writeObject(arg2);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ arg1 = (Node)in.readObject();
+ arg2 = (Node)in.readObject();
+ }
}
View
22 src/org/jruby/ast/CallTwoArgBlockPassNode.java
@@ -32,6 +32,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.javasupport.util.RuntimeHelpers;
import org.jruby.lexer.yacc.ISourcePosition;
@@ -43,8 +46,13 @@
* A method or operator call.
*/
public final class CallTwoArgBlockPassNode extends CallNode {
+ private static final long serialVersionUID = 0L;
private Node arg1;
- private Node arg2;
+ private Node arg2;
+
+ public CallTwoArgBlockPassNode() {
+ super();
+ }
public CallTwoArgBlockPassNode(ISourcePosition position, Node receiverNode, String name, ArrayNode args, BlockPassNode iter) {
super(position, receiverNode, name, args, iter);
@@ -64,4 +72,16 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
arg2.interpret(runtime, context, self, aBlock),
RuntimeHelpers.getBlock(runtime, context, self, iterNode, aBlock));
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {
+ super.writeExternal(out);
+ out.writeObject(arg1);
+ out.writeObject(arg2);
+ }
+
+ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ super.readExternal(in);
+ arg1 = (Node)in.readObject();
+ arg2 = (Node)in.readObject();
+ }
}
View
20 src/org/jruby/ast/CallTwoArgNode.java
@@ -32,6 +32,9 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
import org.jruby.Ruby;
import org.jruby.lexer.yacc.ISourcePosition;
import org.jruby.runtime.Block;
@@ -42,8 +45,13 @@
* A method or operator call.
*/
public final class CallTwoArgNode extends CallNode {
+ private static final long serialVersionUID = 0L;
private Node arg1;
private Node arg2;
+
+ public CallTwoArgNode() {
+ super();
+ }
public CallTwoArgNode(ISourcePosition position, Node receiverNode, String name, ArrayNode args) {
super(position, receiverNode, name, args, null);
@@ -65,4 +73,16 @@ public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject se
public Node setIterNode(Node iterNode) {
return new CallTwoArgBlockNode(getPosition(), getReceiverNode(), getName(), (ArrayNode) getArgsNode(), (IterNode) iterNode);
}
+
+ public void writeExternal(ObjectOutput out) throws IOException {</