8059843: Make AST serializable
authorattila
Fri, 17 Oct 2014 14:24:26 +0200
changeset 27204 06ec78f29a56
parent 27130 41df50e7303d
child 27205 72207261e641
8059843: Make AST serializable Reviewed-by: hannesw, lagergren
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Label.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/ArrayType.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BitwiseType.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BooleanType.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/IntType.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/LongType.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/NumberType.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/NumericType.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/ObjectType.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/Type.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/AccessNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BaseNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Block.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BlockStatement.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BreakNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BreakableStatement.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CallNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CaseNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CatchNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ContinueNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/EmptyNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Expression.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ExpressionStatement.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ForNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IdentNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IfNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IndexNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/JoinPredecessorExpression.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/JumpStatement.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LabelNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContextExpression.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContextStatement.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LoopNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ObjectNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/PropertyNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ReturnNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/RuntimeNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SplitNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Statement.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SwitchNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/TernaryNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ThrowNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/TryNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/UnaryNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/WhileNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/WithNode.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompileUnit.java	Fri Oct 17 14:24:26 2014 +0200
@@ -25,24 +25,29 @@
 
 package jdk.nashorn.internal.codegen;
 
+import java.io.Serializable;
 import java.util.Set;
 import java.util.TreeSet;
 
 /**
- * Used to track split class compilation.
- */
-public final class CompileUnit implements Comparable<CompileUnit> {
+  * Used to track split class compilation. Note that instances of the class are serializable, but all fields are
+  * transient, making the serialized version of the class only useful for tracking the referential topology of other
+  * AST nodes referencing the same or different compile units.
+  */
+public final class CompileUnit implements Comparable<CompileUnit>, Serializable {
+    private static final long serialVersionUID = 1L;
+
     /** Current class name */
-    private final String className;
+    private transient final String className;
 
     /** Current class generator */
-    private ClassEmitter classEmitter;
+    private transient ClassEmitter classEmitter;
 
-    private long weight;
+    private transient long weight;
 
-    private Class<?> clazz;
+    private transient Class<?> clazz;
 
-    private boolean isUsed;
+    private transient boolean isUsed;
 
     private static int emittedUnitCount;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Label.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Label.java	Fri Oct 17 14:24:26 2014 +0200
@@ -24,6 +24,7 @@
  */
 package jdk.nashorn.internal.codegen;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.BitSet;
@@ -39,7 +40,9 @@
  *
  * see -Dnashorn.codegen.debug, --log=codegen
  */
-public final class Label {
+public final class Label implements Serializable {
+    private static final long serialVersionUID = 1L;
+
     //byte code generation evaluation type stack for consistency check
     //and correct opcode selection. one per label as a label may be a
     //join point
@@ -491,7 +494,7 @@
     private final String name;
 
     /** Type stack at this label */
-    private Label.Stack stack;
+    private transient Label.Stack stack;
 
     /** ASM representation of this label */
     private jdk.internal.org.objectweb.asm.Label label;
@@ -500,9 +503,9 @@
     private final int id;
 
     /** Is this label reachable (anything ever jumped to it)? */
-    private boolean reachable;
+    private transient boolean reachable;
 
-    private boolean breakTarget;
+    private transient boolean breakTarget;
 
     /**
      * Constructor
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/ArrayType.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/ArrayType.java	Fri Oct 17 14:24:26 2014 +0200
@@ -37,6 +37,7 @@
  * This is an array type, i.e. OBJECT_ARRAY, NUMBER_ARRAY.
  */
 public class ArrayType extends ObjectType implements BytecodeArrayOps {
+    private static final long serialVersionUID = 1L;
 
     /**
      * Constructor
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BitwiseType.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BitwiseType.java	Fri Oct 17 14:24:26 2014 +0200
@@ -29,6 +29,7 @@
  * This class represents a numeric type that can be used for bit operations.
  */
 public abstract class BitwiseType extends NumericType implements BytecodeBitwiseOps {
+    private static final long serialVersionUID = 1L;
 
     /**
      * Constructor
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BooleanType.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BooleanType.java	Fri Oct 17 14:24:26 2014 +0200
@@ -69,6 +69,7 @@
  * The boolean type class
  */
 public final class BooleanType extends Type {
+    private static final long serialVersionUID = 1L;
 
     private static final CompilerConstants.Call VALUE_OF = staticCallNoLookup(Boolean.class, "valueOf", Boolean.class, boolean.class);
     private static final CompilerConstants.Call TO_STRING = staticCallNoLookup(Boolean.class, "toString", String.class, boolean.class);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/IntType.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/IntType.java	Fri Oct 17 14:24:26 2014 +0200
@@ -60,6 +60,7 @@
  * Type class: INT
  */
 class IntType extends BitwiseType {
+    private static final long serialVersionUID = 1L;
 
     private static final CompilerConstants.Call TO_STRING = staticCallNoLookup(Integer.class, "toString", String.class, int.class);
     private static final CompilerConstants.Call VALUE_OF  = staticCallNoLookup(Integer.class, "valueOf", Integer.class, int.class);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/LongType.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/LongType.java	Fri Oct 17 14:24:26 2014 +0200
@@ -54,6 +54,7 @@
  * Type class: LONG
  */
 class LongType extends BitwiseType {
+    private static final long serialVersionUID = 1L;
 
     private static final CompilerConstants.Call VALUE_OF = staticCallNoLookup(Long.class, "valueOf", Long.class, long.class);
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/NumberType.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/NumberType.java	Fri Oct 17 14:24:26 2014 +0200
@@ -46,6 +46,7 @@
 import jdk.nashorn.internal.runtime.JSType;
 
 class NumberType extends NumericType {
+    private static final long serialVersionUID = 1L;
 
     private static final CompilerConstants.Call VALUE_OF = staticCallNoLookup(Double.class, "valueOf", Double.class, double.class);
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/NumericType.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/NumericType.java	Fri Oct 17 14:24:26 2014 +0200
@@ -29,6 +29,8 @@
  * This is a numeric type, i.e. NUMBER, LONG, INT, INT32.
  */
 public abstract class NumericType extends Type implements BytecodeNumericOps {
+    private static final long serialVersionUID = 1L;
+
     /**
      * Constructor
      *
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/ObjectType.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/ObjectType.java	Fri Oct 17 14:24:26 2014 +0200
@@ -47,6 +47,7 @@
  * contain a class that is a more specialized object
  */
 class ObjectType extends Type {
+    private static final long serialVersionUID = 1L;
 
     protected ObjectType() {
         this(Object.class);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/Type.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/Type.java	Fri Oct 17 14:24:26 2014 +0200
@@ -47,9 +47,11 @@
 import static jdk.internal.org.objectweb.asm.Opcodes.T_INT;
 import static jdk.internal.org.objectweb.asm.Opcodes.T_LONG;
 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup;
+
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
+import java.io.Serializable;
 import java.lang.invoke.CallSite;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
@@ -88,19 +90,20 @@
  * INTs rather than OBJECTs
  */
 
-public abstract class Type implements Comparable<Type>, BytecodeOps {
+public abstract class Type implements Comparable<Type>, BytecodeOps, Serializable {
+    private static final long serialVersionUID = 1L;
 
     /** Human readable name for type */
-    private final String name;
+    private transient final String name;
 
     /** Descriptor for type */
-    private final String descriptor;
+    private transient final String descriptor;
 
     /** The "weight" of the type. Used for picking widest/least specific common type */
-    private final int weight;
+    private transient final int weight;
 
     /** How many bytecode slots does this type occupy */
-    private final int slots;
+    private transient final int slots;
 
     /** The class for this type */
     private final Class<?> clazz;
@@ -113,7 +116,7 @@
             Collections.synchronizedMap(new WeakHashMap<Class<?>, jdk.internal.org.objectweb.asm.Type>());
 
     /** Internal ASM type for this Type - computed once at construction */
-    private final jdk.internal.org.objectweb.asm.Type internalType;
+    private transient final jdk.internal.org.objectweb.asm.Type internalType;
 
     /** Weights are used to decide which types are "wider" than other types */
     protected static final int MIN_WEIGHT = -1;
@@ -934,6 +937,8 @@
      * This is the singleton for integer arrays
      */
     public static final ArrayType INT_ARRAY = new ArrayType(int[].class) {
+        private static final long serialVersionUID = 1L;
+
         @Override
         public void astore(final MethodVisitor method) {
             method.visitInsn(IASTORE);
@@ -961,6 +966,8 @@
      * This is the singleton for long arrays
      */
     public static final ArrayType LONG_ARRAY = new ArrayType(long[].class) {
+        private static final long serialVersionUID = 1L;
+
         @Override
         public void astore(final MethodVisitor method) {
             method.visitInsn(LASTORE);
@@ -988,6 +995,8 @@
      * This is the singleton for numeric arrays
      */
     public static final ArrayType NUMBER_ARRAY = new ArrayType(double[].class) {
+        private static final long serialVersionUID = 1L;
+
         @Override
         public void astore(final MethodVisitor method) {
             method.visitInsn(DASTORE);
@@ -1022,6 +1031,8 @@
 
     /** This type, always an object type, just a toString override */
     public static final Type THIS = new ObjectType() {
+        private static final long serialVersionUID = 1L;
+
         @Override
         public String toString() {
             return "this";
@@ -1030,6 +1041,8 @@
 
     /** Scope type, always an object type, just a toString override */
     public static final Type SCOPE = new ObjectType() {
+        private static final long serialVersionUID = 1L;
+
         @Override
         public String toString() {
             return "scope";
@@ -1041,6 +1054,7 @@
     }
 
     private abstract static class ValueLessType extends Type {
+        private static final long serialVersionUID = 1L;
 
         ValueLessType(final String name) {
             super(name, Unknown.class, MIN_WEIGHT, 1);
@@ -1092,6 +1106,8 @@
      * inference. It has the minimum type width
      */
     public static final Type UNKNOWN = new ValueLessType("<unknown>") {
+        private static final long serialVersionUID = 1L;
+
         @Override
         public String getDescriptor() {
             return "<unknown>";
@@ -1108,6 +1124,7 @@
      * inference. It has the minimum type width
      */
     public static final Type SLOT_2 = new ValueLessType("<slot_2>") {
+        private static final long serialVersionUID = 1L;
 
         @Override
         public String getDescriptor() {
@@ -1124,4 +1141,8 @@
         cache.put(type.getTypeClass(), type);
         return type;
     }
+
+    protected final Object readResolve() {
+        return Type.typeFor(clazz);
+    }
 }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/AccessNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/AccessNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -34,6 +34,8 @@
  */
 @Immutable
 public final class AccessNode extends BaseNode {
+    private static final long serialVersionUID = 1L;
+
     /** Property name. */
     private final String property;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BaseNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BaseNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -39,6 +39,7 @@
  */
 @Immutable
 public abstract class BaseNode extends Expression implements FunctionCall, Optimistic {
+    private static final long serialVersionUID = 1L;
 
     /** Base Node. */
     protected final Expression base;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -43,6 +43,8 @@
  */
 @Immutable
 public final class BinaryNode extends Expression implements Assignment<Expression>, Optimistic {
+    private static final long serialVersionUID = 1L;
+
     // Placeholder for "undecided optimistic ADD type". Unfortunately, we can't decide the type of ADD during optimistic
     // type calculation as it can have local variables as its operands that will decide its ultimate type.
     private static final Type OPTIMISTIC_UNDECIDED_TYPE = Type.typeFor(new Object(){/*empty*/}.getClass());
@@ -56,8 +58,8 @@
 
     private final Type type;
 
-    private Type cachedType;
-    private Object cachedTypeFunction;
+    private transient Type cachedType;
+    private transient Object cachedTypeFunction;
 
     @Ignore
     private static final Set<TokenType> CAN_OVERFLOW =
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Block.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Block.java	Fri Oct 17 14:24:26 2014 +0200
@@ -42,6 +42,8 @@
  */
 @Immutable
 public class Block extends Node implements BreakableNode, Terminal, Flags<Block> {
+    private static final long serialVersionUID = 1L;
+
     /** List of statements */
     protected final List<Statement> statements;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BlockStatement.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BlockStatement.java	Fri Oct 17 14:24:26 2014 +0200
@@ -32,6 +32,8 @@
  * Represents a block used as a statement.
  */
 public class BlockStatement extends Statement {
+    private static final long serialVersionUID = 1L;
+
     /** Block to execute. */
     private final Block block;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BreakNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BreakNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -34,6 +34,7 @@
  */
 @Immutable
 public final class BreakNode extends JumpStatement {
+    private static final long serialVersionUID = 1L;
 
     /**
      * Constructor
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BreakableStatement.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BreakableStatement.java	Fri Oct 17 14:24:26 2014 +0200
@@ -32,6 +32,7 @@
 
 @Immutable
 abstract class BreakableStatement extends LexicalContextStatement implements BreakableNode {
+    private static final long serialVersionUID = 1L;
 
     /** break label. */
     protected final Label breakLabel;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CallNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CallNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -27,6 +27,7 @@
 
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT;
 
+import java.io.Serializable;
 import java.util.Collections;
 import java.util.List;
 import java.util.function.Function;
@@ -40,6 +41,7 @@
  */
 @Immutable
 public final class CallNode extends LexicalContextExpression implements Optimistic {
+    private static final long serialVersionUID = 1L;
 
     /** Function identifier or function body. */
     private final Expression function;
@@ -64,7 +66,8 @@
     /**
      * Arguments to be passed to builtin {@code eval} function
      */
-    public static class EvalArgs {
+    public static class EvalArgs implements Serializable {
+        private static final long serialVersionUID = 1L;
         private final List<Expression> args;
 
         /** location string for the eval call */
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CaseNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CaseNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -37,6 +37,8 @@
  */
 @Immutable
 public final class CaseNode extends Node implements JoinPredecessor, Labels, Terminal {
+    private static final long serialVersionUID = 1L;
+
     /** Test expression. */
     private final Expression test;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CatchNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/CatchNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -33,6 +33,8 @@
  */
 @Immutable
 public final class CatchNode extends Statement {
+    private static final long serialVersionUID = 1L;
+
     /** Exception identifier. */
     private final IdentNode exception;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ContinueNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ContinueNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -34,6 +34,8 @@
  */
 @Immutable
 public class ContinueNode extends JumpStatement {
+    private static final long serialVersionUID = 1L;
+
     /**
      * Constructor
      *
@@ -80,4 +82,3 @@
         return ((LoopNode)target).getContinueLabel();
     }
 }
-
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/EmptyNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/EmptyNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -33,6 +33,7 @@
  */
 @Immutable
 public final class EmptyNode extends Statement {
+    private static final long serialVersionUID = 1L;
 
     /**
      * Constructor
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Expression.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Expression.java	Fri Oct 17 14:24:26 2014 +0200
@@ -35,6 +35,8 @@
  *
  */
 public abstract class Expression extends Node {
+    private static final long serialVersionUID = 1L;
+
     static final String OPT_IDENTIFIER = "%";
 
     private static final Function<Symbol, Type> UNKNOWN_LOCALS = new Function<Symbol, Type>() {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ExpressionStatement.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ExpressionStatement.java	Fri Oct 17 14:24:26 2014 +0200
@@ -35,6 +35,8 @@
  */
 @Immutable
 public final class ExpressionStatement extends Statement {
+    private static final long serialVersionUID = 1L;
+
     /** Expression to execute. */
     private final Expression expression;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ForNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ForNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -33,6 +33,8 @@
  */
 @Immutable
 public final class ForNode extends LoopNode {
+    private static final long serialVersionUID = 1L;
+
     /** Initialize expression for an ordinary for statement, or the LHS expression receiving iterated-over values in a
      * for-in statement. */
     private final Expression init;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -57,6 +57,8 @@
  */
 @Immutable
 public final class FunctionNode extends LexicalContextExpression implements Flags<FunctionNode>, CompileUnitHolder {
+    private static final long serialVersionUID = 1L;
+
     /** Type used for all FunctionNodes */
     public static final Type FUNCTION_TYPE = Type.typeFor(ScriptFunction.class);
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IdentNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IdentNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -42,6 +42,8 @@
  */
 @Immutable
 public final class IdentNode extends Expression implements PropertyKey, FunctionCall, Optimistic, JoinPredecessor {
+    private static final long serialVersionUID = 1L;
+
     private static final int PROPERTY_NAME     = 1 << 0;
     private static final int INITIALIZED_HERE  = 1 << 1;
     private static final int FUNCTION          = 1 << 2;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IfNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IfNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -33,6 +33,8 @@
  */
 @Immutable
 public final class IfNode extends Statement implements JoinPredecessor {
+    private static final long serialVersionUID = 1L;
+
     /** Test expression. */
     private final Expression test;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IndexNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/IndexNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -33,6 +33,8 @@
  */
 @Immutable
 public final class IndexNode extends BaseNode {
+    private static final long serialVersionUID = 1L;
+
     /** Property index. */
     private final Expression index;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/JoinPredecessorExpression.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/JoinPredecessorExpression.java	Fri Oct 17 14:24:26 2014 +0200
@@ -33,6 +33,7 @@
  * A wrapper for an expression that is in a position to be a join predecessor.
  */
 public class JoinPredecessorExpression extends Expression implements JoinPredecessor {
+    private static final long serialVersionUID = 1L;
 
     private final Expression expression;
     private final LocalVariableConversion conversion;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/JumpStatement.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/JumpStatement.java	Fri Oct 17 14:24:26 2014 +0200
@@ -31,6 +31,7 @@
  * Common base class for jump statements (e.g. {@code break} and {@code continue}).
  */
 public abstract class JumpStatement extends Statement implements JoinPredecessor {
+    private static final long serialVersionUID = 1L;
 
     private final String labelName;
     private final LocalVariableConversion conversion;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LabelNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LabelNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -35,6 +35,8 @@
  */
 @Immutable
 public final class LabelNode extends LexicalContextStatement implements JoinPredecessor {
+    private static final long serialVersionUID = 1L;
+
     /** Label ident. */
     private final String labelName;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContextExpression.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContextExpression.java	Fri Oct 17 14:24:26 2014 +0200
@@ -28,6 +28,7 @@
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 
 abstract class LexicalContextExpression extends Expression implements LexicalContextNode {
+    private static final long serialVersionUID = 1L;
 
     LexicalContextExpression(final LexicalContextExpression expr) {
         super(expr);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContextStatement.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContextStatement.java	Fri Oct 17 14:24:26 2014 +0200
@@ -28,6 +28,8 @@
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 
 abstract class LexicalContextStatement extends Statement implements LexicalContextNode {
+    private static final long serialVersionUID = 1L;
+
     /**
      * Constructor
      *
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.ir;
 
+import java.io.Serializable;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -49,6 +50,8 @@
  */
 @Immutable
 public abstract class LiteralNode<T> extends Expression implements PropertyKey {
+    private static final long serialVersionUID = 1L;
+
     /** Literal value */
     protected final T value;
 
@@ -270,6 +273,8 @@
      * @param <T> the literal type
      */
     public static class PrimitiveLiteralNode<T> extends LiteralNode<T> {
+        private static final long serialVersionUID = 1L;
+
         private PrimitiveLiteralNode(final long token, final int finish, final T value) {
             super(token, finish, value);
         }
@@ -304,6 +309,7 @@
 
     @Immutable
     private static final class BooleanLiteralNode extends PrimitiveLiteralNode<Boolean> {
+        private static final long serialVersionUID = 1L;
 
         private BooleanLiteralNode(final long token, final int finish, final boolean value) {
             super(Token.recast(token, value ? TokenType.TRUE : TokenType.FALSE), finish, value);
@@ -356,6 +362,7 @@
 
     @Immutable
     private static final class NumberLiteralNode extends PrimitiveLiteralNode<Number> {
+        private static final long serialVersionUID = 1L;
 
         private final Type type = numberGetType(value);
 
@@ -418,6 +425,8 @@
     }
 
     private static class UndefinedLiteralNode extends PrimitiveLiteralNode<Undefined> {
+        private static final long serialVersionUID = 1L;
+
         private UndefinedLiteralNode(final long token, final int finish) {
             super(Token.recast(token, TokenType.OBJECT), finish, ScriptRuntime.UNDEFINED);
         }
@@ -454,6 +463,8 @@
 
     @Immutable
     private static class StringLiteralNode extends PrimitiveLiteralNode<String> {
+        private static final long serialVersionUID = 1L;
+
         private StringLiteralNode(final long token, final int finish, final String value) {
             super(Token.recast(token, TokenType.STRING), finish, value);
         }
@@ -497,6 +508,8 @@
 
     @Immutable
     private static class LexerTokenLiteralNode extends LiteralNode<LexerToken> {
+        private static final long serialVersionUID = 1L;
+
         private LexerTokenLiteralNode(final long token, final int finish, final LexerToken value) {
             super(Token.recast(token, TokenType.STRING), finish, value); //TODO is string the correct token type here?
         }
@@ -560,6 +573,7 @@
     }
 
     private static final class NullLiteralNode extends PrimitiveLiteralNode<Object> {
+        private static final long serialVersionUID = 1L;
 
         private NullLiteralNode(final long token, final int finish) {
             super(Token.recast(token, TokenType.OBJECT), finish, null);
@@ -590,6 +604,7 @@
      */
     @Immutable
     public static final class ArrayLiteralNode extends LiteralNode<Expression[]> implements LexicalContextNode {
+        private static final long serialVersionUID = 1L;
 
         /** Array element type. */
         private final Type elementType;
@@ -607,7 +622,9 @@
          * An ArrayUnit is a range in an ArrayLiteral. ArrayLiterals can
          * be split if they are too large, for bytecode generation reasons
          */
-        public static final class ArrayUnit implements CompileUnitHolder {
+        public static final class ArrayUnit implements CompileUnitHolder, Serializable {
+            private static final long serialVersionUID = 1L;
+
             /** Compile unit associated with the postsets range. */
             private final CompileUnit compileUnit;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LoopNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LoopNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -34,6 +34,8 @@
  * A loop node, for example a while node, do while node or for node
  */
 public abstract class LoopNode extends BreakableStatement {
+    private static final long serialVersionUID = 1L;
+
     /** loop continue label. */
     protected final Label continueLabel;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Node.java	Fri Oct 17 14:24:26 2014 +0200
@@ -25,6 +25,7 @@
 
 package jdk.nashorn.internal.ir;
 
+import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
@@ -34,7 +35,9 @@
 /**
  * Nodes are used to compose Abstract Syntax Trees.
  */
-public abstract class Node implements Cloneable {
+public abstract class Node implements Cloneable, Serializable {
+    private static final long serialVersionUID = 1L;
+
     /** Start of source range. */
     protected final int start;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ObjectNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ObjectNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -37,6 +37,7 @@
  */
 @Immutable
 public final class ObjectNode extends Expression {
+    private static final long serialVersionUID = 1L;
 
     /** Literal elements. */
     private final List<PropertyNode> elements;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/PropertyNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/PropertyNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -33,6 +33,7 @@
  */
 @Immutable
 public final class PropertyNode extends Node {
+    private static final long serialVersionUID = 1L;
 
     /** Property key. */
     private final PropertyKey key;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ReturnNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ReturnNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -36,6 +36,8 @@
  */
 @Immutable
 public class ReturnNode extends Statement {
+    private static final long serialVersionUID = 1L;
+
     /** Optional expression. */
     private final Expression expression;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/RuntimeNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/RuntimeNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -42,6 +42,7 @@
  */
 @Immutable
 public class RuntimeNode extends Expression implements Optimistic {
+    private static final long serialVersionUID = 1L;
 
     /**
      * Request enum used for meta-information about the runtime request
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SplitNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SplitNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -40,6 +40,8 @@
  */
 @Immutable
 public class SplitNode extends LexicalContextStatement implements Labels, CompileUnitHolder {
+    private static final long serialVersionUID = 1L;
+
     /** Split node method name. */
     private final String name;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Statement.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Statement.java	Fri Oct 17 14:24:26 2014 +0200
@@ -31,6 +31,7 @@
  * location information is the Statement
  */
 public abstract class Statement extends Node implements Terminal {
+    private static final long serialVersionUID = 1L;
 
     private final int lineNumber;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SwitchNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SwitchNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -37,6 +37,8 @@
  */
 @Immutable
 public final class SwitchNode extends BreakableStatement {
+    private static final long serialVersionUID = 1L;
+
     /** Switch expression. */
     private final Expression expression;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/TernaryNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/TernaryNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -37,6 +37,8 @@
  */
 @Immutable
 public final class TernaryNode extends Expression {
+    private static final long serialVersionUID = 1L;
+
     private final Expression test;
     private final JoinPredecessorExpression trueExpr;
     private final JoinPredecessorExpression falseExpr;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ThrowNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ThrowNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -33,6 +33,8 @@
  */
 @Immutable
 public final class ThrowNode extends Statement implements JoinPredecessor {
+    private static final long serialVersionUID = 1L;
+
     /** Exception expression. */
     private final Expression expression;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/TryNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/TryNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -36,6 +36,8 @@
  */
 @Immutable
 public final class TryNode extends Statement implements JoinPredecessor {
+    private static final long serialVersionUID = 1L;
+
     /** Try statements. */
     private final Block body;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/UnaryNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/UnaryNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -46,6 +46,8 @@
  */
 @Immutable
 public final class UnaryNode extends Expression implements Assignment<Expression>, Optimistic {
+    private static final long serialVersionUID = 1L;
+
     /** Right hand side argument. */
     private final Expression expression;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -34,6 +34,8 @@
  */
 @Immutable
 public final class VarNode extends Statement implements Assignment<IdentNode> {
+    private static final long serialVersionUID = 1L;
+
     /** Var name. */
     private final IdentNode name;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/WhileNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/WhileNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -34,6 +34,8 @@
  */
 @Immutable
 public final class WhileNode extends LoopNode {
+    private static final long serialVersionUID = 1L;
+
 
     /** is this a do while node ? */
     private final boolean isDoWhile;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/WithNode.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/WithNode.java	Fri Oct 17 14:24:26 2014 +0200
@@ -33,6 +33,8 @@
  */
 @Immutable
 public final class WithNode extends LexicalContextStatement {
+    private static final long serialVersionUID = 1L;
+
    /** This expression. */
     private final Expression expression;
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java	Wed Jul 05 20:04:46 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Lexer.java	Fri Oct 17 14:24:26 2014 +0200
@@ -46,6 +46,7 @@
 import static jdk.nashorn.internal.parser.TokenType.STRING;
 import static jdk.nashorn.internal.parser.TokenType.XML;
 
+import java.io.Serializable;
 import jdk.nashorn.internal.runtime.ECMAErrors;
 import jdk.nashorn.internal.runtime.ErrorManager;
 import jdk.nashorn.internal.runtime.JSErrorType;
@@ -1717,7 +1718,9 @@
      * Helper class for Lexer tokens, e.g XML or RegExp tokens.
      * This is the abstract superclass
      */
-    public static abstract class LexerToken {
+    public static abstract class LexerToken implements Serializable {
+        private static final long serialVersionUID = 1L;
+
         private final String expression;
 
         /**
@@ -1741,6 +1744,8 @@
      * Temporary container for regular expressions.
      */
     public static class RegexToken extends LexerToken {
+        private static final long serialVersionUID = 1L;
+
         /** Options. */
         private final String options;
 
@@ -1773,6 +1778,7 @@
      * Temporary container for XML expression.
      */
     public static class XMLToken extends LexerToken {
+        private static final long serialVersionUID = 1L;
 
         /**
          * Constructor.