diff --git a/pom.xml b/pom.xml index ba25e6d..a7d79ba 100644 --- a/pom.xml +++ b/pom.xml @@ -36,9 +36,9 @@ org.rascalmpl rascal-maven-plugin - 0.26.3-BOOT1 + 0.28.5 - true + false ${project.build.outputDirectory} ${project.basedir}/src @@ -160,7 +160,7 @@ org.rascalmpl rascal - 0.34.0 + 0.40.11 org.ow2.asm diff --git a/src/lang/flybytes/Decompiler.rsc b/src/lang/flybytes/Decompiler.rsc index 5992801..476673f 100644 --- a/src/lang/flybytes/Decompiler.rsc +++ b/src/lang/flybytes/Decompiler.rsc @@ -62,7 +62,7 @@ Method decompile(Method m:static([asm(list[Instruction] instrs)]), bool cleanup= return cleanup? m[block=done] : m[block=[asm(withStat)]]; } -Method decompile(Method m) = m when \abstract in m.modifiers; +default Method decompile(Method m, bool cleanup=true) = m when \abstract in m.modifiers; // LINES: data Instruction(int LINE = -1); @@ -612,8 +612,8 @@ BinOp binOp("ALOAD") = aload; alias UnOp = Exp (Exp); -UnOp invertedCond("NULL") = nonnull; -UnOp invertedCond("NONNULL") = null; +UnOp invertedUnaryCond("NULL") = nonnull; +UnOp invertedUnaryCond("NONNULL") = null; Exp nonnull(Exp e) = ne(e, null()); Exp null(Exp e) = eq(e, null()); diff --git a/src/lang/flybytes/demo/protol/Compiler.rsc b/src/lang/flybytes/demo/protol/Compiler.rsc index 0ff1460..eed94d6 100644 --- a/src/lang/flybytes/demo/protol/Compiler.rsc +++ b/src/lang/flybytes/demo/protol/Compiler.rsc @@ -99,9 +99,9 @@ Stat compile((Command) `print ;`) = stdout(compile(e)); Exp compile(e:(Expr) `this`) = load("this", src=e@\loc); Exp compile((Expr) `.(<{Expr ","}* args>)`) - = invokeDynamic(bootstrap(Prototype, "bootstrap", []), methodDesc(Prototype, "", [Prototype]/*receiver*/ + [Prototype | _ <- args] ), [compile(rec), *compile(args) ])[src=name@\loc]; + = invokeDynamic(bootstrap(Prototype, "bootstrap", []), methodDesc(Prototype, "", [Prototype]/*receiver*/ + [Prototype | _ <- args] ), [compile(rec), *compileList(args) ])[src=name@\loc]; -list[Exp] compile({Expr ","}* args) = [compile(a)[src=a@\loc] | a <- args]; +list[Exp] compileList({Expr ","}* args) = [compile(a)[src=a@\loc] | a <- args]; Exp compile(x:(Expr) `[<{Expr ","}* elems>]`) = new(Arr, [array(Prototype)], [newInitArray(array(Prototype), [compile(e) | e <- elems])])[src=x@\loc]; diff --git a/src/lang/flybytes/internal/ASTgen.rsc b/src/lang/flybytes/internal/ASTgen.rsc index 9a173cc..976bff6 100644 --- a/src/lang/flybytes/internal/ASTgen.rsc +++ b/src/lang/flybytes/internal/ASTgen.rsc @@ -200,7 +200,7 @@ str type2FactoryCall(Symbol t){ case \str() : return "IString"; case \datetime() : return "IDateTime"; case \tuple(_) : return "ITuple"; - case \func(_, _): return "ICallableValue"; + case \func(_, _, _): return "ICallableValue"; case \alias(_,_,a) : return typeToJavaType(a); default : return "IValue"; } diff --git a/src/lang/flybytes/tests/ArithmeticTests.rsc b/src/lang/flybytes/tests/ArithmeticTests.rsc index f0bbfe5..3392e8c 100644 --- a/src/lang/flybytes/tests/ArithmeticTests.rsc +++ b/src/lang/flybytes/tests/ArithmeticTests.rsc @@ -38,7 +38,7 @@ Class unOpClass(Type t, UnOp op) { bool testBinOp(Class c, Type t, num lhs, num rhs, num answer) { m = loadClass(c); - reply = val(t, m.invokeStatic(methodDesc(t, "op", [t, t]), [prim(t, lhs), prim(t,rhs)])); + reply = intVal(t, m.invokeStatic(methodDesc(t, "op", [t, t]), [prim(t, lhs), prim(t,rhs)])); if (answer != reply) { println("op(,) == != "); @@ -50,7 +50,7 @@ bool testBinOp(Class c, Type t, num lhs, num rhs, num answer) { bool testUnOp(Class c, Type t, num arg, num answer) { m = loadClass(c); - reply = val(t, m.invokeStatic(methodDesc(t, "op", [t]), [prim(t, arg)])); + reply = intVal(t, m.invokeStatic(methodDesc(t, "op", [t]), [prim(t, arg)])); if (answer != reply) { println("op() == != "); @@ -62,10 +62,10 @@ bool testUnOp(Class c, Type t, num arg, num answer) { bool testBinOpRange(Class c, Type t, num lhs, num rhs, real answer) { m = loadClass(c); - real reply = val(t, m.invokeStatic(methodDesc(t, "op", [t, t]), [prim(t, lhs), prim(t,rhs)])); + reply = realVal(t, m.invokeStatic(methodDesc(t, "op", [t, t]), [prim(t, lhs), prim(t,rhs)])); - if (abs(answer - reply) > 0.1) { - println("op(,) == != (diff: )"); + if (real r := reply, abs(answer - r) > 0.1) { + println("op(,) == != (diff: )"); return false; } @@ -74,7 +74,7 @@ bool testBinOpRange(Class c, Type t, num lhs, num rhs, real answer) { bool testUnOpRange(Class c, Type t, num arg, real answer) { m = loadClass(c); - real reply = val(t, m.invokeStatic(methodDesc(t, "op", [t]), [prim(t, arg)])); + real reply = realVal(t, m.invokeStatic(methodDesc(t, "op", [t]), [prim(t, arg)])); if (abs(answer - reply) > 0.1) { return false; @@ -87,12 +87,12 @@ list[Type] exactArithmeticTypes = [integer(), short(), byte(), long()]; test bool testNeg1(int i) = all(t <- exactArithmeticTypes, - I := i % maxValue(t), testUnOp(unOpClass(t, neg), t, I, -1 * I)); + I := i % maxIntValue(t), testUnOp(unOpClass(t, neg), t, I, -1 * I)); test bool testAdd2(int i, int j) = all (t <- exactArithmeticTypes, - I := (i % maxValue(t)) / 2, - J := (j % maxValue(t)) / 2, + I := (i % maxIntValue(t)) / 2, + J := (j % maxIntValue(t)) / 2, testBinOp(binOpClass(t, add), t, I, J, I + J)); test bool testMul2(int i, int j) @@ -103,20 +103,20 @@ test bool testMul2(int i, int j) test bool testSub2(int i, int j) = all (t <- exactArithmeticTypes, - I := (i % maxValue(t)) / 2, - J := ((j % maxValue(t)) / 2), + I := (i % maxIntValue(t)) / 2, + J := ((j % maxIntValue(t)) / 2), testBinOp(binOpClass(t, sub), t, I, J, I - J)); test bool testDivInt(int i, int j) = all (t <- exactArithmeticTypes, - I := (i % maxValue(t)), - J := abs(((j % maxValue(t)) / 2)) + 1, // never 0, + I := (i % maxIntValue(t)), + J := abs(((j % maxIntValue(t)) / 2)) + 1, // never 0, testBinOp(binOpClass(t, div), t, I, J, I / J)); test bool testRem(int i, int j) = all (t <- exactArithmeticTypes, - I := (i % maxValue(t)), - J := abs(((j % maxValue(t)) / 2)) + 1, // never 0, + I := (i % maxIntValue(t)), + J := abs(((j % maxIntValue(t)) / 2)) + 1, // never 0, testBinOp(binOpClass(t, rem), t, I, J, I % J)); list[Type] floatingPointTypes = [float(), double()]; @@ -159,7 +159,7 @@ private real round(float(), real f) = precision(f, 0); private real round(double(), real f) = precision(f, 0); private default int round(Type _, int f) = f; -private real val(float(), Mirror r) = r.toValue(#real); -private real val(double(), Mirror r) = r.toValue(#real); -private default int val(Type _, Mirror r) = r.toValue(#int); +private real realVal(float(), Mirror r) = r.toValue(#real); +private real realVal(double(), Mirror r) = r.toValue(#real); +private int intVal(Type _, Mirror r) = r.toValue(#int); diff --git a/src/lang/flybytes/tests/BranchingTests.rsc b/src/lang/flybytes/tests/BranchingTests.rsc index 659f40b..f95ff6a 100644 --- a/src/lang/flybytes/tests/BranchingTests.rsc +++ b/src/lang/flybytes/tests/BranchingTests.rsc @@ -88,46 +88,46 @@ list[str] condTypes = ["ifThenTest", "ifThenElseTest"]; test bool testEqTrue(int i) = all (t <- intTypes, - I := prim(t, abs(i) % maxValue(t)), cl <- condTypes, + I := prim(t, abs(i) % maxIntValue(t)), cl <- condTypes, testIf(ifCmpClass(t, eq), t, cl, I, I, true)); test bool testEqFalse(int i) = all (t <- intTypes, - I := abs(i) % maxValue(t), cl <- condTypes, + I := abs(i) % maxIntValue(t), cl <- condTypes, testIf(ifCmpClass(t, eq), t, cl, prim(t, I), prim(t, I - 1), false)); test bool testNEqTrue(int i) = all (t <- intTypes, - I := abs(i) % maxValue(t), cl <- condTypes, + I := abs(i) % maxIntValue(t), cl <- condTypes, testIf(ifCmpClass(t, ne), t, cl, prim(t, I), prim(t, I - 1), true)); test bool testNEqFalse(int i) = all (t <- intTypes, - I := prim(t, abs(i) % maxValue(t)), cl <- condTypes, + I := prim(t, abs(i) % maxIntValue(t)), cl <- condTypes, testIf(ifCmpClass(t, ne), t, cl, I, I, false)); test bool testLt(int i, int j) = all (t <- intTypes, - I := (i % maxValue(t)), - J := (j % maxValue(t)), cl <- condTypes, + I := (i % maxIntValue(t)), + J := (j % maxIntValue(t)), cl <- condTypes, testIf(ifCmpClass(t, lt), t, cl, prim(t, I), prim(t, J), I < J)); test bool testGt(int i, int j) = all (t <- intTypes, - I := (i % maxValue(t)), - J := (j % maxValue(t)), cl <- condTypes, + I := (i % maxIntValue(t)), + J := (j % maxIntValue(t)), cl <- condTypes, testIf(ifCmpClass(t, gt), t, cl, prim(t, I), prim(t, J), I > J)); test bool testGe(int i, int j) = all (t <- intTypes, - I := (i % maxValue(t)), - J := (j % maxValue(t)), cl <- condTypes, + I := (i % maxIntValue(t)), + J := (j % maxIntValue(t)), cl <- condTypes, testIf(ifCmpClass(t, ge), t, cl, prim(t, I), prim(t, J), I >= J)); test bool testLe(int i, int j) = all (t <- intTypes, - I := (i % maxValue(t)), - J := (j % maxValue(t)), cl <- condTypes, + I := (i % maxIntValue(t)), + J := (j % maxIntValue(t)), cl <- condTypes, testIf(ifCmpClass(t, le), t, cl, prim(t, I), prim(t, J), I <= J)); diff --git a/src/lang/flybytes/tests/VariableTests.rsc b/src/lang/flybytes/tests/VariableTests.rsc index 933f07b..1eb339a 100644 --- a/src/lang/flybytes/tests/VariableTests.rsc +++ b/src/lang/flybytes/tests/VariableTests.rsc @@ -44,7 +44,7 @@ bool testVarClass(Class c) { list[Type] intTypes = [integer(), long(), short(), character(), byte()]; test bool intVariables(int i) - = all(t <- intTypes, I := i % maxValue(t), testVarClass(primVarTestClass(t, I))); + = all(t <- intTypes, I := i % maxIntValue(t), testVarClass(primVarTestClass(t, I))); list[Type] floatTypes = [float(), double()];