+AST nodes for the JLang language extension. +
+ diff --git a/compiler/src/polyllvm/extension/PolyLLVMAddressOfExt.java b/compiler/src/jlang/extension/JLangAddressOfExt.java similarity index 66% rename from compiler/src/polyllvm/extension/PolyLLVMAddressOfExt.java rename to compiler/src/jlang/extension/JLangAddressOfExt.java index 3b07138f..8d3210c3 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMAddressOfExt.java +++ b/compiler/src/jlang/extension/JLangAddressOfExt.java @@ -1,13 +1,14 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.Node; -import polyllvm.ast.AddressOf; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.LLVMTranslator; import static org.bytedeco.javacpp.LLVM.LLVMValueRef; -public class PolyLLVMAddressOfExt extends PolyLLVMExt { +import jlang.ast.AddressOf; +import jlang.ast.JLangExt; +import jlang.visit.LLVMTranslator; + +public class JLangAddressOfExt extends JLangExt { @Override public Node overrideTranslateLLVM(Node parent, LLVMTranslator v) { diff --git a/compiler/src/polyllvm/extension/PolyLLVMAnnotationElemExt.java b/compiler/src/jlang/extension/JLangAnnotationElemExt.java similarity index 72% rename from compiler/src/polyllvm/extension/PolyLLVMAnnotationElemExt.java rename to compiler/src/jlang/extension/JLangAnnotationElemExt.java index b5341c64..b0e81483 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMAnnotationElemExt.java +++ b/compiler/src/jlang/extension/JLangAnnotationElemExt.java @@ -1,10 +1,10 @@ -package polyllvm.extension; +package jlang.extension; +import jlang.ast.JLangExt; +import jlang.visit.LLVMTranslator; import polyglot.ast.Node; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.LLVMTranslator; -public class PolyLLVMAnnotationElemExt extends PolyLLVMExt { +public class JLangAnnotationElemExt extends JLangExt { @Override public Node overrideTranslateLLVM(Node parent, LLVMTranslator v) { diff --git a/compiler/src/polyllvm/extension/PolyLLVMArrayAccessExt.java b/compiler/src/jlang/extension/JLangArrayAccessExt.java similarity index 91% rename from compiler/src/polyllvm/extension/PolyLLVMArrayAccessExt.java rename to compiler/src/jlang/extension/JLangArrayAccessExt.java index ab98ed9c..fda22a44 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMArrayAccessExt.java +++ b/compiler/src/jlang/extension/JLangArrayAccessExt.java @@ -1,4 +1,4 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.*; import polyglot.types.ClassType; @@ -7,17 +7,18 @@ import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.util.SerialVersionUID; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.DesugarLocally; -import polyllvm.visit.LLVMTranslator; import java.util.Arrays; import java.util.Collections; +import jlang.ast.JLangExt; +import jlang.visit.DesugarLocally; +import jlang.visit.LLVMTranslator; + import static org.bytedeco.javacpp.LLVM.LLVMBuildLoad; import static org.bytedeco.javacpp.LLVM.LLVMValueRef; -public class PolyLLVMArrayAccessExt extends PolyLLVMExt { +public class JLangArrayAccessExt extends JLangExt { private static final long serialVersionUID = SerialVersionUID.generate(); /** Whether this array access is already guarded by an index bounds check. */ @@ -33,11 +34,11 @@ public ArrayAccess setGuarded() { } public ArrayAccess setGuarded(ArrayAccess c) { - PolyLLVMArrayAccessExt ext = (PolyLLVMArrayAccessExt) PolyLLVMExt.ext(c); + JLangArrayAccessExt ext = (JLangArrayAccessExt) JLangExt.ext(c); if (ext.guarded) return c; if (c == node) { c = Copy.Util.copy(c); - ext = (PolyLLVMArrayAccessExt) PolyLLVMExt.ext(c); + ext = (JLangArrayAccessExt) JLangExt.ext(c); } ext.guarded = true; return c; diff --git a/compiler/src/polyllvm/extension/PolyLLVMArrayInitExt.java b/compiler/src/jlang/extension/JLangArrayInitExt.java similarity index 85% rename from compiler/src/polyllvm/extension/PolyLLVMArrayInitExt.java rename to compiler/src/jlang/extension/JLangArrayInitExt.java index 754be8c8..1c28d3fa 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMArrayInitExt.java +++ b/compiler/src/jlang/extension/JLangArrayInitExt.java @@ -1,4 +1,4 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.ArrayInit; import polyglot.ast.Expr; @@ -6,14 +6,15 @@ import polyglot.types.Type; import polyglot.util.InternalCompilerError; import polyglot.util.SerialVersionUID; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.LLVMTranslator; import java.lang.Override; +import jlang.ast.JLangExt; +import jlang.visit.LLVMTranslator; + import static org.bytedeco.javacpp.LLVM.*; -public class PolyLLVMArrayInitExt extends PolyLLVMExt { +public class JLangArrayInitExt extends JLangExt { private static final long serialVersionUID = SerialVersionUID.generate(); @Override @@ -29,7 +30,7 @@ public Node leaveTranslateLLVM(LLVMTranslator v) { LLVMValueRef len = LLVMConstInt( v.utils.toLL(v.ts.Int()), n.elements().size(), /*signExtend*/ 0); - LLVMValueRef array = PolyLLVMNewArrayExt.translateNewArray(v, len, elemType); + LLVMValueRef array = JLangNewArrayExt.translateNewArray(v, len, elemType); if (!n.elements().isEmpty()) { LLVMValueRef base = v.obj.buildArrayBaseElementPtr(array, n.type().toArray()); diff --git a/compiler/src/polyllvm/extension/PolyLLVMAssertExt.java b/compiler/src/jlang/extension/JLangAssertExt.java similarity index 82% rename from compiler/src/polyllvm/extension/PolyLLVMAssertExt.java rename to compiler/src/jlang/extension/JLangAssertExt.java index 8c9b0ebe..e47144e4 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMAssertExt.java +++ b/compiler/src/jlang/extension/JLangAssertExt.java @@ -1,4 +1,4 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.Assert; import polyglot.ast.Expr; @@ -6,14 +6,15 @@ import polyglot.main.Options; import polyglot.util.InternalCompilerError; import polyglot.util.Position; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.DesugarLocally; -import polyllvm.visit.LLVMTranslator; import java.util.Collections; import java.util.List; -public class PolyLLVMAssertExt extends PolyLLVMExt { +import jlang.ast.JLangExt; +import jlang.visit.DesugarLocally; +import jlang.visit.LLVMTranslator; + +public class JLangAssertExt extends JLangExt { @Override public Node leaveTranslateLLVM(LLVMTranslator v) { diff --git a/compiler/src/polyllvm/extension/PolyLLVMAssignExt.java b/compiler/src/jlang/extension/JLangAssignExt.java similarity index 93% rename from compiler/src/polyllvm/extension/PolyLLVMAssignExt.java rename to compiler/src/jlang/extension/JLangAssignExt.java index 73de0954..53b6e60d 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMAssignExt.java +++ b/compiler/src/jlang/extension/JLangAssignExt.java @@ -1,19 +1,20 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.*; import polyglot.util.InternalCompilerError; import polyglot.util.Position; import polyglot.util.SerialVersionUID; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.DesugarLocally; -import polyllvm.visit.LLVMTranslator; import java.util.Arrays; +import jlang.ast.JLangExt; +import jlang.visit.DesugarLocally; +import jlang.visit.LLVMTranslator; + import static org.bytedeco.javacpp.LLVM.LLVMBuildStore; import static org.bytedeco.javacpp.LLVM.LLVMValueRef; -public class PolyLLVMAssignExt extends PolyLLVMExt { +public class JLangAssignExt extends JLangExt { private static final long serialVersionUID = SerialVersionUID.generate(); @Override diff --git a/compiler/src/polyllvm/extension/PolyLLVMBinaryExt.java b/compiler/src/jlang/extension/JLangBinaryExt.java similarity index 97% rename from compiler/src/polyllvm/extension/PolyLLVMBinaryExt.java rename to compiler/src/jlang/extension/JLangBinaryExt.java index b368bb68..899d1532 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMBinaryExt.java +++ b/compiler/src/jlang/extension/JLangBinaryExt.java @@ -1,4 +1,4 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.Binary; import polyglot.ast.Binary.*; @@ -7,17 +7,18 @@ import polyglot.types.Type; import polyglot.util.InternalCompilerError; import polyglot.util.SerialVersionUID; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.DesugarLocally; -import polyllvm.visit.LLVMTranslator; import java.lang.Override; import java.util.Arrays; +import jlang.ast.JLangExt; +import jlang.visit.DesugarLocally; +import jlang.visit.LLVMTranslator; + import static org.bytedeco.javacpp.LLVM.*; import static polyglot.ast.Binary.*; -public class PolyLLVMBinaryExt extends PolyLLVMExt { +public class JLangBinaryExt extends JLangExt { private static final long serialVersionUID = SerialVersionUID.generate(); @Override diff --git a/compiler/src/polyllvm/extension/PolyLLVMBooleanLitExt.java b/compiler/src/jlang/extension/JLangBooleanLitExt.java similarity index 85% rename from compiler/src/polyllvm/extension/PolyLLVMBooleanLitExt.java rename to compiler/src/jlang/extension/JLangBooleanLitExt.java index 9e43be72..9f3eae0e 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMBooleanLitExt.java +++ b/compiler/src/jlang/extension/JLangBooleanLitExt.java @@ -1,14 +1,15 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.BooleanLit; import polyglot.ast.Node; import polyglot.util.SerialVersionUID; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.LLVMTranslator; import static org.bytedeco.javacpp.LLVM.*; -public class PolyLLVMBooleanLitExt extends PolyLLVMExt { +import jlang.ast.JLangExt; +import jlang.visit.LLVMTranslator; + +public class JLangBooleanLitExt extends JLangExt { private static final long serialVersionUID = SerialVersionUID.generate(); @Override diff --git a/compiler/src/polyllvm/extension/PolyLLVMBranchExt.java b/compiler/src/jlang/extension/JLangBranchExt.java similarity index 83% rename from compiler/src/polyllvm/extension/PolyLLVMBranchExt.java rename to compiler/src/jlang/extension/JLangBranchExt.java index 662cf4ce..83becadd 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMBranchExt.java +++ b/compiler/src/jlang/extension/JLangBranchExt.java @@ -1,14 +1,15 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.Branch; import polyglot.ast.Node; import polyglot.util.SerialVersionUID; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.LLVMTranslator; import static org.bytedeco.javacpp.LLVM.LLVMBuildBr; -public class PolyLLVMBranchExt extends PolyLLVMExt { +import jlang.ast.JLangExt; +import jlang.visit.LLVMTranslator; + +public class JLangBranchExt extends JLangExt { private static final long serialVersionUID = SerialVersionUID.generate(); @Override diff --git a/compiler/src/polyllvm/extension/PolyLLVMCallExt.java b/compiler/src/jlang/extension/JLangCallExt.java similarity index 94% rename from compiler/src/polyllvm/extension/PolyLLVMCallExt.java rename to compiler/src/jlang/extension/JLangCallExt.java index 9dc29203..fb6a58a5 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMCallExt.java +++ b/compiler/src/jlang/extension/JLangCallExt.java @@ -1,6 +1,10 @@ -package polyllvm.extension; +package jlang.extension; import org.bytedeco.javacpp.LLVM.*; + +import jlang.ast.JLangExt; +import jlang.visit.LLVMTranslator; +import jlang.visit.LLVMTranslator.DispatchInfo; import polyglot.ast.Call; import polyglot.ast.Node; import polyglot.ast.Special; @@ -8,15 +12,12 @@ import polyglot.util.Copy; import polyglot.util.SerialVersionUID; import polyglot.visit.TypeChecker; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.LLVMTranslator; -import polyllvm.visit.LLVMTranslator.DispatchInfo; import java.lang.Override; import static org.bytedeco.javacpp.LLVM.*; -public class PolyLLVMCallExt extends PolyLLVMProcedureCallExt { +public class JLangCallExt extends JLangProcedureCallExt { private static final long serialVersionUID = SerialVersionUID.generate(); /** @@ -41,7 +42,7 @@ public Node leaveTranslateLLVM(LLVMTranslator v) { /** Sets {@link this#direct} appropriately. */ public Call determineIfDirect(Call c) { - PolyLLVMCallExt ext = (PolyLLVMCallExt) PolyLLVMExt.ext(c); + JLangCallExt ext = (JLangCallExt) JLangExt.ext(c); if (ext.direct) return c; // Should always remain direct once set. boolean direct = false; @@ -66,7 +67,7 @@ public Call determineIfDirect(Call c) { if (!direct) return c; if (c == node) { c = Copy.Util.copy(c); - ext = (PolyLLVMCallExt) PolyLLVMExt.ext(c); + ext = (JLangCallExt) JLangExt.ext(c); } ext.direct = true; return c; diff --git a/compiler/src/polyllvm/extension/PolyLLVMCastExt.java b/compiler/src/jlang/extension/JLangCastExt.java similarity index 95% rename from compiler/src/polyllvm/extension/PolyLLVMCastExt.java rename to compiler/src/jlang/extension/JLangCastExt.java index 0df4f06c..ab5edcb7 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMCastExt.java +++ b/compiler/src/jlang/extension/JLangCastExt.java @@ -1,4 +1,4 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.*; import polyglot.types.*; @@ -7,17 +7,18 @@ import polyglot.util.Position; import polyglot.util.SerialVersionUID; import polyglot.visit.AscriptionVisitor; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.util.Constants; -import polyllvm.visit.LLVMTranslator; -import polyllvm.visit.DesugarLocally; import java.lang.Override; import java.util.Arrays; import java.util.Collections; +import jlang.ast.JLangExt; +import jlang.util.Constants; +import jlang.visit.DesugarLocally; +import jlang.visit.LLVMTranslator; + +import static jlang.extension.JLangCastExt.ConversionContext.*; import static org.bytedeco.javacpp.LLVM.*; -import static polyllvm.extension.PolyLLVMCastExt.ConversionContext.*; /** * We use cast nodes to model both explicit user-added casts and implicit conversions. @@ -34,7 +35,7 @@ * Polyglot claims a conversion is necessary, and then we emit conversion * code when translating {@link Cast} nodes here. */ -public class PolyLLVMCastExt extends PolyLLVMExt { +public class JLangCastExt extends JLangExt { private static final long serialVersionUID = SerialVersionUID.generate(); /** Conversion context, as specified by the JLS. */ @@ -54,11 +55,11 @@ public Cast context(ConversionContext context) { } public Cast context(Cast c, ConversionContext context) { - PolyLLVMCastExt ext = (PolyLLVMCastExt) PolyLLVMExt.ext(c); + JLangCastExt ext = (JLangCastExt) JLangExt.ext(c); if (ext.context == context) return c; if (c == node) { c = Copy.Util.copy(c); - ext = (PolyLLVMCastExt) PolyLLVMExt.ext(c); + ext = (JLangCastExt) JLangExt.ext(c); } ext.context = context; return c; diff --git a/compiler/src/polyllvm/extension/PolyLLVMCharLitExt.java b/compiler/src/jlang/extension/JLangCharLitExt.java similarity index 77% rename from compiler/src/polyllvm/extension/PolyLLVMCharLitExt.java rename to compiler/src/jlang/extension/JLangCharLitExt.java index 40d8f3ee..c452abca 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMCharLitExt.java +++ b/compiler/src/jlang/extension/JLangCharLitExt.java @@ -1,14 +1,15 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.CharLit; import polyglot.ast.Node; import polyglot.util.SerialVersionUID; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.LLVMTranslator; import static org.bytedeco.javacpp.LLVM.*; -public class PolyLLVMCharLitExt extends PolyLLVMExt { +import jlang.ast.JLangExt; +import jlang.visit.LLVMTranslator; + +public class JLangCharLitExt extends JLangExt { private static final long serialVersionUID = SerialVersionUID.generate(); @Override diff --git a/compiler/src/polyllvm/extension/PolyLLVMClassDeclExt.java b/compiler/src/jlang/extension/JLangClassDeclExt.java similarity index 98% rename from compiler/src/polyllvm/extension/PolyLLVMClassDeclExt.java rename to compiler/src/jlang/extension/JLangClassDeclExt.java index 68e7d54a..9f1fe8f5 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMClassDeclExt.java +++ b/compiler/src/jlang/extension/JLangClassDeclExt.java @@ -1,13 +1,14 @@ -package polyllvm.extension; +package jlang.extension; import org.bytedeco.javacpp.LLVM.*; + +import jlang.ast.JLangExt; +import jlang.util.Constants; +import jlang.util.LLVMUtils; +import jlang.visit.LLVMTranslator; import polyglot.ast.*; import polyglot.types.*; import polyglot.util.SerialVersionUID; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.util.Constants; -import polyllvm.util.LLVMUtils; -import polyllvm.visit.LLVMTranslator; import java.lang.Override; import java.util.Collections; @@ -16,10 +17,10 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +import static jlang.util.Constants.REGISTER_CLASS_FUNC; import static org.bytedeco.javacpp.LLVM.*; -import static polyllvm.util.Constants.REGISTER_CLASS_FUNC; -public class PolyLLVMClassDeclExt extends PolyLLVMExt { +public class JLangClassDeclExt extends JLangExt { private static final long serialVersionUID = SerialVersionUID.generate(); @Override diff --git a/compiler/src/polyllvm/extension/PolyLLVMClassLitExt.java b/compiler/src/jlang/extension/JLangClassLitExt.java similarity index 93% rename from compiler/src/polyllvm/extension/PolyLLVMClassLitExt.java rename to compiler/src/jlang/extension/JLangClassLitExt.java index 7ce23da4..26d57131 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMClassLitExt.java +++ b/compiler/src/jlang/extension/JLangClassLitExt.java @@ -1,6 +1,10 @@ -package polyllvm.extension; +package jlang.extension; import org.bytedeco.javacpp.LLVM.LLVMValueRef; + +import jlang.ast.JLangExt; +import jlang.visit.DesugarLocally; +import jlang.visit.LLVMTranslator; import polyglot.ast.ClassLit; import polyglot.ast.Expr; import polyglot.ast.Node; @@ -9,11 +13,8 @@ import polyglot.types.Type; import polyglot.util.InternalCompilerError; import polyglot.util.Position; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.DesugarLocally; -import polyllvm.visit.LLVMTranslator; -public class PolyLLVMClassLitExt extends PolyLLVMExt { +public class JLangClassLitExt extends JLangExt { @Override public Node leaveTranslateLLVM(LLVMTranslator v) { diff --git a/compiler/src/polyllvm/extension/PolyLLVMConditionalExt.java b/compiler/src/jlang/extension/JLangConditionalExt.java similarity index 88% rename from compiler/src/polyllvm/extension/PolyLLVMConditionalExt.java rename to compiler/src/jlang/extension/JLangConditionalExt.java index ca5b4a3b..654790cb 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMConditionalExt.java +++ b/compiler/src/jlang/extension/JLangConditionalExt.java @@ -1,16 +1,17 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.Conditional; import polyglot.ast.Expr; import polyglot.ast.Node; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.LLVMTranslator; import java.util.function.BiConsumer; +import jlang.ast.JLangExt; +import jlang.visit.LLVMTranslator; + import static org.bytedeco.javacpp.LLVM.*; -public class PolyLLVMConditionalExt extends PolyLLVMExt { +public class JLangConditionalExt extends JLangExt { @Override public Node overrideTranslateLLVM(Node parent, LLVMTranslator v) { diff --git a/compiler/src/polyllvm/extension/PolyLLVMConstructorCallExt.java b/compiler/src/jlang/extension/JLangConstructorCallExt.java similarity index 86% rename from compiler/src/polyllvm/extension/PolyLLVMConstructorCallExt.java rename to compiler/src/jlang/extension/JLangConstructorCallExt.java index caad0123..acd3ea0d 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMConstructorCallExt.java +++ b/compiler/src/jlang/extension/JLangConstructorCallExt.java @@ -1,15 +1,16 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.ConstructorCall; import polyglot.ast.Node; import polyglot.util.InternalCompilerError; import polyglot.util.SerialVersionUID; -import polyllvm.visit.LLVMTranslator; import static org.bytedeco.javacpp.LLVM.LLVMGetParam; import static org.bytedeco.javacpp.LLVM.LLVMValueRef; -public class PolyLLVMConstructorCallExt extends PolyLLVMProcedureCallExt { +import jlang.visit.LLVMTranslator; + +public class JLangConstructorCallExt extends JLangProcedureCallExt { private static final long serialVersionUID = SerialVersionUID.generate(); @Override diff --git a/compiler/src/polyllvm/extension/PolyLLVMDesugaredNodeExt.java b/compiler/src/jlang/extension/JLangDesugaredNodeExt.java similarity index 69% rename from compiler/src/polyllvm/extension/PolyLLVMDesugaredNodeExt.java rename to compiler/src/jlang/extension/JLangDesugaredNodeExt.java index 71f43b22..428dbf10 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMDesugaredNodeExt.java +++ b/compiler/src/jlang/extension/JLangDesugaredNodeExt.java @@ -1,11 +1,11 @@ -package polyllvm.extension; +package jlang.extension; +import jlang.ast.JLangExt; +import jlang.visit.LLVMTranslator; import polyglot.ast.Node; import polyglot.util.InternalCompilerError; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.LLVMTranslator; -public class PolyLLVMDesugaredNodeExt extends PolyLLVMExt { +public class JLangDesugaredNodeExt extends JLangExt { private static final String errorMsg = "This node should be desugared before translating to LLVM IR"; diff --git a/compiler/src/polyllvm/extension/PolyLLVMDoExt.java b/compiler/src/jlang/extension/JLangDoExt.java similarity index 90% rename from compiler/src/polyllvm/extension/PolyLLVMDoExt.java rename to compiler/src/jlang/extension/JLangDoExt.java index 86e6587f..d984d0d9 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMDoExt.java +++ b/compiler/src/jlang/extension/JLangDoExt.java @@ -1,17 +1,18 @@ -package polyllvm.extension; +package jlang.extension; import org.bytedeco.javacpp.LLVM.LLVMBasicBlockRef; + +import jlang.ast.JLangExt; +import jlang.visit.LLVMTranslator; import polyglot.ast.Do; import polyglot.ast.Labeled; import polyglot.ast.Node; import polyglot.util.SerialVersionUID; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.LLVMTranslator; import static org.bytedeco.javacpp.LLVM.LLVMBuildBr; import static org.bytedeco.javacpp.LLVM.LLVMPositionBuilderAtEnd; -public class PolyLLVMDoExt extends PolyLLVMExt { +public class JLangDoExt extends JLangExt { private static final long serialVersionUID = SerialVersionUID.generate(); @Override diff --git a/compiler/src/polyllvm/extension/PolyLLVMEseqExt.java b/compiler/src/jlang/extension/JLangEseqExt.java similarity index 83% rename from compiler/src/polyllvm/extension/PolyLLVMEseqExt.java rename to compiler/src/jlang/extension/JLangEseqExt.java index a863eeba..88d60f89 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMEseqExt.java +++ b/compiler/src/jlang/extension/JLangEseqExt.java @@ -1,14 +1,15 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.Node; -import polyllvm.ast.ESeq; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.visit.LLVMTranslator; import static org.bytedeco.javacpp.LLVM.LLVMBasicBlockRef; import static org.bytedeco.javacpp.LLVM.LLVMValueRef; -public class PolyLLVMEseqExt extends PolyLLVMExt { +import jlang.ast.ESeq; +import jlang.ast.JLangExt; +import jlang.visit.LLVMTranslator; + +public class JLangEseqExt extends JLangExt { @Override public Node leaveTranslateLLVM(LLVMTranslator v) { diff --git a/compiler/src/polyllvm/extension/PolyLLVMExtendedForExt.java b/compiler/src/jlang/extension/JLangExtendedForExt.java similarity index 90% rename from compiler/src/polyllvm/extension/PolyLLVMExtendedForExt.java rename to compiler/src/jlang/extension/JLangExtendedForExt.java index 69a3c6a3..0d3624e0 100644 --- a/compiler/src/polyllvm/extension/PolyLLVMExtendedForExt.java +++ b/compiler/src/jlang/extension/JLangExtendedForExt.java @@ -1,4 +1,4 @@ -package polyllvm.extension; +package jlang.extension; import polyglot.ast.*; import polyglot.ext.jl5.ast.ExtendedFor; @@ -11,19 +11,20 @@ import polyglot.types.Type; import polyglot.util.InternalCompilerError; import polyglot.util.Position; -import polyllvm.ast.PolyLLVMExt; -import polyllvm.ast.PolyLLVMNodeFactory; -import polyllvm.types.PolyLLVMTypeSystem; -import polyllvm.util.TypedNodeFactory; -import polyllvm.visit.DesugarLocally; -import polyllvm.visit.LLVMTranslator; import java.util.Arrays; import java.util.Collections; import java.util.List; +import jlang.ast.JLangExt; +import jlang.ast.JLangNodeFactory; +import jlang.types.JLangTypeSystem; +import jlang.util.TypedNodeFactory; +import jlang.visit.DesugarLocally; +import jlang.visit.LLVMTranslator; + /** Enhanced for-loops are desugared into normal for-loops. */ -public class PolyLLVMExtendedForExt extends PolyLLVMExt { +public class JLangExtendedForExt extends JLangExt { @Override public Node leaveTranslateLLVM(LLVMTranslator v) { @@ -47,8 +48,8 @@ public Node desugar(DesugarLocally v) { // for (Iterator+AST extensions and delegates for the JLang language extension. +
+ diff --git a/compiler/src/jlang/package.html b/compiler/src/jlang/package.html new file mode 100644 index 00000000..c3b43143 --- /dev/null +++ b/compiler/src/jlang/package.html @@ -0,0 +1,5 @@ + ++JLang language extension. +
+ diff --git a/compiler/src/polyllvm/structures/ClassObjects.java b/compiler/src/jlang/structures/ClassObjects.java similarity index 97% rename from compiler/src/polyllvm/structures/ClassObjects.java rename to compiler/src/jlang/structures/ClassObjects.java index cd25eeff..4d60acd0 100644 --- a/compiler/src/polyllvm/structures/ClassObjects.java +++ b/compiler/src/jlang/structures/ClassObjects.java @@ -1,10 +1,11 @@ -package polyllvm.structures; +package jlang.structures; import polyglot.types.ReferenceType; -import polyllvm.visit.LLVMTranslator; import java.util.*; +import jlang.visit.LLVMTranslator; + import static org.bytedeco.javacpp.LLVM.*; /** diff --git a/compiler/src/polyllvm/structures/DispatchVector.java b/compiler/src/jlang/structures/DispatchVector.java similarity index 97% rename from compiler/src/polyllvm/structures/DispatchVector.java rename to compiler/src/jlang/structures/DispatchVector.java index 2467e367..327de301 100644 --- a/compiler/src/polyllvm/structures/DispatchVector.java +++ b/compiler/src/jlang/structures/DispatchVector.java @@ -1,4 +1,4 @@ -package polyllvm.structures; +package jlang.structures; import org.bytedeco.javacpp.LLVM.LLVMTypeRef; import org.bytedeco.javacpp.LLVM.LLVMValueRef; diff --git a/compiler/src/polyllvm/structures/DispatchVector_c.java b/compiler/src/jlang/structures/DispatchVector_c.java similarity index 98% rename from compiler/src/polyllvm/structures/DispatchVector_c.java rename to compiler/src/jlang/structures/DispatchVector_c.java index d06a44ba..47f45af2 100644 --- a/compiler/src/polyllvm/structures/DispatchVector_c.java +++ b/compiler/src/jlang/structures/DispatchVector_c.java @@ -1,12 +1,13 @@ -package polyllvm.structures; +package jlang.structures; import org.bytedeco.javacpp.LLVM; import org.bytedeco.javacpp.LLVM.LLVMTypeRef; import org.bytedeco.javacpp.LLVM.LLVMValueRef; + +import jlang.visit.LLVMTranslator; import polyglot.types.ClassType; import polyglot.types.MethodInstance; import polyglot.types.ReferenceType; -import polyllvm.visit.LLVMTranslator; import java.util.HashMap; import java.util.List; diff --git a/compiler/src/polyllvm/structures/ObjectStruct.java b/compiler/src/jlang/structures/ObjectStruct.java similarity index 97% rename from compiler/src/polyllvm/structures/ObjectStruct.java rename to compiler/src/jlang/structures/ObjectStruct.java index 60b93282..d74c8f17 100644 --- a/compiler/src/polyllvm/structures/ObjectStruct.java +++ b/compiler/src/jlang/structures/ObjectStruct.java @@ -1,4 +1,4 @@ -package polyllvm.structures; +package jlang.structures; import org.bytedeco.javacpp.LLVM.LLVMTypeRef; import org.bytedeco.javacpp.LLVM.LLVMValueRef; diff --git a/compiler/src/polyllvm/structures/ObjectStruct_c.java b/compiler/src/jlang/structures/ObjectStruct_c.java similarity index 99% rename from compiler/src/polyllvm/structures/ObjectStruct_c.java rename to compiler/src/jlang/structures/ObjectStruct_c.java index b7a119f5..3ea885bc 100644 --- a/compiler/src/polyllvm/structures/ObjectStruct_c.java +++ b/compiler/src/jlang/structures/ObjectStruct_c.java @@ -1,9 +1,10 @@ -package polyllvm.structures; +package jlang.structures; import org.bytedeco.javacpp.LLVM.*; + +import jlang.visit.LLVMTranslator; import polyglot.types.*; import polyglot.util.InternalCompilerError; -import polyllvm.visit.LLVMTranslator; import java.lang.Override; import java.util.*; diff --git a/compiler/src/polyllvm/test/TestAll.java b/compiler/src/jlang/test/TestAll.java similarity index 89% rename from compiler/src/polyllvm/test/TestAll.java rename to compiler/src/jlang/test/TestAll.java index 8a152e50..4d382517 100644 --- a/compiler/src/polyllvm/test/TestAll.java +++ b/compiler/src/jlang/test/TestAll.java @@ -1,4 +1,4 @@ -package polyllvm.test; +package jlang.test; import org.junit.runner.RunWith; import org.junit.runners.Suite; diff --git a/compiler/src/polyllvm/test/TestFunctional.java b/compiler/src/jlang/test/TestFunctional.java similarity index 98% rename from compiler/src/polyllvm/test/TestFunctional.java rename to compiler/src/jlang/test/TestFunctional.java index 5cf6d51f..4b264c67 100644 --- a/compiler/src/polyllvm/test/TestFunctional.java +++ b/compiler/src/jlang/test/TestFunctional.java @@ -1,4 +1,4 @@ -package polyllvm.test; +package jlang.test; import org.junit.BeforeClass; import org.junit.Test; diff --git a/compiler/src/polyllvm/test/TestUtil.java b/compiler/src/jlang/test/TestUtil.java similarity index 99% rename from compiler/src/polyllvm/test/TestUtil.java rename to compiler/src/jlang/test/TestUtil.java index 7e304f2b..3465d5c1 100644 --- a/compiler/src/polyllvm/test/TestUtil.java +++ b/compiler/src/jlang/test/TestUtil.java @@ -1,4 +1,4 @@ -package polyllvm.test; +package jlang.test; import java.io.File; import java.io.IOException; diff --git a/compiler/src/polyllvm/types/PolyLLVMClassFileLazyClassInitializer.java b/compiler/src/jlang/types/JLangClassFileLazyClassInitializer.java similarity index 61% rename from compiler/src/polyllvm/types/PolyLLVMClassFileLazyClassInitializer.java rename to compiler/src/jlang/types/JLangClassFileLazyClassInitializer.java index 2311dd5a..33b331ac 100644 --- a/compiler/src/polyllvm/types/PolyLLVMClassFileLazyClassInitializer.java +++ b/compiler/src/jlang/types/JLangClassFileLazyClassInitializer.java @@ -1,4 +1,4 @@ -package polyllvm.types; +package jlang.types; import polyglot.ext.jl5.types.reflect.JL5ClassFileLazyClassInitializer; import polyglot.types.ClassType; @@ -6,11 +6,11 @@ import polyglot.types.reflect.ClassFile; import polyglot.types.reflect.Method; -public class PolyLLVMClassFileLazyClassInitializer extends JL5ClassFileLazyClassInitializer { +public class JLangClassFileLazyClassInitializer extends JL5ClassFileLazyClassInitializer { - PolyLLVMTypeSystem ts; + JLangTypeSystem ts; - public PolyLLVMClassFileLazyClassInitializer(ClassFile file, PolyLLVMTypeSystem ts) { + public JLangClassFileLazyClassInitializer(ClassFile file, JLangTypeSystem ts) { super(file, ts); this.ts = ts; } @@ -18,7 +18,7 @@ public PolyLLVMClassFileLazyClassInitializer(ClassFile file, PolyLLVMTypeSystem @Override protected MethodInstance methodInstance(Method m, ClassType ct) { MethodInstance mi = super.methodInstance(m, ct); - PolyLLVMParsedClassType_c pct = (PolyLLVMParsedClassType_c) ct; + JLangParsedClassType_c pct = (JLangParsedClassType_c) ct; if (pct.isNewMethod(mi)) { return mi; } else { diff --git a/compiler/src/polyllvm/types/PolyLLVMLocalInstance.java b/compiler/src/jlang/types/JLangLocalInstance.java similarity index 75% rename from compiler/src/polyllvm/types/PolyLLVMLocalInstance.java rename to compiler/src/jlang/types/JLangLocalInstance.java index 82da6eca..f03b415d 100644 --- a/compiler/src/polyllvm/types/PolyLLVMLocalInstance.java +++ b/compiler/src/jlang/types/JLangLocalInstance.java @@ -1,8 +1,8 @@ -package polyllvm.types; +package jlang.types; import polyglot.ext.jl5.types.JL5LocalInstance; -public interface PolyLLVMLocalInstance extends JL5LocalInstance { +public interface JLangLocalInstance extends JL5LocalInstance { /** * Whether this is a compiler-generated variable that should not be diff --git a/compiler/src/polyllvm/types/PolyLLVMLocalInstance_c.java b/compiler/src/jlang/types/JLangLocalInstance_c.java similarity index 81% rename from compiler/src/polyllvm/types/PolyLLVMLocalInstance_c.java rename to compiler/src/jlang/types/JLangLocalInstance_c.java index 08f436eb..d5c0ac66 100644 --- a/compiler/src/polyllvm/types/PolyLLVMLocalInstance_c.java +++ b/compiler/src/jlang/types/JLangLocalInstance_c.java @@ -1,4 +1,4 @@ -package polyllvm.types; +package jlang.types; import polyglot.ext.jl5.types.JL5LocalInstance_c; import polyglot.types.Flags; @@ -6,12 +6,12 @@ import polyglot.types.TypeSystem; import polyglot.util.Position; -public class PolyLLVMLocalInstance_c +public class JLangLocalInstance_c extends JL5LocalInstance_c - implements PolyLLVMLocalInstance { + implements JLangLocalInstance { private final boolean isTemp, isSSA; - public PolyLLVMLocalInstance_c( + public JLangLocalInstance_c( TypeSystem ts, Position pos, Flags flags, Type type, String name, boolean isTemp, boolean isSSA) { super(ts, pos, flags, type, name); diff --git a/compiler/src/polyllvm/types/PolyLLVMParsedClassType_c.java b/compiler/src/jlang/types/JLangParsedClassType_c.java similarity index 84% rename from compiler/src/polyllvm/types/PolyLLVMParsedClassType_c.java rename to compiler/src/jlang/types/JLangParsedClassType_c.java index aa595b00..f2f7ea45 100644 --- a/compiler/src/polyllvm/types/PolyLLVMParsedClassType_c.java +++ b/compiler/src/jlang/types/JLangParsedClassType_c.java @@ -1,5 +1,6 @@ -package polyllvm.types; +package jlang.types; +import jlang.visit.NameAnonClasses; import polyglot.ext.jl5.types.JL5MethodInstance; import polyglot.ext.jl5.types.JL5ParsedClassType_c; import polyglot.frontend.Source; @@ -7,12 +8,11 @@ import polyglot.types.LazyClassInitializer; import polyglot.types.MethodInstance; import polyglot.types.TypeSystem; -import polyllvm.visit.NameAnonClasses; -public class PolyLLVMParsedClassType_c extends JL5ParsedClassType_c { +public class JLangParsedClassType_c extends JL5ParsedClassType_c { - PolyLLVMTypeSystem ts; - public PolyLLVMParsedClassType_c(PolyLLVMTypeSystem ts, LazyClassInitializer init, Source fromSource) { + JLangTypeSystem ts; + public JLangParsedClassType_c(JLangTypeSystem ts, LazyClassInitializer init, Source fromSource) { super(ts, init, fromSource); this.ts = ts; } diff --git a/compiler/src/polyllvm/types/PolyLLVMSubstMethodInstance_c.java b/compiler/src/jlang/types/JLangSubstMethodInstance_c.java similarity index 88% rename from compiler/src/polyllvm/types/PolyLLVMSubstMethodInstance_c.java rename to compiler/src/jlang/types/JLangSubstMethodInstance_c.java index 45f4df7e..ca830138 100644 --- a/compiler/src/polyllvm/types/PolyLLVMSubstMethodInstance_c.java +++ b/compiler/src/jlang/types/JLangSubstMethodInstance_c.java @@ -1,4 +1,4 @@ -package polyllvm.types; +package jlang.types; import polyglot.ext.jl5.types.JL5MethodInstance; import polyglot.ext.jl5.types.JL5MethodInstance_c; @@ -10,14 +10,14 @@ /** * See {@link SubstMethodInstance}. */ -public class PolyLLVMSubstMethodInstance_c extends JL5MethodInstance_c +public class JLangSubstMethodInstance_c extends JL5MethodInstance_c implements SubstMethodInstance { private static final long serialVersionUID = SerialVersionUID.generate(); final protected JL5MethodInstance base; final protected JL5Subst subst; - public PolyLLVMSubstMethodInstance_c(JL5MethodInstance postSubst, + public JLangSubstMethodInstance_c(JL5MethodInstance postSubst, JL5MethodInstance preSubst, JL5Subst subst) { super((JL5TypeSystem) postSubst.typeSystem(), postSubst.position(), postSubst.container(), postSubst.flags(), diff --git a/compiler/src/polyllvm/types/PolyLLVMTypeSystem.java b/compiler/src/jlang/types/JLangTypeSystem.java similarity index 82% rename from compiler/src/polyllvm/types/PolyLLVMTypeSystem.java rename to compiler/src/jlang/types/JLangTypeSystem.java index 371ddf76..5cc1244d 100644 --- a/compiler/src/polyllvm/types/PolyLLVMTypeSystem.java +++ b/compiler/src/jlang/types/JLangTypeSystem.java @@ -1,4 +1,4 @@ -package polyllvm.types; +package jlang.types; import polyglot.ext.jl5.types.JL5MethodInstance; import polyglot.ext.jl5.types.JL5Subst; @@ -9,20 +9,20 @@ import polyglot.types.Type; import polyglot.util.Position; -public interface PolyLLVMTypeSystem extends JL7TypeSystem { +public interface JLangTypeSystem extends JL7TypeSystem { ParsedClassType ArrayObject(); ClassType RuntimeHelper(); @Override - PolyLLVMLocalInstance localInstance(Position pos, Flags flags, Type type, String name); + JLangLocalInstance localInstance(Position pos, Flags flags, Type type, String name); /** * Creates a local instance with the option of making it a temp variable, which * is hidden from the user when debugging. */ - PolyLLVMLocalInstance localInstance( + JLangLocalInstance localInstance( Position pos, Flags flags, Type type, String name, boolean isTemp, boolean isSSA); SubstMethodInstance substMethodInstance(JL5MethodInstance postSubst, diff --git a/compiler/src/polyllvm/types/PolyLLVMTypeSystem_c.java b/compiler/src/jlang/types/JLangTypeSystem_c.java similarity index 78% rename from compiler/src/polyllvm/types/PolyLLVMTypeSystem_c.java rename to compiler/src/jlang/types/JLangTypeSystem_c.java index c09f0c6b..859061d6 100644 --- a/compiler/src/polyllvm/types/PolyLLVMTypeSystem_c.java +++ b/compiler/src/jlang/types/JLangTypeSystem_c.java @@ -1,4 +1,7 @@ -package polyllvm.types; +package jlang.types; + +import static jlang.util.Constants.RUNTIME_ARRAY; +import static jlang.util.Constants.RUNTIME_HELPER; import polyglot.ext.jl5.types.JL5MethodInstance; import polyglot.ext.jl5.types.JL5Subst; @@ -10,22 +13,19 @@ import polyglot.util.InternalCompilerError; import polyglot.util.Position; -import static polyllvm.util.Constants.RUNTIME_ARRAY; -import static polyllvm.util.Constants.RUNTIME_HELPER; - -public class PolyLLVMTypeSystem_c extends JL7TypeSystem_c implements PolyLLVMTypeSystem { +public class JLangTypeSystem_c extends JL7TypeSystem_c implements JLangTypeSystem { @Override public ClassFileLazyClassInitializer classFileLazyClassInitializer(ClassFile clazz) { - return new PolyLLVMClassFileLazyClassInitializer(clazz, this); + return new JLangClassFileLazyClassInitializer(clazz, this); } @Override public SubstMethodInstance substMethodInstance( JL5MethodInstance postSubst, JL5MethodInstance preSubst, JL5Subst subst) { - return new PolyLLVMSubstMethodInstance_c(postSubst, preSubst, subst); + return new JLangSubstMethodInstance_c(postSubst, preSubst, subst); } @Override @@ -47,19 +47,19 @@ public ParsedClassType RuntimeHelper() { } @Override - public PolyLLVMLocalInstance localInstance(Position pos, Flags flags, Type type, String name) { + public JLangLocalInstance localInstance(Position pos, Flags flags, Type type, String name) { return localInstance(pos, flags, type, name, /*isTemp*/ false, /*isSSA*/ false); } @Override - public PolyLLVMLocalInstance localInstance( + public JLangLocalInstance localInstance( Position pos, Flags flags, Type type, String name, boolean isTemp, boolean isSSA) { - return new PolyLLVMLocalInstance_c(this, pos, flags, type, name, isTemp, isSSA); + return new JLangLocalInstance_c(this, pos, flags, type, name, isTemp, isSSA); } @Override public ParsedClassType createClassType(LazyClassInitializer init, Source fromSource) { - return new PolyLLVMParsedClassType_c(this, init, fromSource); + return new JLangParsedClassType_c(this, init, fromSource); } @Override diff --git a/compiler/src/polyllvm/types/SubstMethodInstance.java b/compiler/src/jlang/types/SubstMethodInstance.java similarity index 97% rename from compiler/src/polyllvm/types/SubstMethodInstance.java rename to compiler/src/jlang/types/SubstMethodInstance.java index 211e0df9..2a6aa2b4 100644 --- a/compiler/src/polyllvm/types/SubstMethodInstance.java +++ b/compiler/src/jlang/types/SubstMethodInstance.java @@ -1,4 +1,4 @@ -package polyllvm.types; +package jlang.types; import polyglot.ext.jl5.types.JL5MethodInstance; import polyglot.ext.jl5.types.JL5Subst; diff --git a/compiler/src/polyllvm/util/CollectUtils.java b/compiler/src/jlang/util/CollectUtils.java similarity index 97% rename from compiler/src/polyllvm/util/CollectUtils.java rename to compiler/src/jlang/util/CollectUtils.java index 732d4368..7558665f 100644 --- a/compiler/src/polyllvm/util/CollectUtils.java +++ b/compiler/src/jlang/util/CollectUtils.java @@ -1,4 +1,4 @@ -package polyllvm.util; +package jlang.util; import java.lang.reflect.Array; import java.util.List; diff --git a/compiler/src/polyllvm/util/Constants.java b/compiler/src/jlang/util/Constants.java similarity index 86% rename from compiler/src/polyllvm/util/Constants.java rename to compiler/src/jlang/util/Constants.java index f595c452..b81a6c69 100644 --- a/compiler/src/polyllvm/util/Constants.java +++ b/compiler/src/jlang/util/Constants.java @@ -1,4 +1,4 @@ -package polyllvm.util; +package jlang.util; import polyglot.util.CollectionUtil; @@ -6,10 +6,10 @@ import java.util.Set; /** - * PolyLLVM constants for, e.g., important method names and array data layout. + * JLang constants for, e.g., important method names and array data layout. */ public class Constants { - public static final String RUNTIME_PACKAGE = "polyllvm.runtime"; + public static final String RUNTIME_PACKAGE = "jlang.runtime"; public static final String RUNTIME_HELPER = RUNTIME_PACKAGE + ".Helper"; public static final String RUNTIME_ARRAY = RUNTIME_PACKAGE + ".Array"; public static final String RUNTIME_ARRAY_TYPE = RUNTIME_ARRAY + ".Type"; @@ -17,7 +17,7 @@ public class Constants { public static final String PRIMITIVE_CLASS_OBJECT_SUFFIX = "ClassObject"; public static final String CALLOC = "GC_malloc"; - public static final String ENTRY_TRAMPOLINE = "Java_polyllvm_runtime_MainWrapper_main"; + public static final String ENTRY_TRAMPOLINE = "Java_jlang_runtime_MainWrapper_main"; public static final int LLVM_ADDR_SPACE = 0; public static final int CTOR_METHOD_INFO_OFFSET = -2; diff --git a/compiler/src/polyllvm/util/DebugInfo.java b/compiler/src/jlang/util/DebugInfo.java similarity index 97% rename from compiler/src/polyllvm/util/DebugInfo.java rename to compiler/src/jlang/util/DebugInfo.java index c3b9d5b1..92710a17 100644 --- a/compiler/src/polyllvm/util/DebugInfo.java +++ b/compiler/src/jlang/util/DebugInfo.java @@ -1,13 +1,14 @@ -package polyllvm.util; +package jlang.util; import org.bytedeco.javacpp.BytePointer; import org.bytedeco.javacpp.PointerPointer; + +import jlang.visit.LLVMTranslator; import polyglot.ast.*; import polyglot.types.ProcedureInstance; import polyglot.types.Type; import polyglot.util.InternalCompilerError; import polyglot.util.Position; -import polyllvm.visit.LLVMTranslator; import java.io.File; import java.util.ArrayDeque; @@ -15,9 +16,9 @@ import java.util.HashMap; import java.util.List; +import static jlang.util.Constants.DEBUG_DWARF_VERSION; +import static jlang.util.Constants.DEBUG_INFO_VERSION; import static org.bytedeco.javacpp.LLVM.*; -import static polyllvm.util.Constants.DEBUG_DWARF_VERSION; -import static polyllvm.util.Constants.DEBUG_INFO_VERSION; /** * Created by Daniel on 2/24/17. @@ -42,7 +43,7 @@ public DebugInfo(LLVMTranslator v, LLVMModuleRef mod, String path) { debugFile = LLVMDIBuilderCreateFile(diBuilder, fileName, fileDir); compileUnit = LLVMDIBuilderCreateCompileUnit( - diBuilder, DW_LANG_Java, fileName, fileDir, "PolyLLVM", 0, "", 0); + diBuilder, DW_LANG_Java, fileName, fileDir, "JLang", 0, "", 0); LLVMAddModuleFlag(mod, Warning, "Debug Info Version", DEBUG_INFO_VERSION); diff --git a/compiler/src/jlang/util/DesugarBarrier.java b/compiler/src/jlang/util/DesugarBarrier.java new file mode 100644 index 00000000..ba2f41db --- /dev/null +++ b/compiler/src/jlang/util/DesugarBarrier.java @@ -0,0 +1,26 @@ +package jlang.util; + +import jlang.JLangScheduler; +import polyglot.frontend.Job; +import polyglot.frontend.goals.Barrier; +import polyglot.frontend.goals.Goal; + +public class DesugarBarrier extends Barrier { + + private final JLangScheduler jlangScheduler; + + public static DesugarBarrier create(JLangScheduler s) { + return new DesugarBarrier(s); + } + + protected DesugarBarrier(JLangScheduler scheduler) { + super(scheduler); + this.jlangScheduler = scheduler; + } + + @Override + public Goal goalForJob(Job job) { + return this.jlangScheduler.LLVMDesugared(job); + } + +} diff --git a/compiler/src/polyllvm/util/PolyLLVMDesugared.java b/compiler/src/jlang/util/JLangDesugared.java similarity index 91% rename from compiler/src/polyllvm/util/PolyLLVMDesugared.java rename to compiler/src/jlang/util/JLangDesugared.java index ff8f0daf..71dfc543 100644 --- a/compiler/src/polyllvm/util/PolyLLVMDesugared.java +++ b/compiler/src/jlang/util/JLangDesugared.java @@ -1,4 +1,4 @@ -package polyllvm.util; +package jlang.util; import polyglot.frontend.*; import polyglot.frontend.goals.AbstractGoal; @@ -7,26 +7,27 @@ import polyglot.types.ParsedClassType; import polyglot.types.SemanticException; import polyglot.util.InternalCompilerError; -import polyllvm.ast.PolyLLVMNodeFactory; -import polyllvm.types.PolyLLVMTypeSystem; -import polyllvm.visit.*; import java.util.stream.Stream; +import jlang.ast.JLangNodeFactory; +import jlang.types.JLangTypeSystem; +import jlang.visit.*; + /** - * Runs all PolyLLVM desugar passes so that the AST is + * Runs all JLang desugar passes so that the AST is * fully desugared and ready for emitting LLVM IR. */ -public class PolyLLVMDesugared extends AbstractGoal { +public class JLangDesugared extends AbstractGoal { private boolean attempted = false; private final Goal[] goals; - public PolyLLVMDesugared(Job job) { + public JLangDesugared(Job job) { super(job); ExtensionInfo extInfo = job.extensionInfo(); - PolyLLVMTypeSystem ts = (PolyLLVMTypeSystem) extInfo.typeSystem(); - PolyLLVMNodeFactory nf = (PolyLLVMNodeFactory) extInfo.nodeFactory(); + JLangTypeSystem ts = (JLangTypeSystem) extInfo.typeSystem(); + JLangNodeFactory nf = (JLangNodeFactory) extInfo.nodeFactory(); goals = new Goal[] { // Visitor passes running after type checking must preserve type information. diff --git a/compiler/src/polyllvm/util/PolyLLVMFreshGen.java b/compiler/src/jlang/util/JLangFreshGen.java similarity index 73% rename from compiler/src/polyllvm/util/PolyLLVMFreshGen.java rename to compiler/src/jlang/util/JLangFreshGen.java index e4b35eee..5609ef58 100644 --- a/compiler/src/polyllvm/util/PolyLLVMFreshGen.java +++ b/compiler/src/jlang/util/JLangFreshGen.java @@ -1,21 +1,21 @@ -package polyllvm.util; +package jlang.util; import java.util.HashMap; import java.util.Map; -public class PolyLLVMFreshGen { +public class JLangFreshGen { - private static PolyLLVMFreshGen instance = null; + private static JLangFreshGen instance = null; Map+Visitors for the JLang language extension. +
+ diff --git a/compiler/src/polyllvm/Topics.java b/compiler/src/polyllvm/Topics.java deleted file mode 100644 index 46cc89f5..00000000 --- a/compiler/src/polyllvm/Topics.java +++ /dev/null @@ -1,14 +0,0 @@ -package polyllvm; - -import polyglot.main.Report; - -/** - * Extension information for polyllvm extension. - */ -public class Topics { - public static final String polyllvm = "polyllvm"; - - static { - Report.topics.add(polyllvm); - } -} diff --git a/compiler/src/polyllvm/ast/package.html b/compiler/src/polyllvm/ast/package.html deleted file mode 100644 index e081dd6a..00000000 --- a/compiler/src/polyllvm/ast/package.html +++ /dev/null @@ -1,5 +0,0 @@ - --AST nodes for the PolyLLVM language extension. -
- diff --git a/compiler/src/polyllvm/extension/package.html b/compiler/src/polyllvm/extension/package.html deleted file mode 100644 index 54dc07d1..00000000 --- a/compiler/src/polyllvm/extension/package.html +++ /dev/null @@ -1,5 +0,0 @@ - --AST extensions and delegates for the PolyLLVM language extension. -
- diff --git a/compiler/src/polyllvm/package.html b/compiler/src/polyllvm/package.html deleted file mode 100644 index c903494b..00000000 --- a/compiler/src/polyllvm/package.html +++ /dev/null @@ -1,5 +0,0 @@ - --PolyLLVM language extension. -
- diff --git a/compiler/src/polyllvm/util/DesugarBarrier.java b/compiler/src/polyllvm/util/DesugarBarrier.java deleted file mode 100644 index 99cb0c79..00000000 --- a/compiler/src/polyllvm/util/DesugarBarrier.java +++ /dev/null @@ -1,26 +0,0 @@ -package polyllvm.util; - -import polyglot.frontend.Job; -import polyglot.frontend.goals.Barrier; -import polyglot.frontend.goals.Goal; -import polyllvm.PolyLLVMScheduler; - -public class DesugarBarrier extends Barrier { - - private final PolyLLVMScheduler polyllvmScheduler; - - public static DesugarBarrier create(PolyLLVMScheduler s) { - return new DesugarBarrier(s); - } - - protected DesugarBarrier(PolyLLVMScheduler scheduler) { - super(scheduler); - this.polyllvmScheduler = scheduler; - } - - @Override - public Goal goalForJob(Job job) { - return this.polyllvmScheduler.LLVMDesugared(job); - } - -} diff --git a/compiler/src/polyllvm/visit/package.html b/compiler/src/polyllvm/visit/package.html deleted file mode 100644 index e04ce8ab..00000000 --- a/compiler/src/polyllvm/visit/package.html +++ /dev/null @@ -1,5 +0,0 @@ - --Visitors for the PolyLLVM language extension. -
- diff --git a/docs/_config.yml b/docs/_config.yml index 1eeba460..6612c119 100644 --- a/docs/_config.yml +++ b/docs/_config.yml @@ -1,6 +1,6 @@ kramdown: input: GFM hard_wrap: false -project: "polyllvm" +project: "JLang" github: - url: https://github.com/gharrma/polyllvm + url: https://github.com/dz333/JLang diff --git a/docs/developer-guide.md b/docs/developer-guide.md index ed06c7b0..45137904 100644 --- a/docs/developer-guide.md +++ b/docs/developer-guide.md @@ -16,10 +16,10 @@ Contents Overview -------- -PolyLLVM is built as an extension to the +JLang is built as an extension to the [Polyglot](https://www.cs.cornell.edu/projects/polyglot/) compiler. Since -PolyLLVM is a backend only, it does not extend the parser, nor the type -system built into polyglot. PolyLLVM simply adds compiler passes for desugaring +JLang is a backend only, it does not extend the parser, nor the type +system built into polyglot. JLang simply adds compiler passes for desugaring and translating Java ASTs into LLVM IR. The project also contains native code for supporting Java semantics at runtime, @@ -33,7 +33,7 @@ Related Documentation - The [Polyglot tutorial](http://www.cs.cornell.edu/Projects/polyglot/pldi14/tutorial/) should at least be skimmed to get an idea of how Polyglot works. For the purposes -of PolyLLVM, the most important things to know about Polyglot are its type system (especially +of JLang, the most important things to know about Polyglot are its type system (especially how it handles generics), its scheduler framework, its AST visitor framework, and its AST node extension framework (`NodeFactory`, `ExtFactory`, etc.). @@ -77,7 +77,7 @@ into a shared library arbitrarily called `libjdk`. If you want to use the full OpenJDK, you can instead run `JDK=jdk make` at the top level, which will switch to using the `jdk` directory. The makefile in the `jdk` directory will unzip OpenJDK 7 source files, apply a small number of temporary patches that -help work around unimplemented features in PolyLLVM, and then compile everything +help work around unimplemented features in JLang, and then compile everything into `libjdk` as before. Here it will also put your local JDK 7 installation on the dynamically loaded search path of `libjdk`, so that JDK code has access to the native code that is part of OpenJDK 7. @@ -88,16 +88,16 @@ JDK. By default it will also run each test case and store the output in a `.output` file. The Makefiles themselves are the best source of documentation for how to -compile Java files with PolyLLVM, create shared libraries, and link against +compile Java files with JLang, create shared libraries, and link against the native code in your local system JDK. ### Scripts -The `bin/polyllvmc` script is the primary script used to launch PolyLLVM. +The `bin/jlangc` script is the primary script used to launch JLang. It was originally auto-generated by Polyglot. It automatically adds classes -from the runtime to the PolyLLVM classpath, which is necessary because -some PolyLLVM desugar transformations refer directly to runtime classes. -The result to of `polyllvmc` is LLVM IR in the form of a `.ll` file for +from the runtime to the JLang classpath, which is necessary because +some JLang desugar transformations refer directly to runtime classes. +The result to of `jlangc` is LLVM IR in the form of a `.ll` file for each compiled Java file. The `bin/plc` script is intended to automate the linking part of building @@ -135,8 +135,8 @@ through a [fork of javacpp-presets](https://github.com/gharrma/javacpp-presets), which is tracked as a git submodule. Cloning with `--depth 1` is recommended. To build, `cd` into the `llvm` subdirectory and run `mvn install`. This will produce the needed `.jar` files in the `llvm/target` directory. For convenience -we provide up-to-date `.jar` files in the PolyLLVM repository -[directly](https://github.com/gharrma/polyllvm/tree/master/lib), +we provide up-to-date `.jar` files in the JLang repository +[directly](https://github.com/dz333/JLang/tree/master/lib), for OS X and Linux. @@ -144,15 +144,15 @@ Desugaring Passes ----------------- There are currently several desugaring passes that run prior to translation, -executed as part of the `PolyLLVMDesugared` scheduler goal. For example, +executed as part of the `JLangDesugared` scheduler goal. For example, - The `DesugarEnums` pass converts Java enums into normal classes. - The `DesugarInstanceInitializers` searches for class initializer blocks and inline field initializers, and prepends these to object constructors. - The `DesugarLocalClasses` rewrites local classes so that captured local variables are stored as instance fields. -There are more, and they are listed in `PolyLLVMDesugared`. Each pass has Javadoc documentation. +There are more, and they are listed in `JLangDesugared`. Each pass has Javadoc documentation. -There is also the special `DesugarLocally` pass run at the end, which gives each Java AST node a chance to desugar itself locally into something simpler. For example, try-with-resource statements are desugared within `PolyLLVMTryWithResourcesExt` down to normal try-catch blocks as specified by the JLS. +There is also the special `DesugarLocally` pass run at the end, which gives each Java AST node a chance to desugar itself locally into something simpler. For example, try-with-resource statements are desugared within `JLangTryWithResourcesExt` down to normal try-catch blocks as specified by the JLS. Translation Pass @@ -163,13 +163,13 @@ data structure the translator uses is a map from Java `Node` objects to `LLVMValueRef` objects. When translating a Java node, the translation for sub-nodes is retrieved using the `getTranslation` method. -The translations themselves are implemented in each of the `PolyLLVMExt` subclasses +The translations themselves are implemented in each of the `JLangExt` subclasses (roughly one per Java AST node). Most of these translations are documented with Javadoc or inline comments. For example: -- `PolyLLVMBinaryExt` translations all Java binary expressions. -- `PolyLLVMIfExt` translates if-statements. -- `PolyLLVMClassDeclExt` emits runtime type information for the current class (to be used by the runtime). -- `PolyLLVMTryExt` translates try-catch blocks, implementing Itanium ABI zero-cost exception handling. +- `JLangBinaryExt` translations all Java binary expressions. +- `JLangIfExt` translates if-statements. +- `JLangClassDeclExt` emits runtime type information for the current class (to be used by the runtime). +- `JLangTryExt` translates try-catch blocks, implementing Itanium ABI zero-cost exception handling. In addition to traversing the AST, the translator keeps track of various states needed for translation, such as the current function, the current enclosing try-catch block, the current LLVM module, etc. @@ -182,13 +182,13 @@ The translator also exposes various utility classes to aid translation. For exam for accessing fields with LLVM IR. - `DispatchVector` specifies the layout of Java dispatch vectors, and provides methods for indexing into the dispatch vector based on the method desired. -- `PolyLLVMMangler` mangles symbol names. +- `JLangMangler` mangles symbol names. Object Layouts -------------- -See `ObjectStruct_c` for the definitive layout of Java objects used by PolyLLVM. +See `ObjectStruct_c` for the definitive layout of Java objects used by JLang. This layout must be kept in sync with the layouts in `runtime/rep.h`, which is used by native code to work with Java objects. @@ -200,7 +200,7 @@ A Java object currently looks like this: - ... See `DispatchVector_c` for the definitive layout of dispatch vectors generated -by PolyLLVM. These currently look like this: +by JLang. These currently look like this: - Pointer to the `java.lang.Class` object for this class. - Point to the interface method dispatch hash table. - Pointer to a contiguous array of super types, used for relatively fast `instanceof` checks. @@ -246,7 +246,7 @@ The function accesses the dispatch vector of `obj` to retrieve a table containin Arrays ------ -A Java array (e.g., `int[3]`) is implemented as a contiguous region of memory, with one word at the beginning to point to a dispatch vector, and the next word to hold the array length. Arrays must behave as standard Java objects with respect to type information, so for simplicity arrays are implemented as a Java class (see `Array.java` in the `runtime` directory). The catch is that PolyLLVM allocates extra memory for `Array` instances in order to store data elements. +A Java array (e.g., `int[3]`) is implemented as a contiguous region of memory, with one word at the beginning to point to a dispatch vector, and the next word to hold the array length. Arrays must behave as standard Java objects with respect to type information, so for simplicity arrays are implemented as a Java class (see `Array.java` in the `runtime` directory). The catch is that JLang allocates extra memory for `Array` instances in order to store data elements. Arrays are packed, so that an array of chars (for example) uses only two bytes per element. The one exception is that boolean arrays use one byte per element as opposed to one bit. Packed arrays are implemented by casting the array data pointer (in LLVM IR) to the appropriate type before offsetting with an index. @@ -270,7 +270,7 @@ We use native C++ code in many parts of the runtime, including Wherever possible, native C code should be preferred over handwritten or compiler-generated LLVM IR. Native code currently resides in the `runtime/native` directory. -For an example, consider the [native code used to implement `instanceof`](#instanceof). When translating a reference to `instanceof` in Java source code, PolyLLVM emits a call to this native code with the correct arguments. The runtime build system is responsible for compiling runtime code into a shared library which should be linked with user programs. +For an example, consider the [native code used to implement `instanceof`](#instanceof). When translating a reference to `instanceof` in Java source code, JLang emits a call to this native code with the correct arguments. The runtime build system is responsible for compiling runtime code into a shared library which should be linked with user programs. The runtime is also responsible for keeping track of runtime type information, and implementing much of the functionality that the JVM would normally implement. @@ -284,7 +284,7 @@ This is also when the static initializers for the class are run. In order to implement this behavior, we emit class loading checks before every static field access, static method call, or new instance creation. If a class has not been loaded yet, then we call it's "class loading function": -a special function emitted by PolyLLVM for each class that will allocate a new +a special function emitted by JLang for each class that will allocate a new `java.lang.Class` object, ensure the super class has been loaded, run all static initializers, and register runtime type information with native runtime code. @@ -297,7 +297,7 @@ The LLVM C API requires that code be emitted as a collection of basic blocks. Th > After traversing an AST subtree, all paths through the corresponding CFG end at a common block, and the instruction builder is positioned at the end of this block. -For example, an if-statement will (1) build the conditional branch, (2) position the builder at the `true` block, (3) recurse into the `consequent` child, (4) position the builder at the `false` block, and (5) recurse into the `alternative` child. After each recursion it adds a branch to the end block (unless there is already a terminating instruction). Finally, it positions the builder at the end block. See `PolyLLVMIfExt` to see this in action. +For example, an if-statement will (1) build the conditional branch, (2) position the builder at the `true` block, (3) recurse into the `consequent` child, (4) position the builder at the `false` block, and (5) recurse into the `alternative` child. After each recursion it adds a branch to the end block (unless there is already a terminating instruction). Finally, it positions the builder at the end block. See `JLangIfExt` to see this in action. Unneeded AST Nodes @@ -315,7 +315,7 @@ Some AST extensions are unneeded, either because they do not require a translati Debugging Tips -------------- -If you have a PolyLLVM-compiled executable that crashes at runtime, the first +If you have a JLang-compiled executable that crashes at runtime, the first thing to do is use `lldb`. With `lldb` you can find exactly where the program crashes, and see the source code that corresponds to each stack frame. @@ -323,7 +323,7 @@ Once you find where the program is crashing, it's usually helpful to find the corresponding LLVM IR (within the `.ll` files corresponding to the Java class of interest). -Also take a look at PolyLLVM's `-dump-desugared` flag, which will print +Also take a look at JLang's `-dump-desugared` flag, which will print Java ASTs after the desugar passes have run. This desugared output will explicitly show many of Java's implicit language semantics (such as implicit type conversions). diff --git a/docs/index.md b/docs/index.md index 1c5a9013..9582da78 100644 --- a/docs/index.md +++ b/docs/index.md @@ -6,21 +6,21 @@ layout: default Overview -------- -PolyLLVM adds an LLVM backend to the [Polyglot](https://www.cs.cornell.edu/projects/polyglot/) compiler, translating Java into LLVM IR. See the [user manual](user-manual.html) to try it out, and the [developer guide](developer-guide.html) for an overview of the codebase. +JLang adds an LLVM backend to the [Polyglot](https://www.cs.cornell.edu/projects/polyglot/) compiler, translating Java into LLVM IR. See the [user manual](user-manual.html) to try it out, and the [developer guide](developer-guide.html) for an overview of the codebase. -PolyLLVM supports Java 7, as specified by the [JLS](https://docs.oracle.com/javase/specs/jls/se7/html/index.html). Since Polyglot additionally supports Java language extensions, and since it can generally translate these extensions down to vanilla Java, PolyLLVM should be interoperable with other Polyglot extensions by default. However, PolyLLVM also aims to be extensible, so that one can write direct translations to LLVM for language extensions when needed. +JLang supports Java 7, as specified by the [JLS](https://docs.oracle.com/javase/specs/jls/se7/html/index.html). Since Polyglot additionally supports Java language extensions, and since it can generally translate these extensions down to vanilla Java, JLang should be interoperable with other Polyglot extensions by default. However, JLang also aims to be extensible, so that one can write direct translations to LLVM for language extensions when needed. -To be more concrete, here's what Polyglot + PolyLLVM will allow you to do: +To be more concrete, here's what Polyglot + JLang will allow you to do: (1) Translate Java source files (`.java`) down to LLVM IR (`.ll`), and then from there down to object files (`.o`) using the the [LLVM](https://llvm.org) toolchain. -(2) Link object files together along with PolyLLVM-compiled [OpenJDK](http://openjdk.java.net/projects/jdk7/) classes to create a standalone executable. PolyLLVM implements a runtime to provide the JVM functionality that the JDK expects, such as reflection and cross-language method calls. Native code in the JDK (e.g., low-level networking and I/O code) can be linked directly from your local JDK installation. +(2) Link object files together along with JLang-compiled [OpenJDK](http://openjdk.java.net/projects/jdk7/) classes to create a standalone executable. JLang implements a runtime to provide the JVM functionality that the JDK expects, such as reflection and cross-language method calls. Native code in the JDK (e.g., low-level networking and I/O code) can be linked directly from your local JDK installation. -(3) (Optional) Extend Java with custom language features or type annotations using Polyglot, and either translate these features back into vanilla Java, or write a direct translation into LLVM IR by extending PolyLLVM. +(3) (Optional) Extend Java with custom language features or type annotations using Polyglot, and either translate these features back into vanilla Java, or write a direct translation into LLVM IR by extending JLang. Status ------ -PolyLLVM currently supports all Java 7 language features, except concurrency support. This includes expressions, control flow, exceptions, method dispatch, switch statements, try-with-resources, initializer blocks, implicit type conversions, etc. OpenJDK 7 support is still a work in progress. +JLang currently supports all Java 7 language features, except concurrency support. This includes expressions, control flow, exceptions, method dispatch, switch statements, try-with-resources, initializer blocks, implicit type conversions, etc. OpenJDK 7 support is still a work in progress. -See the [README](https://github.com/gharrma/polyllvm) in the repository for the most up-to-date status. +See the [README](https://github.com/dz333/JLang) in the repository for the most up-to-date status. diff --git a/docs/thread-proposal.md b/docs/thread-proposal.md index 7384bb34..3fb10c85 100644 --- a/docs/thread-proposal.md +++ b/docs/thread-proposal.md @@ -14,7 +14,7 @@ Contents Introduction ------------ -Java provides library support for writing multi-threaded applications, mainly through the `Thread` class, and `Object` methods for synchronization. This proposal details implementing threading support in PolyLLVM using the `pthread` library. +Java provides library support for writing multi-threaded applications, mainly through the `Thread` class, and `Object` methods for synchronization. This proposal details implementing threading support in JLang using the `pthread` library. Object Header ------------- diff --git a/docs/user-manual.md b/docs/user-manual.md index 6b186b07..0c10ccd0 100644 --- a/docs/user-manual.md +++ b/docs/user-manual.md @@ -14,9 +14,9 @@ Contents Installation ------------ -Note: PolyLLVM is not tested on Windows. +Note: JLang is not tested on Windows. -Clone the [repo](https://github.com/gharrma/polyllvm) and build using the "Quick start guide" section of the [README](https://github.com/gharrma/polyllvm/blob/master/README.md). +Clone the [repo](https://github.com/dz333/JLang) and build using the "Quick start guide" section of the [README](https://github.com/dz333/JLang/blob/master/README.md). Compiling Hello World @@ -25,7 +25,7 @@ Compiling Hello World Create a simple `HelloWorld.java` file, printing to stdout using `System.out.println()`. Compile using ``` -$ bin/polyllvmc -cp jdk-lite/out/classes HelloWorld.java +$ bin/jlangc -cp jdk-lite/out/classes HelloWorld.java ``` This will output a file called `HelloWorld.ll`, which will contain human-readable LLVM IR. diff --git a/jdk-lite/Makefile b/jdk-lite/Makefile index c40781af..73c98c53 100644 --- a/jdk-lite/Makefile +++ b/jdk-lite/Makefile @@ -40,7 +40,7 @@ $(CLS_STAMP): $(JAVA_SRC) # Compile JDK Java code (.java --> .ll) $(JAVA_LL): $(JAVA_SRC) $(PLC_SRC) - @echo "Compiling $(words $(JAVA_SRC)) Java files with PolyLLVM (.java --> .ll)" + @echo "Compiling $(words $(JAVA_SRC)) Java files with JLang (.java --> .ll)" @# We compile java.lang.Object separately, since otherwise @# we get duplicate class errors from Polyglot. (TODO) @$(PLC) -c -d $(OUT) $(DEBUG_FLAGS) $(filter %Object.java,$(JAVA_SRC)) > dump.txt diff --git a/jdk-lite/src/java/lang/JLangNotImplementedError.java b/jdk-lite/src/java/lang/JLangNotImplementedError.java new file mode 100644 index 00000000..9bed6068 --- /dev/null +++ b/jdk-lite/src/java/lang/JLangNotImplementedError.java @@ -0,0 +1,12 @@ +package java.lang; + +public class JLangNotImplementedError extends RuntimeException { + + public JLangNotImplementedError() { + super(); + } + + public JLangNotImplementedError(String s) { + super(s); + } +} diff --git a/jdk-lite/src/java/lang/PolyLLVMNotImplementedError.java b/jdk-lite/src/java/lang/PolyLLVMNotImplementedError.java deleted file mode 100644 index 64693dff..00000000 --- a/jdk-lite/src/java/lang/PolyLLVMNotImplementedError.java +++ /dev/null @@ -1,12 +0,0 @@ -package java.lang; - -public class PolyLLVMNotImplementedError extends RuntimeException { - - public PolyLLVMNotImplementedError() { - super(); - } - - public PolyLLVMNotImplementedError(String s) { - super(s); - } -} diff --git a/jdk/Makefile b/jdk/Makefile index e0e34557..4ff709f3 100644 --- a/jdk/Makefile +++ b/jdk/Makefile @@ -12,7 +12,7 @@ CLASSES := $(OUT)/classes NUM_JAVA_FILES := $(shell find $(JDK)/$(SRC) -name "*.java" | wc -l) #Magic Multiplier for now. TODO calculate this a better way RUN_COUNT := $(shell echo "2 * $(NUM_JAVA_FILES)" | bc) -# PolyLLVM flags when compiling the JDK. +# JLANG flags when compiling the JDK. PLC_FLAGS := -assert -method-filter jdk-method-filter.txt -sourcepath $(SRC) all: $(LIBJDK) @@ -27,7 +27,7 @@ $(SRC): | $(SRC).zip @unzip -q -d $@ $(SRC).zip @cp -r $(SRC) $(SRC).orig -# Path JDK sources to work around PolyLLVM unimplemented features. +# Path JDK sources to work around JLang unimplemented features. $(SRC)/patchstamp: | $(SRC) @echo "Patching JDK source files" @for f in `find $(PATCHES) -name "*.patch"`; do patch -p0 < "$$f"; done diff --git a/jdk/README.md b/jdk/README.md index 99495335..881a10a9 100644 --- a/jdk/README.md +++ b/jdk/README.md @@ -1,7 +1,7 @@ JDK === -This directory contains source code for OpenJDK 7, and a build system for compiling the JDK with PolyLLVM to produce a shared library. +This directory contains source code for OpenJDK 7, and a build system for compiling the JDK with JLang to produce a shared library. The OpenJDK codebase is available directly from the [openjdk](http://openjdk.java.net/guide/repositories.html#clone) website, or from one of several git clones such as [this one](https://github.com/dmlloyd/openjdk). However, many JDK Java source files are script-generated, and the build system for JDK 7 is notoriously difficult to configure. So for convenience we track a zip file that contains all JDK sources, prebuilt. This zip file was obtained from [here](https://sourceforge.net/projects/jdk7src/). @@ -10,14 +10,14 @@ Building The Makefile in this directory will: (1) Extract JDK source files from the tracked zip file.