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

SomSom - A Metacircular SOM #11

Merged
merged 4 commits into from
Apr 11, 2021
Merged
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
8 changes: 6 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ jobs:
run: |
ant test

- name: SomSom Tests
run: |
./som.sh -cp core-lib/Smalltalk:core-lib/TestSuite:core-lib/SomSom/src/compiler:core-lib/SomSom/src/vm:core-lib/SomSom/src/vmobjects:core-lib/SomSom/src/interpreter:core-lib/SomSom/src/primitives \
core-lib/SomSom/tests/SomSomTests.som

- name: CheckStyle
run: |
ant checkstyle
Expand All @@ -25,8 +30,7 @@ jobs:
export ECLIPSE_URL=https://ftp.halifax.rwth-aachen.de/eclipse/eclipse/downloads/drops4/R-4.17-202009021800/eclipse-SDK-4.17-linux-gtk-x86_64.tar.gz
wget ${ECLIPSE_URL} -O ${ECLIPSE_TAR}
tar -C ${GITHUB_WORKSPACE}/.. -xzf ${ECLIPSE_TAR}



- name: Check Eclipse Format
run: |
export ECLIPSE_EXE=${GITHUB_WORKSPACE}/../eclipse/eclipse
Expand Down
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ som:
script:
- ant test
- ./som.sh -cp ./Smalltalk ./TestSuite/TestHarness.som
- ./som.sh -cp core-lib/Smalltalk:core-lib/TestSuite:core-lib/SomSom/src/compiler:core-lib/SomSom/src/vm:core-lib/SomSom/src/vmobjects:core-lib/SomSom/src/interpreter:core-lib/SomSom/src/primitives core-lib/SomSom/tests/SomSomTests.som
- ant checkstyle

- rebench --experiment="CI ID $CI_PIPELINE_ID" --branch="$CI_COMMIT_REF_NAME" -c rebench.conf all
Expand Down
2 changes: 1 addition & 1 deletion core-lib
Submodule core-lib updated 45 files
+153 −0 .github/workflows/ci.yml
+0 −108 .travis.yml
+1 −1 Smalltalk/System.som
+86 −0 SomSom/src/compiler/BytecodeGenerator.som
+124 −0 SomSom/src/compiler/ClassGenerationContext.som
+112 −0 SomSom/src/compiler/Disassembler.som
+292 −0 SomSom/src/compiler/Lexer.som
+216 −0 SomSom/src/compiler/MethodGenerationContext.som
+731 −0 SomSom/src/compiler/Parser.som
+34 −0 SomSom/src/compiler/SourcecodeCompiler.som
+33 −0 SomSom/src/interpreter/Bytecodes.som
+209 −0 SomSom/src/interpreter/Frame.som
+303 −0 SomSom/src/interpreter/Interpreter.som
+40 −0 SomSom/src/primitives/ArrayPrimitives.som
+15 −0 SomSom/src/primitives/BlockPrimitives.som
+40 −0 SomSom/src/primitives/ClassPrimitives.som
+124 −0 SomSom/src/primitives/DoublePrimitives.som
+197 −0 SomSom/src/primitives/IntegerPrimitives.som
+22 −0 SomSom/src/primitives/MethodPrimitives.som
+98 −0 SomSom/src/primitives/ObjectPrimitives.som
+22 −0 SomSom/src/primitives/PrimitivePrimitives.som
+30 −0 SomSom/src/primitives/Primitives.som
+73 −0 SomSom/src/primitives/StringPrimitives.som
+25 −0 SomSom/src/primitives/SymbolPrimitives.som
+108 −0 SomSom/src/primitives/SystemPrimitives.som
+14 −0 SomSom/src/vm/Main.som
+570 −0 SomSom/src/vm/Universe.som
+48 −0 SomSom/src/vmobjects/SAbstractObject.som
+54 −0 SomSom/src/vmobjects/SArray.som
+60 −0 SomSom/src/vmobjects/SBlock.som
+193 −0 SomSom/src/vmobjects/SClass.som
+22 −0 SomSom/src/vmobjects/SDouble.som
+23 −0 SomSom/src/vmobjects/SInteger.som
+87 −0 SomSom/src/vmobjects/SMethod.som
+53 −0 SomSom/src/vmobjects/SObject.som
+63 −0 SomSom/src/vmobjects/SPrimitive.som
+22 −0 SomSom/src/vmobjects/SString.som
+44 −0 SomSom/src/vmobjects/SSymbol.som
+180 −0 SomSom/tests/BasicInterpreterTests.som
+118 −0 SomSom/tests/FrameTests.som
+176 −0 SomSom/tests/LexerTests.som
+212 −0 SomSom/tests/ParserTests.som
+11 −0 SomSom/tests/ParserWithError.som
+10 −0 SomSom/tests/SomSomTests.som
+45 −0 SomSom/tests/SomTests.som
24 changes: 23 additions & 1 deletion rebench.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ reporting:
project_name: SOM

runs:
max_invocation_time: 60
max_invocation_time: 120

benchmark_suites:
macro:
Expand Down Expand Up @@ -53,9 +53,25 @@ benchmark_suites:
- FieldLoop: {extra_args: 1}
- WhileLoop: {extra_args: 10}
- Mandelbrot: {extra_args: 30}

micro-somsom:
gauge_adapter: RebenchLog
command: "-cp Smalltalk:Examples/Benchmarks/LanguageFeatures Examples/Benchmarks/BenchmarkHarness.som %(benchmark)s %(iterations)s 0 "
iterations: 1
benchmarks:
- Loop: {extra_args: 1}
- Queens: {extra_args: 1}
- List: {extra_args: 1}
- Recurse: {extra_args: 1}
- Mandelbrot: {extra_args: 3}

executors:
som: {path: ., executable: som.sh}
somsom:
path: .
executable: som.sh
args: "-cp core-lib/Smalltalk:core-lib/TestSuite:core-lib/SomSom/src/compiler:core-lib/SomSom/src/vm:core-lib/SomSom/src/vmobjects:core-lib/SomSom/src/interpreter:core-lib/SomSom/src/primitives core-lib/SomSom/src/vm/Main.som"


# define the benchmarks to be executed for a re-executable benchmark run
experiments:
Expand All @@ -66,3 +82,9 @@ experiments:
- macro
executions:
- som
SomSom:
description: Running a few SomSom benchmarks on SOM (Java)
suites:
- micro-somsom
executions:
- somsom
30 changes: 15 additions & 15 deletions src/som/vm/Universe.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.StringTokenizer;
Expand Down Expand Up @@ -127,13 +128,15 @@ public void errorExit(final String message) {
exit(1);
}

private String[] handleArguments(String[] arguments) {
private String[] handleArguments(final String[] arguments) {
boolean gotClasspath = false;
String[] remainingArgs = new String[arguments.length];
int cnt = 0;
ArrayList<String> remainingArgs = new ArrayList<>();

// read dash arguments only while we haven't seen other kind of arguments
boolean sawOthers = false;

for (int i = 0; i < arguments.length; i++) {
if (arguments[i].equals("-cp")) {
if (arguments[i].equals("-cp") && !sawOthers) {
if (i + 1 >= arguments.length) {
printUsageAndExit();
}
Expand All @@ -142,10 +145,11 @@ private String[] handleArguments(String[] arguments) {
++i; // skip class path
// Checkstyle: resume
gotClasspath = true;
} else if (arguments[i].equals("-d")) {
} else if (arguments[i].equals("-d") && !sawOthers) {
dumpBytecodes = true;
} else {
remainingArgs[cnt++] = arguments[i];
sawOthers = true;
remainingArgs.add(arguments[i]);
}
}

Expand All @@ -154,25 +158,21 @@ private String[] handleArguments(String[] arguments) {
classPath = setupDefaultClassPath(0);
}

// Copy the remaining elements from the original array into the new
// array
arguments = new String[cnt];
System.arraycopy(remainingArgs, 0, arguments, 0, cnt);
// check first of remaining args for class paths, and strip file extension

// check remaining args for class paths, and strip file extension
for (int i = 0; i < arguments.length; i++) {
String[] split = getPathClassExt(arguments[i]);
if (!remainingArgs.isEmpty()) {
String[] split = getPathClassExt(remainingArgs.get(0));

if (!("".equals(split[0]))) { // there was a path
String[] tmp = new String[classPath.length + 1];
System.arraycopy(classPath, 0, tmp, 1, classPath.length);
tmp[0] = split[0];
classPath = tmp;
}
arguments[i] = split[1];
remainingArgs.set(0, split[1]);
}

return arguments;
return remainingArgs.toArray(new String[remainingArgs.size()]);
}

// take argument of the form "../foo/Test.som" and return
Expand Down