Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added unit tests as benchmark #29

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core-lib
Submodule core-lib updated 138 files
3 changes: 2 additions & 1 deletion rebench.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -53,6 +53,7 @@ benchmark_suites:
- FieldLoop: {extra_args: 1}
- WhileLoop: {extra_args: 10}
- Mandelbrot: {extra_args: 30}
- Test

micro-somsom:
gauge_adapter: RebenchLog
Expand Down
11 changes: 10 additions & 1 deletion src/som/compiler/ClassGenerationContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<SInvokable> 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 {
Expand Down
2 changes: 1 addition & 1 deletion src/som/compiler/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down