From a968752e512e212e25d29ac9f800432cfe773aa7 Mon Sep 17 00:00:00 2001 From: Stefan Marr Date: Wed, 13 Oct 2021 18:51:02 +0100 Subject: [PATCH 1/3] Added unit tests as benchmark Signed-off-by: Stefan Marr --- core-lib | 2 +- rebench.conf | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core-lib b/core-lib index b0c4abf..2b94376 160000 --- a/core-lib +++ b/core-lib @@ -1 +1 @@ -Subproject commit b0c4abfa9096ba845b2113ad872b599883cfe624 +Subproject commit 2b94376e882c13ceeea870c44e847893b55857b9 diff --git a/rebench.conf b/rebench.conf index f42ac1f..09bac46 100644 --- a/rebench.conf +++ b/rebench.conf @@ -30,7 +30,7 @@ benchmark_suites: micro: gauge_adapter: RebenchLog - command: "-cp Smalltalk:Examples/Benchmarks/LanguageFeatures Examples/Benchmarks/BenchmarkHarness.som %(benchmark)s %(iterations)s 0 " + command: "-cp Smalltalk:Examples/Benchmarks/LanguageFeatures:Examples/Benchmarks/TestSuite Examples/Benchmarks/BenchmarkHarness.som %(benchmark)s %(iterations)s 0 " iterations: 10 benchmarks: - Fannkuch: {extra_args: 6} @@ -53,6 +53,7 @@ benchmark_suites: - FieldLoop: {extra_args: 1} - WhileLoop: {extra_args: 10} - Mandelbrot: {extra_args: 30} + - Test micro-somsom: gauge_adapter: RebenchLog From af02212c245cecc500aedda52a6df49d1fc996f2 Mon Sep 17 00:00:00 2001 From: Stefan Marr Date: Wed, 13 Oct 2021 20:45:56 +0100 Subject: [PATCH 2/3] Detect methods with duplicated name Signed-off-by: Stefan Marr --- src/som/compiler/ClassGenerationContext.java | 11 ++++++++++- src/som/compiler/Parser.java | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/som/compiler/ClassGenerationContext.java b/src/som/compiler/ClassGenerationContext.java index e0af29c..18ccacd 100644 --- a/src/som/compiler/ClassGenerationContext.java +++ b/src/som/compiler/ClassGenerationContext.java @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.List; +import som.compiler.Parser.ParseError; import som.vm.Universe; import som.vmobjects.SArray; import som.vmobjects.SClass; @@ -76,7 +77,15 @@ public void setClassFieldsOfSuper(final SArray fieldNames) { } } - public void addMethod(final som.vmobjects.SInvokable meth) { + public void addMethod(final som.vmobjects.SInvokable meth, final Parser parser) throws ParseError { + List methods = classSide ? classMethods : instanceMethods; + + for (SInvokable i : methods) { + if (i.getSignature() == meth.getSignature()) { + String msg = "A method with name " + meth.getSignature().getEmbeddedString() + " is already declared in " + name.getEmbeddedString(); + throw new ParseError(msg, Symbol.NONE, parser); + } + } if (classSide) { classMethods.add(meth); } else { diff --git a/src/som/compiler/Parser.java b/src/som/compiler/Parser.java index 5d453d5..ced430f 100644 --- a/src/som/compiler/Parser.java +++ b/src/som/compiler/Parser.java @@ -219,7 +219,7 @@ private void classBody() throws ProgramDefinitionError { mgenc.addArgument("self"); method(mgenc); - cgenc.addMethod(mgenc.assemble(universe)); + cgenc.addMethod(mgenc.assemble(universe), this); } } From 57a33ed168e2951e347040f6d58481b7800d8036 Mon Sep 17 00:00:00 2001 From: Stefan Marr Date: Wed, 13 Oct 2021 20:46:07 +0100 Subject: [PATCH 3/3] Update core-lib Signed-off-by: Stefan Marr --- core-lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core-lib b/core-lib index 2b94376..8cad58f 160000 --- a/core-lib +++ b/core-lib @@ -1 +1 @@ -Subproject commit 2b94376e882c13ceeea870c44e847893b55857b9 +Subproject commit 8cad58f59c1be59eb579d7084f55ebb3c3663224