Skip to content

Commit

Permalink
Temporarily repackage everything in part 13 to part 12, to get a diff…
Browse files Browse the repository at this point in the history
… what was changed in this part.
  • Loading branch information
skinny85 committed Feb 18, 2024
1 parent 51b591e commit b83088b
Show file tree
Hide file tree
Showing 90 changed files with 329 additions and 331 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.endoflineblog.truffle.part_13;
package com.endoflineblog.truffle.part_12;

import org.openjdk.jmh.annotations.Benchmark;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.endoflineblog.truffle.part_13;
package com.endoflineblog.truffle.part_12;

import org.graalvm.polyglot.Context;
import org.openjdk.jmh.annotations.BenchmarkMode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
grammar EasyScript ;

@header{
package com.endoflineblog.truffle.part_13.parsing.antlr;
package com.endoflineblog.truffle.part_12.parsing.antlr;
}

start : stmt+ EOF ;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.endoflineblog.truffle.part_13;
package com.endoflineblog.truffle.part_12;

import com.endoflineblog.truffle.part_13.common.ShapesAndPrototypes;
import com.endoflineblog.truffle.part_12.common.ShapesAndPrototypes;
import com.oracle.truffle.api.TruffleLanguage;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.object.DynamicObject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
package com.endoflineblog.truffle.part_13;

import com.endoflineblog.truffle.part_13.common.ShapesAndPrototypes;
import com.endoflineblog.truffle.part_13.nodes.exprs.functions.ReadFunctionArgExprNode;
import com.endoflineblog.truffle.part_13.nodes.exprs.functions.built_in.AbsFunctionBodyExprNodeFactory;
import com.endoflineblog.truffle.part_13.nodes.exprs.functions.built_in.BuiltInFunctionBodyExprNode;
import com.endoflineblog.truffle.part_13.nodes.exprs.functions.built_in.PowFunctionBodyExprNodeFactory;
import com.endoflineblog.truffle.part_13.nodes.exprs.functions.built_in.methods.CharAtMethodBodyExprNodeFactory;
import com.endoflineblog.truffle.part_13.nodes.root.BuiltInFuncRootNode;
import com.endoflineblog.truffle.part_13.nodes.root.StmtBlockRootNode;
import com.endoflineblog.truffle.part_13.parsing.EasyScriptTruffleParser;
import com.endoflineblog.truffle.part_13.parsing.ParsingResult;
import com.endoflineblog.truffle.part_13.runtime.ArrayObject;
import com.endoflineblog.truffle.part_13.runtime.ClassPrototypeObject;
import com.endoflineblog.truffle.part_13.runtime.FunctionObject;
import com.endoflineblog.truffle.part_13.runtime.GlobalScopeObject;
import com.endoflineblog.truffle.part_13.runtime.JavaScriptObject;
package com.endoflineblog.truffle.part_12;

import com.endoflineblog.truffle.part_12.common.ShapesAndPrototypes;
import com.endoflineblog.truffle.part_12.nodes.root.BuiltInFuncRootNode;
import com.endoflineblog.truffle.part_12.nodes.root.StmtBlockRootNode;
import com.endoflineblog.truffle.part_12.parsing.EasyScriptTruffleParser;
import com.endoflineblog.truffle.part_12.parsing.ParsingResult;
import com.endoflineblog.truffle.part_12.runtime.JavaScriptObject;
import com.endoflineblog.truffle.part_12.nodes.exprs.functions.ReadFunctionArgExprNode;
import com.endoflineblog.truffle.part_12.nodes.exprs.functions.built_in.AbsFunctionBodyExprNodeFactory;
import com.endoflineblog.truffle.part_12.nodes.exprs.functions.built_in.BuiltInFunctionBodyExprNode;
import com.endoflineblog.truffle.part_12.nodes.exprs.functions.built_in.PowFunctionBodyExprNodeFactory;
import com.endoflineblog.truffle.part_12.nodes.exprs.functions.built_in.methods.CharAtMethodBodyExprNodeFactory;
import com.endoflineblog.truffle.part_12.runtime.ArrayObject;
import com.endoflineblog.truffle.part_12.runtime.ClassPrototypeObject;
import com.endoflineblog.truffle.part_12.runtime.FunctionObject;
import com.endoflineblog.truffle.part_12.runtime.GlobalScopeObject;
import com.oracle.truffle.api.CallTarget;
import com.oracle.truffle.api.TruffleLanguage;
import com.oracle.truffle.api.dsl.NodeFactory;
Expand All @@ -30,11 +30,11 @@
* Very similar to the class with the same name from part 11,
* the only difference is that we rename the field {@code globalScopeShape}
* to {@code rootShape}, as it's now used as the {@link Shape}
* of the {@link com.endoflineblog.truffle.part_13.runtime.ClassPrototypeObject}
* of the {@link com.endoflineblog.truffle.part_12.runtime.ClassPrototypeObject}
* {@link com.oracle.truffle.api.object.DynamicObject},
* in addition to the {@link com.endoflineblog.truffle.part_13.runtime.GlobalScopeObject},
* in addition to the {@link com.endoflineblog.truffle.part_12.runtime.GlobalScopeObject},
* and we also pass it to the
* {@link com.endoflineblog.truffle.part_13.parsing.EasyScriptTruffleParser#parse main parsing method}.
* {@link com.endoflineblog.truffle.part_12.parsing.EasyScriptTruffleParser#parse main parsing method}.
*/
@TruffleLanguage.Registration(id = "ezs", name = "EasyScript")
public final class EasyScriptTruffleLanguage extends TruffleLanguage<EasyScriptLanguageContext> {
Expand All @@ -50,8 +50,8 @@ public static EasyScriptTruffleLanguage get(Node node) {
private final Shape arrayShape = Shape.newBuilder().layout(ArrayObject.class).build();

/**
* The root {@link Shape} for {@link com.endoflineblog.truffle.part_13.runtime.GlobalScopeObject}
* and {@link com.endoflineblog.truffle.part_13.runtime.ClassPrototypeObject}.
* The root {@link Shape} for {@link com.endoflineblog.truffle.part_12.runtime.GlobalScopeObject}
* and {@link com.endoflineblog.truffle.part_12.runtime.ClassPrototypeObject}.
*/
private final Shape rootShape = Shape.newBuilder().build();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.endoflineblog.truffle.part_13;
package com.endoflineblog.truffle.part_12;

import com.oracle.truffle.api.dsl.ImplicitCast;
import com.oracle.truffle.api.dsl.TypeSystem;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.endoflineblog.truffle.part_13.common;
package com.endoflineblog.truffle.part_12.common;

import com.endoflineblog.truffle.part_13.exceptions.EasyScriptException;
import com.endoflineblog.truffle.part_12.exceptions.EasyScriptException;

/**
* An enum that represents the different kinds of variable declarations in JavaScript.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.endoflineblog.truffle.part_13.common;
package com.endoflineblog.truffle.part_12.common;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.endoflineblog.truffle.part_13.common;
package com.endoflineblog.truffle.part_12.common;

import com.endoflineblog.truffle.part_13.runtime.ClassPrototypeObject;
import com.endoflineblog.truffle.part_12.runtime.ClassPrototypeObject;
import com.oracle.truffle.api.object.Shape;

/**
* This class holds the {@link Shape}s and {@link ClassPrototypeObject}s
* that are used by various EasyScript {@link com.oracle.truffle.api.nodes.Node}s.
* They get access to this class through the
* {@link com.endoflineblog.truffle.part_13.EasyScriptLanguageContext EasyScript TruffleLanguage context}.
* {@link com.endoflineblog.truffle.part_12.EasyScriptLanguageContext EasyScript TruffleLanguage context}.
*/
public final class ShapesAndPrototypes {
public final Shape rootShape;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.endoflineblog.truffle.part_13.exceptions;
package com.endoflineblog.truffle.part_12.exceptions;

import com.oracle.truffle.api.nodes.ControlFlowException;

/**
* The exception used to implement the {@code break} statement.
* Identical to the class with the same name from part 11.
*
* @see com.endoflineblog.truffle.part_13.nodes.stmts.controlflow.BreakStmtNode
* @see com.endoflineblog.truffle.part_12.nodes.stmts.controlflow.BreakStmtNode
*/
public final class BreakException extends ControlFlowException {
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.endoflineblog.truffle.part_13.exceptions;
package com.endoflineblog.truffle.part_12.exceptions;

import com.oracle.truffle.api.nodes.ControlFlowException;

/**
* The exception used to implement the {@code continue} statement.
* Identical to the class with the same name from part 11.
*
* @see com.endoflineblog.truffle.part_13.nodes.stmts.controlflow.ContinueStmtNode
* @see com.endoflineblog.truffle.part_12.nodes.stmts.controlflow.ContinueStmtNode
*/
public final class ContinueException extends ControlFlowException {
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.endoflineblog.truffle.part_13.exceptions;
package com.endoflineblog.truffle.part_12.exceptions;

import com.oracle.truffle.api.exception.AbstractTruffleException;
import com.oracle.truffle.api.nodes.Node;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package com.endoflineblog.truffle.part_13.exceptions;
package com.endoflineblog.truffle.part_12.exceptions;

import com.oracle.truffle.api.nodes.ControlFlowException;

/**
* The exception used to implement the {@code return} statement.
* Identical to the class with the same name from part 11.
*
* @see com.endoflineblog.truffle.part_13.nodes.stmts.controlflow.ReturnStmtNode
* @see com.endoflineblog.truffle.part_12.nodes.stmts.controlflow.ReturnStmtNode
*/
public final class ReturnException extends ControlFlowException {
/** The value to return from the function. */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.endoflineblog.truffle.part_13.nodes;
package com.endoflineblog.truffle.part_12.nodes;

import com.endoflineblog.truffle.part_13.EasyScriptLanguageContext;
import com.endoflineblog.truffle.part_13.EasyScriptTruffleLanguage;
import com.endoflineblog.truffle.part_12.EasyScriptLanguageContext;
import com.endoflineblog.truffle.part_12.EasyScriptTruffleLanguage;
import com.oracle.truffle.api.nodes.Node;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.endoflineblog.truffle.part_13.nodes.exprs;
package com.endoflineblog.truffle.part_12.nodes.exprs;

import com.oracle.truffle.api.dsl.NodeChild;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.endoflineblog.truffle.part_13.nodes.exprs;
package com.endoflineblog.truffle.part_12.nodes.exprs;

import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.object.DynamicObject;

/**
* A simple expression Node that just returns the given {@link DynamicObject}.
* Used for handling methods inside class declarations,
* by passing an instance of {@link com.endoflineblog.truffle.part_13.runtime.ClassPrototypeObject}
* by passing an instance of {@link com.endoflineblog.truffle.part_12.runtime.ClassPrototypeObject}
* to the constructor of this class,
* and then passing the instance created from that constructor to
* {@link com.endoflineblog.truffle.part_13.nodes.stmts.variables.FuncDeclStmtNode}.
* {@link com.endoflineblog.truffle.part_12.nodes.stmts.variables.FuncDeclStmtNode}.
*/
public final class DynamicObjectReferenceExprNode extends EasyScriptExprNode {
private final DynamicObject dynamicObject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package com.endoflineblog.truffle.part_13.nodes.exprs;
package com.endoflineblog.truffle.part_12.nodes.exprs;

import com.endoflineblog.truffle.part_13.EasyScriptTypeSystem;
import com.endoflineblog.truffle.part_13.EasyScriptTypeSystemGen;
import com.endoflineblog.truffle.part_13.nodes.EasyScriptNode;
import com.endoflineblog.truffle.part_13.runtime.Undefined;
import com.endoflineblog.truffle.part_12.EasyScriptTypeSystem;
import com.endoflineblog.truffle.part_12.nodes.EasyScriptNode;
import com.endoflineblog.truffle.part_12.nodes.exprs.functions.FunctionCallExprNode;
import com.endoflineblog.truffle.part_12.runtime.Undefined;
import com.endoflineblog.truffle.part_12.EasyScriptTypeSystemGen;
import com.oracle.truffle.api.dsl.TypeSystemReference;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.UnexpectedResultException;
Expand Down Expand Up @@ -54,7 +55,7 @@ public double executeDouble(VirtualFrame frame) throws UnexpectedResultException
* that is used for function and method calls.
* It returns the value that should be used as the receiver of the given function call
* (the {@code this} variable).
* Used in {@link com.endoflineblog.truffle.part_13.nodes.exprs.functions.FunctionCallExprNode},
* Used in {@link FunctionCallExprNode},
* alongside {@link #evaluateAsFunction}.
*/
public Object evaluateAsReceiver(VirtualFrame frame) {
Expand All @@ -66,7 +67,7 @@ public Object evaluateAsReceiver(VirtualFrame frame) {
/**
* A more fine-grained alternative to {@link #executeGeneric}
* that is used for function and method calls.
* Used in {@link com.endoflineblog.truffle.part_13.nodes.exprs.functions.FunctionCallExprNode},
* Used in {@link FunctionCallExprNode},
* alongside {@link #evaluateAsReceiver}.
*/
public Object evaluateAsFunction(VirtualFrame frame, Object receiver) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.endoflineblog.truffle.part_13.nodes.exprs;
package com.endoflineblog.truffle.part_12.nodes.exprs;

import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.object.DynamicObject;

/**
* A simple expression class that returns the
* {@link com.endoflineblog.truffle.part_13.runtime.GlobalScopeObject global scope object}
* {@link com.endoflineblog.truffle.part_12.runtime.GlobalScopeObject global scope object}
* using the inherited {@link #currentLanguageContext()} method from
* {@link com.endoflineblog.truffle.part_13.nodes.EasyScriptNode}.
* {@link com.endoflineblog.truffle.part_12.nodes.EasyScriptNode}.
* Used by classes that access the global scope,
* like global variable declaration or assignment,
* so that they can have this Node as a child,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.endoflineblog.truffle.part_13.nodes.exprs.arithmetic;
package com.endoflineblog.truffle.part_12.nodes.exprs.arithmetic;

import com.endoflineblog.truffle.part_13.EasyScriptTypeSystemGen;
import com.endoflineblog.truffle.part_13.nodes.exprs.BinaryOperationExprNode;
import com.endoflineblog.truffle.part_13.runtime.EasyScriptTruffleStrings;
import com.endoflineblog.truffle.part_13.runtime.Undefined;
import com.endoflineblog.truffle.part_12.EasyScriptTypeSystemGen;
import com.endoflineblog.truffle.part_12.nodes.exprs.BinaryOperationExprNode;
import com.endoflineblog.truffle.part_12.runtime.EasyScriptTruffleStrings;
import com.endoflineblog.truffle.part_12.runtime.Undefined;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.Specialization;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.endoflineblog.truffle.part_13.nodes.exprs.arithmetic;
package com.endoflineblog.truffle.part_12.nodes.exprs.arithmetic;

import com.endoflineblog.truffle.part_13.nodes.exprs.EasyScriptExprNode;
import com.endoflineblog.truffle.part_12.nodes.exprs.EasyScriptExprNode;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.NodeChild;
import com.oracle.truffle.api.dsl.Specialization;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.endoflineblog.truffle.part_13.nodes.exprs.arithmetic;
package com.endoflineblog.truffle.part_12.nodes.exprs.arithmetic;

import com.endoflineblog.truffle.part_13.nodes.exprs.BinaryOperationExprNode;
import com.endoflineblog.truffle.part_12.nodes.exprs.BinaryOperationExprNode;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.Specialization;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.endoflineblog.truffle.part_13.nodes.exprs.arrays;
package com.endoflineblog.truffle.part_12.nodes.exprs.arrays;

import com.endoflineblog.truffle.part_13.nodes.exprs.EasyScriptExprNode;
import com.endoflineblog.truffle.part_13.nodes.exprs.properties.CommonReadPropertyNode;
import com.endoflineblog.truffle.part_13.nodes.exprs.properties.CommonReadPropertyNodeGen;
import com.endoflineblog.truffle.part_13.runtime.EasyScriptTruffleStrings;
import com.endoflineblog.truffle.part_12.nodes.exprs.EasyScriptExprNode;
import com.endoflineblog.truffle.part_12.nodes.exprs.properties.CommonReadPropertyNode;
import com.endoflineblog.truffle.part_12.nodes.exprs.properties.CommonReadPropertyNodeGen;
import com.endoflineblog.truffle.part_12.runtime.EasyScriptTruffleStrings;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Fallback;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.endoflineblog.truffle.part_13.nodes.exprs.arrays;
package com.endoflineblog.truffle.part_12.nodes.exprs.arrays;

import com.endoflineblog.truffle.part_13.exceptions.EasyScriptException;
import com.endoflineblog.truffle.part_13.nodes.exprs.EasyScriptExprNode;
import com.endoflineblog.truffle.part_13.nodes.exprs.properties.CommonWritePropertyNode;
import com.endoflineblog.truffle.part_12.exceptions.EasyScriptException;
import com.endoflineblog.truffle.part_12.nodes.exprs.EasyScriptExprNode;
import com.endoflineblog.truffle.part_12.nodes.exprs.properties.CommonWritePropertyNode;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.NodeChild;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.endoflineblog.truffle.part_13.nodes.exprs.arrays;
package com.endoflineblog.truffle.part_12.nodes.exprs.arrays;

import com.endoflineblog.truffle.part_13.common.ShapesAndPrototypes;
import com.endoflineblog.truffle.part_13.nodes.exprs.EasyScriptExprNode;
import com.endoflineblog.truffle.part_13.runtime.ArrayObject;
import com.endoflineblog.truffle.part_12.common.ShapesAndPrototypes;
import com.endoflineblog.truffle.part_12.nodes.exprs.EasyScriptExprNode;
import com.endoflineblog.truffle.part_12.runtime.ArrayObject;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.nodes.ExplodeLoop;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.endoflineblog.truffle.part_13.nodes.exprs.comparisons;
package com.endoflineblog.truffle.part_12.nodes.exprs.comparisons;

import com.endoflineblog.truffle.part_13.nodes.exprs.BinaryOperationExprNode;
import com.endoflineblog.truffle.part_13.runtime.EasyScriptTruffleStrings;
import com.endoflineblog.truffle.part_12.nodes.exprs.BinaryOperationExprNode;
import com.endoflineblog.truffle.part_12.runtime.EasyScriptTruffleStrings;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.Specialization;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.endoflineblog.truffle.part_13.nodes.exprs.comparisons;
package com.endoflineblog.truffle.part_12.nodes.exprs.comparisons;

import com.endoflineblog.truffle.part_13.nodes.exprs.BinaryOperationExprNode;
import com.endoflineblog.truffle.part_12.nodes.exprs.BinaryOperationExprNode;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.Specialization;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.endoflineblog.truffle.part_13.nodes.exprs.comparisons;
package com.endoflineblog.truffle.part_12.nodes.exprs.comparisons;

import com.endoflineblog.truffle.part_13.nodes.exprs.BinaryOperationExprNode;
import com.endoflineblog.truffle.part_12.nodes.exprs.BinaryOperationExprNode;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.Specialization;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.endoflineblog.truffle.part_13.nodes.exprs.comparisons;
package com.endoflineblog.truffle.part_12.nodes.exprs.comparisons;

import com.endoflineblog.truffle.part_13.nodes.exprs.BinaryOperationExprNode;
import com.endoflineblog.truffle.part_13.runtime.EasyScriptTruffleStrings;
import com.endoflineblog.truffle.part_12.nodes.exprs.BinaryOperationExprNode;
import com.endoflineblog.truffle.part_12.runtime.EasyScriptTruffleStrings;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.Specialization;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.endoflineblog.truffle.part_13.nodes.exprs.comparisons;
package com.endoflineblog.truffle.part_12.nodes.exprs.comparisons;

import com.endoflineblog.truffle.part_13.nodes.exprs.BinaryOperationExprNode;
import com.endoflineblog.truffle.part_12.nodes.exprs.BinaryOperationExprNode;
import com.oracle.truffle.api.dsl.Cached;
import com.oracle.truffle.api.dsl.Fallback;
import com.oracle.truffle.api.dsl.Specialization;
Expand Down
Loading

0 comments on commit b83088b

Please sign in to comment.