Skip to content

Commit

Permalink
Remove SimpleLanguage (it's no longer needed) from part 13.
Browse files Browse the repository at this point in the history
  • Loading branch information
skinny85 committed Jan 6, 2024
1 parent b886cae commit 8047e1c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 44 deletions.
1 change: 0 additions & 1 deletion part-13/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ plugins {
dependencies {
antlr "org.antlr:antlr4:$antlr_version"
implementation "org.graalvm.js:js:$graal_version"
implementation "org.graalvm.truffle:truffle-sl:$graal_version"
implementation "org.graalvm.tools:profiler:$graal_version"
implementation "org.apache.commons:commons-text:1.10.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,6 @@ public void setup() {

this.truffleContext.eval("js", COUNTER_CLASS);
this.truffleContext.eval("js", COUNT_WITH_THIS_IN_FOR);

this.truffleContext.eval("sl", "" +
"function countWithThisInFor(n) { " +
" counter = new(); " +
" i = 1; " +
" while (i <= n) { " +
" counter.count = i; " +
" i = i + 1; " +
" } " +
" return counter.count; " +
"}"
);
}

private static final String COUNT_WITH_THIS_IN_FOR = "" +
Expand All @@ -56,13 +44,4 @@ public int count_with_this_in_for_ezs() {
public int count_with_this_in_for_js() {
return this.truffleContext.eval("js", "countWithThisInFor(" + INPUT + ");").asInt();
}

@Benchmark
public int count_with_this_in_for_sl() {
return this.truffleContext.eval("sl", "" +
"function main() { " +
" return countWithThisInFor(" + INPUT + ");" +
"}"
).asInt();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -187,26 +187,4 @@ public void benchmark_returns_its_input() {
);
assertEquals(input, result.asInt());
}

@Test
public void simplelang_benchmark_returns_its_input() {
var input = 100;
this.context.eval("sl", "" +
"function countWithThisInFor(n) { " +
" counter = new(); " +
" i = 1; " +
" while (i <= n) { " +
" counter.count = i; " +
" i = i + 1; " +
" } " +
" return counter.count; " +
"}");

Value result = this.context.eval("sl", "" +
"function main() { " +
" return countWithThisInFor(" + input + ");" +
"}"
);
assertEquals(input, result.asInt());
}
}

0 comments on commit 8047e1c

Please sign in to comment.