Just another Lisp https://serene-lang.org
Go to file
Sameer Rahmani 94b9479c29 Update the logo for dark backgrounds 2023-01-26 12:57:29 +00:00
cmake Add new doxygen setup 2022-02-12 22:25:22 +00:00
core Create a PoC to setup the stdlib calls via serene.core 2022-07-23 11:09:15 +01:00
devtools Fix the broken include in types.cpp 2022-06-11 18:07:09 +01:00
docs Add the spec around loading Serene libs vs generic libs (not completed) 2022-07-12 00:35:32 +01:00
libserene Move to the llvm 7240436c94bd02762a723a2e3551528d16c8efdb commit 2022-09-13 19:30:13 +01:00
libserene.v0 Move the old libserene aside and start a new one 2022-06-13 20:34:55 +01:00
resources Update the logo for dark backgrounds 2023-01-26 12:57:29 +00:00
scripts Fix all the linter warnings 2022-07-10 07:52:15 +01:00
serene-repl Refactore the compiler/linker options to add asan only on executables 2022-07-22 20:11:46 +01:00
serene-tblgen Move over SereneContext and remove the old bits 2022-06-13 22:18:58 +01:00
serenec Extract the packer related functions out of the JIT 2022-07-24 20:56:40 +01:00
.ci.yml Add LLVM_USE_PERF option to account for the same flag in target llvm 2022-06-18 11:05:54 +01:00
.clang-format Hide the clang-tidy behind a build option 2021-10-17 22:22:49 +01:00
.clang-tidy Add the more resouces about JIT to dev.org 2021-12-29 13:12:36 +00:00
.dockerignore Setup the dockerfiles necessary to build serene in a container 2022-02-08 17:43:29 +00:00
.env.example Fix all the linter warnings 2022-07-10 07:52:15 +01:00
.gitignore Add .tmp to gitignore 2022-07-06 21:33:51 +01:00
.ignore_sanitize Fix the broken bash array to str process in the builder 2022-06-12 20:40:36 +01:00
.pre-commit-config.yaml Add the build-in-devfs command to builder 2022-07-12 00:34:30 +01:00
CMakeLists.txt Refactore the compiler/linker options to add asan only on executables 2022-07-22 20:11:46 +01:00
LICENSE Add include-fixer to pre-commit 2022-06-12 22:34:12 +01:00
README.org Move to the llvm 7240436c94bd02762a723a2e3551528d16c8efdb commit 2022-09-13 19:30:13 +01:00
builder Upgrade llvm version on the builder 2023-01-19 15:14:27 +00:00
dev.org Add the conversation around jit and libasan to dev.org for the future reference 2022-07-22 20:12:58 +01:00

README.org

Serene lang

Build Status: https://drone.devheroes.codes/api/badges/Serene/Serene/status.svg

Setup development environment

Setup the githook and install dependencies using the following commands:

./builder setup

Dependencies

You would need the following dependencies to start get started with Serene development

  • LLVM (LLVM Instructions coming up.)
  • cmake
  • ninja
  • doxygen (If you want to build the docs as well)
  • Valgrind
  • CCache (If you want faster builds specially with the LLVM)
  • Boehm GC v8.2.0 (has to be built statically and with -fPIC)

LLVM Installation

Important Note: We're trying to keep Serene up to date with the LLVM release cycle till we get to our first release. So we use the development version of the LLVM. Currently we are using 7240436c94bd02762a723a2e3551528d16c8efdb commit as our reference.

MLIR is a part of the LLVM project and in order to build it we need to build the LLVM itself as well. Here is a quick guide to build the latest version of the LLVM and MLIR.

  ## YES we're using the development version of MLIR
  git clone https://github.com/llvm/llvm-project.git

  mkdir llvm-project/build
  cd llvm-project/build

  cmake -G Ninja ../llvm \
        -DCMAKE_INSTALL_PREFIX=/your/target/path \
        -DLLVM_PARALLEL_COMPILE_JOBS=7 \
        -DLLVM_PARALLEL_LINK_JOBS=1 \
        -DLLVM_BUILD_EXAMPLES=ON \
        -DLLVM_TARGETS_TO_BUILD="X86" \
        -DCMAKE_BUILD_TYPE=Release \
        -DLLVM_EXTERNAL_PROJECTS=iwyu \ # Only if you want to enable the 'Include what you use' tool
        -DLLVM_EXTERNAL_IWYU_SOURCE_DIR=/path/to/iwyu \
        -DLLVM_ENABLE_ASSERTIONS=ON \
        -DLLVM_CCACHE_BUILD=ON \
        -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
        -DLLVM_ENABLE_PROJECTS='clang;lldb;lld;mlir;clang-tools-extra;compiler-rt;libcxx;libcxxabi;libunwind' \
        -DCMAKE_C_COMPILER=clang \       # If you have clang installed already
        -DCMAKE_CXX_COMPILER=clang++ \   # If you have clang installed already
        -DLLVM_ENABLE_LLD=ON

  cmake --build .

  cmake --build . --target check-mlir

  cmake -DCMAKE_INSTALL_PREFIX=/your/target/location -P cmake_install.cmake

You need to have clang and lld installed to compile the LLVM with the above command. Also if you are not using ccache just remove the option related to it from the above command.

Emacs

If you're using Emacs as your development environment just install clangd and lsp.

Heads up for devs

While you're working on Serene be mindful of:

  • In DEBUG mode we dynamically link against libsan due to the fact that we build the libserene as a shared lib by default. This means we need to LD_PRELOAD the libclang_rt before we run any executable. If you're using the builder script you're all set otherwise you can run an executable like:

      LD_PRELOAD=$(clang -print-file-name=libclang_rt.asan-x86_64.so) /path/to/executable

Build the devtools

We have our own version of `mlir-opt` which is `slir-opt` and also we have an LSP server for SLIR too. Both are in the devtools directory and in order to build them all you need to do is to use -DSERENE_ENABLE_DEVTOOLS=ON parameter with cmake for example ./builder build -DSERENE_ENABLE_DEVTOOLS=ON will do the job for you.

How to build

In order to build for development (Debug mode) just use ./builder build to setup the build and build the project once and then you can just use ./builder compile to build the changed files only.

Check out the builder script for more subcommands and details.

How to Debug

Since we're using the Boehm GC, in order to use a debugger we need to turn off some of the signal handlers that the debugger sets. In order to run the debugger (by default lldb) with serenec just use the lldb-run subcommand of the builder script. In the debugger, after setting the break point on the main function (b main) then use the following commands on:

 process handle -p yes -s no -n no SIGPWR
 process handle -p yes -s no -n no SIGXCPU
 process handle -p yes -s no -n no SIGSEGV

Cheatsheets

License

Copyright (c) 2019-2022 Sameer Rahmani <lxsameer@gnu.org>

Serene is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Get Help

If you need help or you just want to hangout, you can find us at: