Skip to content
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
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM --platform=linux/amd64 ubuntu:22.04

ARG DEBIAN_FRONTEND=noninteractive

Expand Down
33,996 changes: 33,996 additions & 0 deletions benchmarks/coreutils/gensym_posix/base32.ll

Large diffs are not rendered by default.

33,766 changes: 33,766 additions & 0 deletions benchmarks/coreutils/gensym_posix/base64.ll

Large diffs are not rendered by default.

31,916 changes: 31,916 additions & 0 deletions benchmarks/coreutils/gensym_posix/cat.ll

Large diffs are not rendered by default.

34,532 changes: 34,532 additions & 0 deletions benchmarks/coreutils/gensym_posix/comm.ll

Large diffs are not rendered by default.

34,022 changes: 34,022 additions & 0 deletions benchmarks/coreutils/gensym_posix/cut.ll

Large diffs are not rendered by default.

30,744 changes: 30,744 additions & 0 deletions benchmarks/coreutils/gensym_posix/dirname.ll

Large diffs are not rendered by default.

29,448 changes: 29,448 additions & 0 deletions benchmarks/coreutils/gensym_posix/echo.ll

Large diffs are not rendered by default.

32,066 changes: 32,066 additions & 0 deletions benchmarks/coreutils/gensym_posix/expand.ll

Large diffs are not rendered by default.

28,735 changes: 28,735 additions & 0 deletions benchmarks/coreutils/gensym_posix/false.ll

Large diffs are not rendered by default.

32,392 changes: 32,392 additions & 0 deletions benchmarks/coreutils/gensym_posix/fold.ll

Large diffs are not rendered by default.

37,858 changes: 37,858 additions & 0 deletions benchmarks/coreutils/gensym_posix/join.ll

Large diffs are not rendered by default.

30,597 changes: 30,597 additions & 0 deletions benchmarks/coreutils/gensym_posix/link.ll

Large diffs are not rendered by default.

31,833 changes: 31,833 additions & 0 deletions benchmarks/coreutils/gensym_posix/paste.ll

Large diffs are not rendered by default.

31,299 changes: 31,299 additions & 0 deletions benchmarks/coreutils/gensym_posix/pathchk.ll

Large diffs are not rendered by default.

28,735 changes: 28,735 additions & 0 deletions benchmarks/coreutils/gensym_posix/true.ll

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions headers/gensym/runtime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <utility>
#include <variant>
#include <vector>
#include <unistd.h>

namespace gensym::runtime::v1 {

Expand Down Expand Up @@ -186,6 +187,10 @@ Value int_op_3(iOP, Value, Value, Value);
Value float_op_2(fOP, Value, Value);
Value bv_sext(Value, std::size_t);
Value bv_zext(Value, std::size_t);
Value fp_toui(Value, std::size_t);
Value fp_tosi(Value, std::size_t);
Value ui_tofp(Value);
Value si_tofp(Value);
Value trunc(Value, int, int);
Value ite(Value, Value, Value);
Value ptr_add(Value, Value);
Expand Down
4 changes: 4 additions & 0 deletions runtime/runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ Value int_op_3(iOP op, Value a, Value b, Value c) { return Bridge::wrap(::int_op
Value float_op_2(fOP op, Value lhs, Value rhs) { return Bridge::wrap(::float_op_2(static_cast<::fOP>(op), Bridge::unwrap(lhs), Bridge::unwrap(rhs))); }
Value bv_sext(Value value, std::size_t bw) { return Bridge::wrap(::bv_sext(Bridge::unwrap(value), bw)); }
Value bv_zext(Value value, std::size_t bw) { return Bridge::wrap(::bv_zext(Bridge::unwrap(value), bw)); }
Value fp_toui(Value value, std::size_t bw) { return Bridge::wrap(::fp_toui(Bridge::unwrap(value), bw)); }
Value fp_tosi(Value value, std::size_t bw) { return Bridge::wrap(::fp_tosi(Bridge::unwrap(value), bw)); }
Value ui_tofp(Value value) { return Bridge::wrap(::ui_tofp(Bridge::unwrap(value))); }
Value si_tofp(Value value) { return Bridge::wrap(::si_tofp(Bridge::unwrap(value))); }
Value trunc(Value value, int from, int to) { return Bridge::wrap(::trunc(Bridge::unwrap(value), from, to)); }
Value ite(Value condition, Value then_value, Value else_value) { return Bridge::wrap(::ite(Bridge::unwrap(condition), Bridge::unwrap(then_value), Bridge::unwrap(else_value))); }
Value ptr_add(Value pointer, Value offset) { return Bridge::wrap(::ptr_add(Bridge::unwrap(pointer), Bridge::unwrap(offset))); }
Expand Down
22 changes: 17 additions & 5 deletions src/main/scala/llvm/Benchmarks.scala
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,23 @@ object TestComp {
}
}

object Coreutils {
// TODO: clean this up
lazy val echo = parseFile("benchmarks/coreutils/echo/echo.ll")
lazy val echoWithLib = parseFile("benchmarks/coreutils/echo/echoStdlibString.ll")
lazy val trueWithLib = parseFile("benchmarks/coreutils/trueWithLib.ll")
object CoreutilsPOSIX {
val prefix = "benchmarks/coreutils/gensym_posix"
lazy val echo = parseFile(s"$prefix/echo.ll")
lazy val cat = parseFile(s"$prefix/cat.ll")
lazy val tru = parseFile(s"$prefix/true.ll")
lazy val fls = parseFile(s"$prefix/false.ll")
lazy val base32 = parseFile(s"$prefix/base32.ll")
lazy val base64 = parseFile(s"$prefix/base64.ll")
lazy val comm = parseFile(s"$prefix/comm.ll")
lazy val cut = parseFile(s"$prefix/cut.ll")
lazy val dirname = parseFile(s"$prefix/dirname.ll")
lazy val expand = parseFile(s"$prefix/expand.ll")
lazy val fold = parseFile(s"$prefix/fold.ll")
lazy val join = parseFile(s"$prefix/join.ll")
lazy val link = parseFile(s"$prefix/link.ll")
lazy val paste = parseFile(s"$prefix/paste.ll")
lazy val pathchk = parseFile(s"$prefix/pathchk.ll")
}

object OOPSLA20Benchmarks {
Expand Down
24 changes: 7 additions & 17 deletions src/test/scala/gensym/TestGS.scala
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,6 @@ class TestImpCPSGS_Z3 extends TestGS {
Global.config.symbolicUninit = false
}

/*
class Coreutils extends TestGS {
import gensym.llvm.parser.Parser._
Global.config.enableOpt
val runtimeOptions = "--output-tests-cov-new --thread=1 --search=random-path --solver=z3 --output-ktest --cons-indep".split(" +").toList.toSeq
val cases = TestCases.coreutils.map { t =>
t.copy(runOpt = runtimeOptions ++ t.runOpt, runCode = false)
}
testGS(new ImpCPSGS, cases)

//testGS(new ImpCPSGS, TestPrg(cat_linked, "cat_linked_posix", "@main", noMainFileOpt, "--argv=./cat.bc --sym-stdout --sym-stdin 2 --sym-arg 2", nPath(28567)++status(0)))
}
*/

class TestLibrary extends TestGS {
testGS(new ImpCPSGS_lib, TestPrg(linkLib, "libtest", "@main", useArgv, noOpt, nPath(1)++status(0), false))
testGS(new ImpCPSGS_app, TestPrg(linkApp, "libapp", "@main", useArgv, "--argv=''", nPath(1)++status(0)), s"${outputDir}/libtest")
Expand All @@ -209,8 +195,12 @@ class Playground extends TestGS {
val gs = new ImpCPSGS
val rtOpt = "--thread=1 --solver=z3"

val cases = TestCases.coreutils.map { t =>
t.copy(runOpt = t.runOpt ++ Seq("--solver=z3"))
}
//val cases = CoreutilsPOSIX.coreutils

val cases = List(TestPrg(
CoreutilsPOSIX.echo,
"echo_linked_posix", "@main", noMainFileOpt,
"--output-tests-cov-new --thread=1 --search=random-path --solver=z3 --output-ktest --argv=./echo.bc --sym-stdout --sym-arg 2 --sym-arg 7",
nPath(216136)++status(0)))
testGS(gs, cases)
}
Loading