Chaneg the namespace to generate modules instead of owning them

This commit is contained in:
Sameer Rahmani 2021-08-15 12:06:56 +01:00
parent ae2e6a74a0
commit 3ace6ec260
44 changed files with 549 additions and 705 deletions

View File

@ -24,7 +24,6 @@
#include "serene/serene.h"
#include "mlir/ExecutionEngine/ExecutionEngine.h"
#include "serene/context.h"
#include "serene/namespace.h"
#include "serene/reader/reader.h"
@ -32,14 +31,13 @@
#include "serene/slir/generatable.h"
#include "serene/slir/slir.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include <clang/Driver/Compilation.h>
#include <clang/Driver/Driver.h>
#include <clang/Frontend/TextDiagnosticPrinter.h>
#include <clang/Tooling/Tooling.h>
#include <llvm/ADT/ArrayRef.h>
#include <llvm/ADT/SmallString.h>
#include <llvm/ADT/StringRef.h>
#include <llvm/IR/LegacyPassManager.h>
#include <llvm/Support/CommandLine.h>
#include <llvm/Support/FileSystem.h>
@ -129,9 +127,16 @@ exprs::Ast readAndAnalyze(SereneContext &ctx) {
int dumpAsObject(Namespace &ns) {
// TODO: Move the compilation process to the Namespace class
auto &module = ns.getLLVMModule();
auto maybeModule = ns.compileToLLVM();
// TODO: Fix this call to raise the wrapped error instead
auto module = std::move(
maybeModule.getValueOrFail("Faild to generato LLVM IR for namespace"));
auto &ctx = ns.getContext();
module.setTargetTriple(ctx.targetTriple);
// TODO: We need to set the triple data layout and everything to that sort in
// one place. We want them for the JIT as well and also we're kinda
// duplicating what we're doing in `Namespace#compileToLLVM`.
module->setTargetTriple(ctx.targetTriple);
std::string Error;
auto target = llvm::TargetRegistry::lookupTarget(ctx.targetTriple, Error);
@ -153,7 +158,7 @@ int dumpAsObject(Namespace &ns) {
target->createTargetMachine(ctx.targetTriple, cpu, features, opt, rm);
auto targetMachine = std::unique_ptr<llvm::TargetMachine>(targetMachinePtr);
module.setDataLayout(targetMachine->createDataLayout());
module->setDataLayout(targetMachine->createDataLayout());
auto filename =
strcmp(outputFile.c_str(), "-") == 0 ? "output" : outputFile.c_str();
@ -177,7 +182,7 @@ int dumpAsObject(Namespace &ns) {
return 1;
}
pass.run(module);
pass.run(*module);
dest.flush();
if (emitAction == Action::Compile) {
@ -304,12 +309,17 @@ int main(int argc, char *argv[]) {
if (isSet.succeeded()) {
ctx->insertNS(ns);
if (mlir::failed(serene::slir::generate<Namespace>(*ns))) {
llvm::errs() << "IR generation faild\n";
return 1;
}
if (emitAction < CompileToObject) {
serene::slir::dump<Namespace>(*ns);
ns->dump();
} else if (emitAction == Action::DumpIR) {
auto maybeModule = ns->compileToLLVM();
if (!maybeModule) {
llvm::errs() << "Failed to generate the IR.\n";
return 1;
}
maybeModule.getValue()->dump();
} else if (emitAction == Action::JIT) {
} else {

View File

@ -31,6 +31,7 @@
#include "serene/slir/dialect.h"
#include <llvm/ADT/StringRef.h>
#include <llvm/IR/LLVMContext.h>
#include <llvm/Support/Host.h>
#include <memory>
#include <mlir/Dialect/StandardOps/IR/Ops.h>
@ -87,7 +88,7 @@ public:
mlirContext.getOrLoadDialect<serene::slir::SereneDialect>();
mlirContext.getOrLoadDialect<mlir::StandardOpsDialect>();
// TODO: Get the crash report path dynamically from the cli
pm.enableCrashReproducerGeneration("/home/lxsameer/mlir.mlir");
// pm.enableCrashReproducerGeneration("/home/lxsameer/mlir.mlir");
targetTriple = llvm::sys::getDefaultTargetTriple();
};

View File

@ -39,6 +39,7 @@ enum ErrID {
E0004,
E0005,
E0006,
E0007,
};
struct ErrorVariant {
@ -71,11 +72,13 @@ static ErrorVariant
DontKnowHowToCallNode(E0006, "Don't know how to call the given expression.",
"");
static ErrorVariant PassFailureError(E0007, "Pass Failure.", "");
static std::map<ErrID, ErrorVariant *> ErrDesc = {
{E0000, &UnknownError}, {E0001, &DefExpectSymbol},
{E0002, &DefWrongNumberOfArgs}, {E0003, &FnNoArgsList},
{E0004, &FnArgsMustBeList}, {E0005, &CantResolveSymbol},
{E0006, &DontKnowHowToCallNode}};
{E0000, &UnknownError}, {E0001, &DefExpectSymbol},
{E0002, &DefWrongNumberOfArgs}, {E0003, &FnNoArgsList},
{E0004, &FnArgsMustBeList}, {E0005, &CantResolveSymbol},
{E0006, &DontKnowHowToCallNode}, {E0007, &PassFailureError}};
} // namespace errors
} // namespace serene

View File

@ -57,7 +57,7 @@ public:
ExprType getType() const;
std::string toString() const;
MaybeNode analyze(SereneContext &);
void generateIR(serene::Namespace &){};
void generateIR(serene::Namespace &, mlir::ModuleOp &){};
static bool classof(const Expression *e);

View File

@ -56,7 +56,7 @@ public:
ExprType getType() const;
std::string toString() const;
MaybeNode analyze(SereneContext &);
void generateIR(serene::Namespace &);
void generateIR(serene::Namespace &, mlir::ModuleOp &);
static bool classof(const Expression *e);

View File

@ -25,6 +25,7 @@
#ifndef EXPRS_EXPRESSION_H
#define EXPRS_EXPRESSION_H
#include "mlir/IR/BuiltinOps.h"
#include "serene/context.h"
#include "serene/errors/error.h"
#include "serene/exprs/traits.h"
@ -82,10 +83,11 @@ public:
virtual MaybeNode analyze(SereneContext &ctx) = 0;
/// Genenates the correspondig SLIR of the expressoin and attach it to the
/// module of the given namespace.
/// given module.
///
/// \param ns The namespace that current expression is in it.
virtual void generateIR(serene::Namespace &ns) = 0;
/// \param m The target MLIR moduleOp to attach the operations to
virtual void generateIR(serene::Namespace &ns, mlir::ModuleOp &m) = 0;
};
/// Create a new `node` of type `T` and forwards any given parameter

View File

@ -60,7 +60,7 @@ public:
ExprType getType() const;
std::string toString() const;
MaybeNode analyze(SereneContext &);
void generateIR(serene::Namespace &);
void generateIR(serene::Namespace &, mlir::ModuleOp &);
static bool classof(const Expression *e);

View File

@ -78,7 +78,7 @@ public:
std::vector<Node>::iterator end();
MaybeNode analyze(SereneContext &);
void generateIR(serene::Namespace &){};
void generateIR(serene::Namespace &, mlir::ModuleOp &){};
~List() = default;

View File

@ -54,7 +54,7 @@ struct Number : public Expression {
std::string toString() const;
MaybeNode analyze(SereneContext &ctx);
void generateIR(serene::Namespace &);
void generateIR(serene::Namespace &, mlir::ModuleOp &);
// TODO: This is horrible, we need to fix it after the mvp
int toI64();

View File

@ -51,7 +51,7 @@ public:
std::string toString() const;
MaybeNode analyze(SereneContext &);
void generateIR(serene::Namespace &){};
void generateIR(serene::Namespace &, mlir::ModuleOp &){};
~Symbol() = default;

View File

@ -25,18 +25,70 @@
#ifndef SERENE_JIT_H
#define SERENE_JIT_H
#include "serene/errors.h"
#include "serene/slir/generatable.h"
#include "serene/utils.h"
#include <llvm/ADT/StringRef.h>
#include <llvm/ExecutionEngine/JITEventListener.h>
#include <llvm/ExecutionEngine/ObjectCache.h>
#include <llvm/ExecutionEngine/Orc/LLJIT.h>
#include <llvm/Support/CodeGen.h>
#include <llvm/Support/Debug.h>
#include <memory>
#include <mlir/ExecutionEngine/ExecutionEngine.h>
#include <mlir/Support/LLVM.h>
#define JIT_LOG(...) \
DEBUG_WITH_TYPE("JIT", llvm::dbgs() << "[JIT]: " << __VA_ARGS__ << "\n");
namespace serene {
class JIT;
using MaybeJIT = Result<std::unique_ptr<JIT>, serene::errors::Error>;
/// A simple object cache following Lang's LLJITWithObjectCache example and
/// MLIR's SimpelObjectCache.
class ObjectCache : public llvm::ObjectCache {
public:
/// Cache the given `objBuffer` for the given module `m`. The buffer contains
/// the combiled objects of the module
void notifyObjectCompiled(const llvm::Module *m,
llvm::MemoryBufferRef objBuffer) override;
// Lookup the cache for the given module `m` or returen a nullptr.
std::unique_ptr<llvm::MemoryBuffer> getObject(const llvm::Module *m) override;
/// Dump cached object to output file `filename`.
void dumpToObjectFile(llvm::StringRef filename);
private:
llvm::StringMap<std::unique_ptr<llvm::MemoryBuffer>> cachedObjects;
};
class JIT {
std::unique_ptr<mlir::ExecutionEngine> engine;
// TODO: Should the JIT own the context ???
Namespace &ns;
std::unique_ptr<llvm::orc::LLJIT> engine;
std::unique_ptr<ObjectCache> cache;
/// GDB notification listener.
llvm::JITEventListener *gdbListener;
/// Perf notification listener.
llvm::JITEventListener *perfListener;
public:
JIT(SereneContext &c, Namespace &entryNS, llvm::StringRef fn = "main") {}
JIT(Namespace &ns, bool enableObjectCache = true,
bool enableGDBNotificationListener = true,
bool enablePerfNotificationListener = true);
static MaybeJIT
make(Namespace &ns, mlir::ArrayRef<llvm::StringRef> sharedLibPaths = {},
mlir::Optional<llvm::CodeGenOpt::Level> jitCodeGenOptLevel = llvm::None,
bool enableObjectCache = true, bool enableGDBNotificationListener = true,
bool enablePerfNotificationListener = true);
};
} // namespace serene

View File

@ -53,18 +53,21 @@ class Expression;
using Node = std::shared_ptr<Expression>;
using Ast = std::vector<Node>;
} // namespace exprs
// TODO: replace the temporary `bool` by errors::Error
using MaybeModule = Result<std::unique_ptr<llvm::Module>, bool>;
// TODO: replace the temporary `bool` by errors::Error
using MaybeModuleOp = Result<mlir::ModuleOp, bool>;
/// Serene's namespaces are the unit of compilation. Any code that needs to be
/// compiled has to be in a namespace. The official way to create a new
/// namespace is to use the `makeNamespace` function.
class Namespace : public WithTrait<Namespace, slir::Generatable> {
class Namespace {
private:
SereneContext &ctx;
bool initialized = false;
std::atomic<uint> fn_counter = 0;
exprs::Ast tree;
std::unique_ptr<llvm::Module> llvmModule;
mlir::ModuleOp module;
public:
mlir::StringRef name;
@ -82,16 +85,15 @@ public:
mlir::LogicalResult setTree(exprs::Ast &);
uint nextFnCounter();
mlir::ModuleOp &getModule();
SereneContext &getContext();
void setLLVMModule(std::unique_ptr<llvm::Module>);
llvm::Module &getLLVMModule();
// Generatable Trait
/// Generate the IR of the namespace with respect to the compilation phase
mlir::LogicalResult generate();
mlir::LogicalResult runPasses();
MaybeModuleOp generate();
/// Compile the given namespace to the llvm module. It will call the
/// `generate` method of the namespace to generate the IR.
MaybeModule compileToLLVM();
mlir::LogicalResult runPasses(mlir::ModuleOp &m);
/// Dumps the namespace with respect to the compilation phase
void dump();
@ -102,6 +104,7 @@ public:
std::shared_ptr<Namespace>
makeNamespace(SereneContext &ctx, llvm::StringRef name,
llvm::Optional<llvm::StringRef> filename, bool setCurrent = true);
} // namespace serene
#endif

View File

@ -33,9 +33,8 @@
#include "serene/reader/location.h"
#include "serene/serene.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <llvm/Support/Debug.h>
#include <llvm/Support/raw_ostream.h>
#include <memory>
#include <sstream>
#include <stdexcept>

View File

@ -100,6 +100,8 @@ std::unique_ptr<llvm::Module> toLLVMIR(Generatable<T> &t) {
// Initialize LLVM targets.
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
// TODO: replace this call with our own version of setupTargetTriple
mlir::ExecutionEngine::setupTargetTriple(llvmModule.get());
/// Optionally run an optimization pipeline over the llvm module.

View File

@ -24,16 +24,17 @@
#ifndef SERENE_SLIR_H
#define SERENE_SLIR_H
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/MLIRContext.h"
#include "serene/exprs/expression.h"
#include "serene/slir/generatable.h"
#include <memory>
#include <mlir/IR/BuiltinOps.h>
#include <mlir/IR/MLIRContext.h>
namespace serene {
namespace slir {} // namespace slir
namespace slir {
std::unique_ptr<llvm::Module> compileToLLVMIR(serene::SereneContext &ctx,
mlir::ModuleOp &module);
} // namespace slir
} // namespace serene
#endif

View File

@ -91,6 +91,33 @@ public:
bool ok() const { return std::holds_alternative<T>(contents); };
operator bool() const { return ok(); }
const T &getValueOrFail(llvm::StringRef msg, int exitCode = 1) const & {
if (ok()) {
return getValue();
}
llvm::errs() << msg << "\n";
exit(exitCode);
}
T &getValueOrFail(llvm::StringRef msg, int exitCode = 1) & {
if (ok()) {
return getValue();
}
llvm::errs() << msg << "\n";
exit(exitCode);
}
T &&getValueOrFail(llvm::StringRef msg, int exitCode = 1) && {
if (ok()) {
return getValue();
}
llvm::errs() << msg << "\n";
exit(exitCode);
}
};
} // namespace serene

View File

@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="400"
height="400"
viewBox="0 0 105.832 105.832"
version="1.1"
id="svg8"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
sodipodi:docname="logo.svg"
inkscape:export-filename="/home/lxsameer/serene.png"
inkscape:export-xdpi="72"
inkscape:export-ydpi="72">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.2995369"
inkscape:cx="208.09865"
inkscape:cy="310.43135"
inkscape:document-units="px"
inkscape:current-layer="g944"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="1048"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
showborder="true"
units="px" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g944"
transform="matrix(1.6723595,0,0,1.6722037,-20.055488,-87.312186)">
<ellipse
style="fill:#ffffff;stroke:none;stroke-width:1.49554;stroke-linejoin:round"
id="path839"
cx="43.633854"
cy="83.858315"
rx="31.641521"
ry="31.64447" />
<path
id="path1315"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#8800aa;fill-opacity:1;fill-rule:nonzero;stroke:#440055;stroke-width:0.303013;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:700.32;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000"
d="m 60.686302,58.319486 c -13.510743,-9.02176 -31.627983,-5.890141 -41.386339,6.80919 l 2.863062,1.911805 c 8.712621,-11.15572 24.649824,-13.854344 36.615657,-5.864194 11.96583,7.990152 15.58093,23.744775 8.61592,36.067456 l 2.86216,1.911202 c 7.99008,-13.880085 3.94029,-31.813689 -9.57046,-40.835459 z m -43.676021,10.23816 c -7.9893433,13.88007 -3.939096,31.814494 9.571349,40.836054 13.510456,9.02157 31.626962,5.88895 41.385442,-6.80979 l -2.86215,-1.9112 c -8.71278,11.15501 -24.649538,13.85325 -36.615072,5.8633 C 16.524325,98.546064 12.909028,82.791991 19.873339,70.469452 Z" />
<g
id="g1321"
transform="matrix(0.45809875,0,0,0.45809875,86.980162,192.17444)">
<path
id="path1317"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:0;fill-rule:nonzero;stroke:#660099;stroke-width:0.529167;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:700.32;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000"
d="m -142.85856,-215.9389 c 11.23345,26.4239 41.82064,38.91628 68.38213,27.85299 25.20874,-10.49987 37.90544,-38.51723 29.86209,-64.07066 l -6.12607,7.49137 c 0.003,0.0212 0.005,0.0404 0.0106,0.0608 -2.93361,4.48765 -18.50438,21.7245 -19.29953,21.9545 -0.73468,0.21246 -2.0397,-0.96727 -4.77345,-4.03011 -4.26694,-4.74361 -7.75362,-10.83195 -11.23021,-16.38134 -0.53012,-0.8464 -1.0356,-1.6739 -1.51138,-2.45667 -0.99689,-1.62674 -1.89628,-3.11495 -2.74905,-4.41438 -2.14859,-3.30741 -4.04184,-5.47181 -6.78887,-5.74352 -0.51378,-0.0508 -2.311597,0.57577 -4.92906,1.65534 -8.55018,3.52632 -25.83089,11.87879 -35.65046,17.22736 -0.56084,0.30556 -1.09696,0.60117 -1.6061,0.8856 -0.0106,-0.88283 0.002,-1.76321 0.045,-2.64074 0.7832,-16.69068 10.96022,-32.22182 27.44672,-39.0887 22.56981,-9.4007 48.34316,1.02364 58.06612,23.34351" />
<path
id="path1319"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:0;fill-rule:nonzero;stroke:#ff6600;stroke-width:0.79375;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:700.32;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000"
d="m -48.04973,-260.50249 c -12.36305,-23.97826 -41.3716,-34.87219 -66.71725,-24.31527 l -2.1e-4,2e-5 v 0 c -24.31227,10.12649 -36.98699,36.54712 -30.64252,61.33651 20.8877,-9.82237 22.86764,-11.17221 47.41516,-21.39667 1.32043,0.60499 2.55801,2.56787 4.57418,6.05688 0.0797,0.14368 0.11563,0.32147 0.10039,0.4955 -0.0666,0.65394 -0.16333,1.30421 -0.24911,1.95278 -0.58031,4.41879 -1.26194,8.75211 -2.38233,13.0823 -1.00975,3.88795 -2.36285,7.73751 -4.26819,11.51842 -2.14527,4.25957 -4.99149,8.42643 -8.7783,12.35786 -0.062,0.0712 -0.12062,0.14394 -0.17454,0.21964 0.0737,0.008 0.11005,0.0159 0.14764,0.0186 5.52308,-0.1503 9.02393,-0.93452 11.49329,-2.87233 2.44254,-1.91672 4.6548,-5.60916 6.52767,-12.04533 l -9.2e-4,-1.6e-4 c 2.85849,-7.74689 3.00061,-12.22779 3.72098,-13.7386 0.73806,-1.5478 1.64869,-0.0109 4.21059,4.10059 0.7309,1.15476 1.70688,2.6854 2.81766,4.25477 0.33279,0.47355 0.68922,0.96557 1.06659,1.46789 2.21075,2.80054 4.07569,4.72381 5.66874,5.80315 1.60251,1.0857 2.98773,1.36476 4.3722,0.81143 1.92211,-0.76511 12.00377,-11.44592 18.95159,-20.57562 -1.59492,15.77037 -11.5728,30.1638 -27.27129,36.70247 -22.66702,9.4412 -48.56432,-1.11153 -58.18994,-23.63026" />
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 8.8 KiB

View File

@ -1,142 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
viewBox="0 0 210 297"
version="1.1"
id="svg8"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
sodipodi:docname="logo_with_text.svg">
<defs
id="defs2" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="4"
inkscape:cx="126.81776"
inkscape:cy="146.28967"
inkscape:document-units="px"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
inkscape:window-width="1920"
inkscape:window-height="995"
inkscape:window-x="0"
inkscape:window-y="28"
inkscape:window-maximized="1"
showborder="true"
inkscape:object-paths="true"
inkscape:snap-intersection-paths="true" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
id="path1001-8-9"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#8800aa;fill-opacity:1;fill-rule:nonzero;stroke:#440055;stroke-width:0.303013;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:700.32;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000"
d="m 75.198339,120.89207 c -13.51075,-9.02176 -31.62798,-5.89015 -41.38634,6.80919 l 2.86306,1.9118 c 8.71262,-11.15572 24.64982,-13.85434 36.61566,-5.86419 11.96582,7.99015 15.58092,23.74477 8.61591,36.06745 l 2.86216,1.9112 c 7.99009,-13.88008 3.94029,-31.81368 -9.57045,-40.83545 z m -43.67602,10.23816 c -7.98935,13.88007 -3.9391,31.81449 9.57135,40.83605 13.51045,9.02157 31.62696,5.88895 41.38543,-6.80979 l -2.86215,-1.9112 c -8.71278,11.15501 -24.64953,13.85325 -36.61506,5.8633 -11.96553,-7.98995 -15.58083,-23.74402 -8.61651,-36.06656 z" />
<g
id="g1016"
transform="matrix(0.45809875,0,0,0.45809875,101.4922,254.74701)">
<path
id="path1010"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:0;fill-rule:nonzero;stroke:#660099;stroke-width:0.529167;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:700.32;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000"
d="m -142.85856,-215.9389 c 11.23345,26.4239 41.82064,38.91628 68.38213,27.85299 25.20874,-10.49987 37.90544,-38.51723 29.86209,-64.07066 l -6.12607,7.49137 c 0.003,0.0212 0.005,0.0404 0.0106,0.0608 -2.93361,4.48765 -18.50438,21.7245 -19.29953,21.9545 -0.73468,0.21246 -2.0397,-0.96727 -4.77345,-4.03011 -4.26694,-4.74361 -7.75362,-10.83195 -11.23021,-16.38134 -0.53012,-0.8464 -1.0356,-1.6739 -1.51138,-2.45667 -0.99689,-1.62674 -1.89628,-3.11495 -2.74905,-4.41438 -2.14859,-3.30741 -4.04184,-5.47181 -6.78887,-5.74352 -0.51378,-0.0508 -2.311597,0.57577 -4.92906,1.65534 -8.55018,3.52632 -25.83089,11.87879 -35.65046,17.22736 -0.56084,0.30556 -1.09696,0.60117 -1.6061,0.8856 -0.0106,-0.88283 0.002,-1.76321 0.045,-2.64074 0.7832,-16.69068 10.96022,-32.22182 27.44672,-39.0887 22.56981,-9.4007 48.34316,1.02364 58.06612,23.34351" />
<path
id="path1012"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:0;fill-rule:nonzero;stroke:#ff6600;stroke-width:0.79375;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:700.32;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000"
d="m -48.04973,-260.50249 c -12.36305,-23.97826 -41.3716,-34.87219 -66.71725,-24.31527 l -2.1e-4,2e-5 v 0 c -24.31227,10.12649 -36.98699,36.54712 -30.64252,61.33651 20.8877,-9.82237 22.86764,-11.17221 47.41516,-21.39667 1.32043,0.60499 2.55801,2.56787 4.57418,6.05688 0.0797,0.14368 0.11563,0.32147 0.10039,0.4955 -0.0666,0.65394 -0.16333,1.30421 -0.24911,1.95278 -0.58031,4.41879 -1.26194,8.75211 -2.38233,13.0823 -1.00975,3.88795 -2.36285,7.73751 -4.26819,11.51842 -2.14527,4.25957 -4.99149,8.42643 -8.7783,12.35786 -0.062,0.0712 -0.12062,0.14394 -0.17454,0.21964 0.0737,0.008 0.11005,0.0159 0.14764,0.0186 5.52308,-0.1503 9.02393,-0.93452 11.49329,-2.87233 2.44254,-1.91672 4.6548,-5.60916 6.52767,-12.04533 l -9.2e-4,-1.6e-4 c 2.85849,-7.74689 3.00061,-12.22779 3.72098,-13.7386 0.73806,-1.5478 1.64869,-0.0109 4.21059,4.10059 0.7309,1.15476 1.70688,2.6854 2.81766,4.25477 0.33279,0.47355 0.68922,0.96557 1.06659,1.46789 2.21075,2.80054 4.07569,4.72381 5.66874,5.80315 1.60251,1.0857 2.98773,1.36476 4.3722,0.81143 1.92211,-0.76511 12.00377,-11.44592 18.95159,-20.57562 -1.59492,15.77037 -11.5728,30.1638 -27.27129,36.70247 -22.66702,9.4412 -48.56432,-1.11153 -58.18994,-23.63026" />
</g>
<path
id="path1315"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#8800aa;fill-opacity:1;fill-rule:nonzero;stroke:#440055;stroke-width:0.303013;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:700.32;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000"
d="m 51.582125,27.549798 c -13.51074,-9.021764 -31.62798,-5.890145 -41.38633,6.80919 l 2.86306,1.9118 c 8.71262,-11.155719 24.64982,-13.854343 36.61565,-5.86419 11.96583,7.99015 15.58093,23.74477 8.61592,36.067455 l 2.86216,1.9112 c 7.99008,-13.880085 3.94029,-31.813685 -9.57046,-40.835455 z m -43.67602,10.23816 c -7.98933997,13.88007 -3.93909,31.814495 9.57135,40.836055 13.51046,9.02157 31.62696,5.88895 41.38544,-6.80979 l -2.86215,-1.9112 c -8.71278,11.15501 -24.64953,13.85325 -36.61507,5.8633 -11.96552,-7.98995 -15.58082,-23.744025 -8.61651,-36.066565 z" />
<path
id="path1317"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:0;fill-rule:nonzero;stroke:#660099;stroke-width:0.242411;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:700.32;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000"
d="m 17.456832,69.971397 c 9.248049,9.353091 24.382839,9.503957 33.823268,0.305113 8.959633,-8.730365 9.844472,-22.805453 2.101843,-32.326936 -6.051523,17.734193 -4.785224,13.680494 -6.048604,16.858258 -0.276925,0.214605 -1.031939,-0.06721 -2.713493,-0.909433 -2.618385,-1.298826 -5.131757,-3.302075 -7.549766,-5.077546 -0.368741,-0.27082 -0.723796,-0.537755 -1.058648,-0.790663 -0.699345,-0.524216 -1.333767,-1.00592 -1.91644,-1.41512 -1.473721,-1.045236 -2.645583,-1.646927 -3.861171,-1.298451 -0.22735,0.06518 -0.886983,0.635754 -1.819075,1.537708 -3.044796,2.946231 -8.991546,9.422631 -12.268936,13.359261 -0.187173,0.224872 -0.365502,0.441331 -0.534232,0.648471 -0.153686,-0.374116 -0.29708,-0.751108 -0.427048,-1.132024 -2.48676,-7.239181 -0.777729,-15.571919 5.08187,-21.281561 8.021713,-7.816439 20.757345,-7.732738 28.668768,0.128098"
sodipodi:nodetypes="csccccccscccccc" />
<path
id="path1319"
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:0;fill-rule:nonzero;stroke:#ff6600;stroke-width:0.363616;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:700.32;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000"
d="M 50.296197,34.976387 C 40.980411,26.855512 26.787893,27.118518 17.779603,35.896308 l -8.6e-5,4.4e-5 v 0 c -8.6410093,8.419904 -9.5735434,21.811395 -2.683394,31.294613 7.234226,-7.711756 7.849194,-8.621067 16.573819,-17.122436 0.664461,0.03449 1.523089,0.661161 2.971111,1.806097 0.05821,0.04771 0.103554,0.117343 0.126471,0.19402 0.08214,0.289699 0.150828,0.582927 0.223893,0.87358 0.499554,1.979564 0.941524,3.939855 1.196142,5.972951 0.227003,1.826097 0.301322,3.693863 0.128898,5.625711 -0.193705,2.176202 -0.701538,4.431368 -1.649652,6.745222 -0.01437,0.04079 -0.02704,0.08167 -0.03721,0.123014 0.03273,-0.009 0.04955,-0.01183 0.06601,-0.01703 2.326315,-0.997239 3.684456,-1.9227 4.408468,-3.165065 0.716157,-1.228853 1.034215,-3.174891 0.74415,-6.231855 l -4.19e-4,8.7e-5 c -0.09186,-3.781606 -0.788493,-5.713574 -0.737045,-6.478595 0.05273,-0.783759 0.700166,-0.283222 2.485739,1.034551 0.506336,0.368193 1.18054,0.855022 1.918685,1.335566 0.221717,0.145404 0.456621,0.294679 0.702182,0.4448 1.414542,0.818909 2.533605,1.322711 3.394298,1.513111 0.865797,0.19151 1.502772,0.07627 1.998779,-0.393271 0.612808,-0.650565 3.118529,-6.90193 4.592846,-11.963313 1.985625,6.984474 0.169148,14.799129 -5.410377,20.235869 -8.056262,7.850109 -20.866365,7.732685 -28.769943,-0.229274"
sodipodi:nodetypes="cccsccccccccccscccccccccsc" />
<g
aria-label="Serene"
transform="matrix(1.1358153,0,0,0.88042484,10.80816,-8.0987405)"
id="text1222-0"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.4713px;line-height:1.75;font-family:'Poiret One';-inkscape-font-specification:'Poiret One, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;letter-spacing:0px;word-spacing:0px;stroke-width:1.68595">
<path
d="m 8.5381003,221.93831 q -0.7238399,-1.3218 -1.9826919,-2.07711 -1.2273807,-0.75531 -2.7694744,-0.75531 -1.5420937,0 -2.6435892,0.97561 -1.0700242,0.94414 -1.0700242,2.61212 v 0.15736 q 0,1.98269 2.202991,3.6192 0.944139,0.69236 2.1085771,1.38473 1.1959094,0.6609 2.3603475,1.44768 1.1959094,0.75531 2.1400484,1.63651 0.9756103,0.84973 1.5735654,2.10858 0.629426,1.25885 0.629426,2.76947 v 0.31471 q 0,2.98978 -2.0456349,4.75217 -2.0141632,1.76239 -5.0039367,1.76239 -3.9339125,0 -6.1054322,-3.24154 v -1.69945 q 0.8182538,1.79386 2.39181881,2.92683 1.60503629,1.1015 3.96538379,1.1015 2.3603475,0 4.091269,-1.51063 1.7309212,-1.51062 1.7309212,-4.02832 v -0.18883 q 0,-1.57357 -0.8182535,-2.86389 -0.8182538,-1.32179 -2.0456345,-2.14005 -1.2273807,-0.84972 -2.6750605,-1.76239 -1.4476798,-0.91267 -2.6750605,-1.69945 -1.22738069,-0.78678 -2.0456345,-1.98269 -0.8182538,-1.19591 -0.8182538,-2.61212 v -0.2203 q 0,-2.20299 1.41620851,-3.36743 1.41620849,-1.16444 3.49331429,-1.16444 2.8953596,0 4.5948098,2.14005 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.4713px;font-family:'Poiret One';-inkscape-font-specification:'Poiret One, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:1.68595"
id="path918" />
<path
d="m 21.315423,242.58348 h -0.283242 q -2.989774,0 -5.224236,-2.23446 -2.202991,-2.26593 -2.202991,-5.25571 0,-2.98977 2.202991,-5.16129 2.202991,-2.20299 5.444535,-2.20299 3.241544,0 5.57042,2.58064 l -9.881988,9.75611 q 2.045634,1.63651 3.933912,1.63651 1.888278,0 3.367429,-0.84973 1.510623,-0.8812 2.486233,-2.32888 v 1.60504 q -2.234462,2.45476 -5.413063,2.45476 z m -0.346185,-13.97326 q -2.486232,0 -4.437453,1.95122 -1.919749,1.91975 -1.919749,4.43746 0,2.5177 1.667979,4.40598 l 9.158148,-9.09521 q -1.951221,-1.69945 -4.468925,-1.69945 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.4713px;font-family:'Poiret One';-inkscape-font-specification:'Poiret One, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:1.68595"
id="path920" />
<path
d="m 38.089592,229.96349 q -1.384737,-1.38474 -3.052716,-1.38474 -1.667979,0 -2.958302,1.25885 -1.258852,1.25886 -1.258852,2.92684 v 9.44139 H 29.81264 v -14.16209 h 1.007082 v 2.10858 q 0.566483,-1.07003 1.762393,-1.76239 1.195909,-0.69237 2.67506,-0.69237 1.479151,0 2.832417,1.00708 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.4713px;font-family:'Poiret One';-inkscape-font-specification:'Poiret One, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:1.68595"
id="path922" />
<path
d="m 47.845683,242.58348 h -0.283242 q -2.989774,0 -5.224236,-2.23446 -2.202991,-2.26593 -2.202991,-5.25571 0,-2.98977 2.202991,-5.16129 2.202991,-2.20299 5.444535,-2.20299 3.241544,0 5.57042,2.58064 l -9.881988,9.75611 q 2.045634,1.63651 3.933912,1.63651 1.888278,0 3.36743,-0.84973 1.510622,-0.8812 2.486232,-2.32888 v 1.60504 q -2.234462,2.45476 -5.413063,2.45476 z m -0.346185,-13.97326 q -2.486232,0 -4.437453,1.95122 -1.919749,1.91975 -1.919749,4.43746 0,2.5177 1.667979,4.40598 l 9.158148,-9.09521 q -1.951221,-1.69945 -4.468925,-1.69945 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.4713px;font-family:'Poiret One';-inkscape-font-specification:'Poiret One, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:1.68595"
id="path924" />
<path
d="m 57.34998,242.20583 h -1.007081 v -14.16209 h 1.007081 v 2.86389 q 1.605037,-3.21007 5.476006,-3.21007 2.64359,0 4.437454,1.82533 1.793864,1.82534 1.793864,4.43746 v 8.24548 h -1.007082 v -8.24548 q 0,-2.17152 -1.542093,-3.77656 -1.510623,-1.60504 -3.682143,-1.60504 -2.171519,0 -3.839498,1.60504 -1.636508,1.60504 -1.636508,3.77656 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.4713px;font-family:'Poiret One';-inkscape-font-specification:'Poiret One, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:1.68595"
id="path926" />
<path
d="m 79.914851,242.58348 h -0.283242 q -2.989774,0 -5.224236,-2.23446 -2.202991,-2.26593 -2.202991,-5.25571 0,-2.98977 2.202991,-5.16129 2.202991,-2.20299 5.444535,-2.20299 3.241544,0 5.57042,2.58064 l -9.881988,9.75611 q 2.045635,1.63651 3.933913,1.63651 1.888278,0 3.367429,-0.84973 1.510622,-0.8812 2.486232,-2.32888 v 1.60504 q -2.234462,2.45476 -5.413063,2.45476 z m -0.346185,-13.97326 q -2.486232,0 -4.437453,1.95122 -1.919749,1.91975 -1.919749,4.43746 0,2.5177 1.667979,4.40598 l 9.158148,-9.09521 q -1.951221,-1.69945 -4.468925,-1.69945 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:31.4713px;font-family:'Poiret One';-inkscape-font-specification:'Poiret One, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:1.68595"
id="path928" />
</g>
<path
d="m 93.975799,40.576629 q -1.067652,-1.949616 -2.924426,-3.063684 -1.810366,-1.114068 -4.084919,-1.114068 -2.274552,0 -3.899233,1.439004 -1.578264,1.392578 -1.578264,3.852816 v 0.232094 q 0,2.924434 3.249361,5.338246 1.392588,1.021225 3.110111,2.04245 1.76394,0.974818 3.481454,2.135302 1.76394,1.114068 3.156526,2.413813 1.438995,1.253327 2.320962,3.110101 0.928384,1.856783 0.928384,4.084919 v 0.464195 q 0,4.409851 -3.017244,7.009349 -2.970849,2.599488 -7.380695,2.599488 -5.802442,0 -9.005389,-4.781207 v -2.50666 q 1.20691,2.645919 3.527883,4.317017 2.367396,1.62468 5.848859,1.62468 3.481464,0 6.034536,-2.228136 2.553056,-2.228127 2.553056,-5.941697 v -0.27851 q 0,-2.320979 -1.2069,-4.224178 -1.206905,-1.949617 -3.017263,-3.156519 -1.810357,-1.253327 -3.945659,-2.599497 -2.135293,-1.346162 -3.94565,-2.506646 -1.810357,-1.160494 -3.017268,-2.924434 -1.206905,-1.763941 -1.206905,-3.852817 v -0.324936 q 0,-3.249361 2.08888,-4.966884 2.088876,-1.717523 5.152561,-1.717523 4.270586,0 6.777242,3.156527 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:51.1029px;line-height:1.75;font-family:'Poiret One';-inkscape-font-specification:'Poiret One, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;letter-spacing:0px;word-spacing:0px;stroke-width:2.48675"
id="path905" />
<path
d="m 112.82202,71.027812 h -0.41778 q -4.40986,0 -7.70564,-3.295778 -3.24936,-3.342209 -3.24936,-7.752063 0,-4.409846 3.24936,-7.61279 3.24936,-3.24937 8.03057,-3.24937 4.78121,0 8.21625,3.806399 L 106.3697,67.314255 q 3.01727,2.413812 5.80244,2.413812 2.78517,0 4.96689,-1.253327 2.22813,-1.299745 3.66714,-3.435038 v 2.367396 q -3.29579,3.620714 -7.98415,3.620714 z m -0.51063,-20.610257 q -3.66713,0 -6.54514,2.878008 -2.83159,2.831591 -2.83159,6.545148 0,3.713566 2.46023,6.498736 L 118.90297,52.92421 q -2.87801,-2.506655 -6.59158,-2.506655 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:51.1029px;line-height:1.75;font-family:'Poiret One';-inkscape-font-specification:'Poiret One, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;letter-spacing:0px;word-spacing:0px;stroke-width:2.48675"
id="path907" />
<path
d="m 137.56355,52.413598 q -2.04246,-2.04246 -4.50269,-2.04246 -2.46024,0 -4.36343,1.856783 -1.85678,1.856774 -1.85678,4.317012 v 13.925849 h -1.48542 V 49.582006 h 1.48542 v 3.110111 q 0.83555,-1.578264 2.59949,-2.599498 1.76394,-1.021225 3.94566,-1.021225 2.18171,0 4.17775,1.485421 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:51.1029px;line-height:1.75;font-family:'Poiret One';-inkscape-font-specification:'Poiret One, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;letter-spacing:0px;word-spacing:0px;stroke-width:2.48675"
id="path909" />
<path
d="m 151.95356,71.027812 h -0.41777 q -4.40985,0 -7.70564,-3.295778 -3.24936,-3.342209 -3.24936,-7.752063 0,-4.409846 3.24936,-7.61279 3.24937,-3.24937 8.03058,-3.24937 4.78121,0 8.21624,3.806399 l -14.57571,14.390045 q 3.01726,2.413812 5.80243,2.413812 2.78517,0 4.96688,-1.253327 2.22814,-1.299745 3.66714,-3.435038 v 2.367396 q -3.29577,3.620714 -7.98415,3.620714 z m -0.51061,-20.610257 q -3.66714,0 -6.54515,2.878008 -2.83159,2.831591 -2.83159,6.545148 0,3.713566 2.46024,6.498736 L 158.03451,52.92421 q -2.878,-2.506655 -6.59156,-2.506655 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:51.1029px;line-height:1.75;font-family:'Poiret One';-inkscape-font-specification:'Poiret One, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;letter-spacing:0px;word-spacing:0px;stroke-width:2.48675"
id="path911" />
<path
d="m 165.9722,70.470782 h -1.48543 V 49.582006 h 1.48543 v 4.224179 q 2.36739,-4.734791 8.07699,-4.734791 3.89923,0 6.54515,2.692331 2.64591,2.692332 2.64591,6.545148 v 12.161909 h -1.48543 V 58.308873 q 0,-3.202944 -2.27455,-5.570339 -2.22814,-2.367396 -5.43108,-2.367396 -3.20295,0 -5.66317,2.367396 -2.41382,2.367395 -2.41382,5.570339 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:51.1029px;line-height:1.75;font-family:'Poiret One';-inkscape-font-specification:'Poiret One, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;letter-spacing:0px;word-spacing:0px;stroke-width:2.48675"
id="path913" />
<path
d="m 199.25489,71.027812 h -0.41778 q -4.40984,0 -7.70563,-3.295778 -3.24936,-3.342209 -3.24936,-7.752063 0,-4.409846 3.24936,-7.61279 3.24936,-3.24937 8.03057,-3.24937 4.7812,0 8.21625,3.806399 l -14.57572,14.390045 q 3.01726,2.413812 5.80244,2.413812 2.78516,0 4.96688,-1.253327 2.22814,-1.299745 3.66714,-3.435038 v 2.367396 q -3.29579,3.620714 -7.98415,3.620714 z m -0.51061,-20.610257 q -3.66714,0 -6.54515,2.878008 -2.83159,2.831591 -2.83159,6.545148 0,3.713566 2.46023,6.498736 L 205.33584,52.92421 q -2.87801,-2.506655 -6.59156,-2.506655 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:51.1029px;line-height:1.75;font-family:'Poiret One';-inkscape-font-specification:'Poiret One, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;letter-spacing:0px;word-spacing:0px;stroke-width:2.48675"
id="path915" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 27 KiB

View File

@ -1,6 +0,0 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

View File

@ -1,7 +0,0 @@
theme = "anybodyhome"
baseURL = "https://serene-lang.org/"
languageCode = "en-us"
title = "Serene"
[params]
subtitle = "A Simple programming language"

View File

@ -1,7 +0,0 @@
---
title: "Welcome to Serene's website"
date: 2021-01-01T22:08:28Z
draft: false
---
Well have posts available here about important news and features.

View File

@ -1,9 +0,0 @@
#!/bin/sh
USER=www
HOST=core.lxsameer.com
DIR=/home/www/public/serene/
SITEDIR=$(cd "$(dirname "$0")/.." >/dev/null 2>&1 ; pwd -P)
hugo && rsync -avz --delete ${SITEDIR}/public/ ${USER}@${HOST}:${DIR}
exit 0

View File

@ -1,20 +0,0 @@
The MIT License (MIT)
Copyright (c) 2016 YOUR_NAME_HERE
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -1,36 +0,0 @@
# Anybody Home?
![anybodyhome](https://github.com/lasseborly/anybodyhome/blob/master/images/screenshot.png "Anybody Home?")
A simple theme for simple people with simple needs.
## Features
* __Blog only__ - Only a list of the 10 most recent posts and added pagination. There is no other pages than the main page and the post page.
* [__Highlight.js__](https://highlightjs.org/) - For all of you code needs.
## Getting Started
From the root of you Hugo site clone the theme into `themes/anybodyhome` by running:
`git clone https://github.com/lasseborly/anybodyhome.git themes/anybodyhome`
## Usage
To use Anybody Home? you must first, from the root of your Hugo site, run either:
`hugo -t anybodyhome`
or set in you `config.toml`.
`theme = "anybodyhome"`
## Configuration
You can set the normal Hugo site variables in your `config.toml` but there is also some custom Anybody Home? variables you can set. This is an example of a full `config.toml`.
```toml
theme = "anybodyhome"
baseurl = "https://hugosite.com"
languageCode = "en-us"
title = "Anybody Home?"
[params]
subtitle = "A Simple Theme"
```

View File

@ -1,2 +0,0 @@
+++
+++

View File

@ -1,10 +0,0 @@
{{ if .Paginator.HasPrev }}
<a href="{{ .Paginator.Prev.URL }}">
Previous Page
</a>
{{ end }}
{{ if .Paginator.HasNext }}
<a href="{{ .Paginator.Next.URL }}">
Next Page
</a>
{{ end }}

View File

@ -1,15 +0,0 @@
{{ partial "head.html" . }}
{{ partial "header.html" . }}
{{ $baseurl := .Site.BaseURL }}
<div id="post">
<section>
<h2>{{ .Title }}</h2>
<time>{{ .Date.Format "2. January, 2006"}}</time>
</section>
<section>
<article>
{{ .Content }}
</article>
</section>
</div>
{{ partial "footer.html" . }}

View File

@ -1,9 +0,0 @@
<section class="summary">
<h2>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</h2>
<time>{{ .Date.Format "2. January, 2006"}}</time>
<article>
<p>{{ .Summary }}</p>
</article>
</section>

View File

@ -1,17 +0,0 @@
{{ partial "head.html" . }}
<body>
{{ partial "header.html" . }}
<main>
{{ range (.Paginator 5).Pages }}
{{ .Render "summary" }}
{{ end }}
</main>
{{ partial "paginator.html" . }}
{{ partial "footer.html" . }}
</body>

View File

@ -1,43 +0,0 @@
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<base href="{{ .Site.BaseURL }}">
<title>{{ .Site.Title }}</title>
<link
rel="canonical"
href="{{ .Permalink }}"
/>
<link
href="{{ .RSSLink }}"
rel="alternate"
type="application/rss+xml"
title="{{ .Site.Title }}"
/>
<link
rel="stylesheet"
type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"
/>
<link
rel="stylesheet"
type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css"
/>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js">
</script>
<script>
hljs.initHighlightingOnLoad();
</script>
<link
rel="stylesheet"
type="text/css"
href="/css/styles.css"
/>
</head>

View File

@ -1,6 +0,0 @@
<section id="header">
<h1>
<a href="{{.Site.BaseURL}}">{{.Site.Title}}</a>
</h1>
<h2>{{.Site.Params.subtitle}}</h2>
</section>

View File

@ -1,12 +0,0 @@
<section id="paginator">
{{ if .Paginator.HasPrev }}
<a id="previous" href="{{ .Paginator.Prev.URL }}">
Previous Page
</a>
{{ end }}
{{ if .Paginator.HasNext }}
<a id="next" href="{{ .Paginator.Next.URL }}">
Next Page
</a>
{{ end }}
</section>

View File

@ -1,9 +0,0 @@
<section id="main">
<h1 id="title">{{ .Title }}</h1>
<h4 id="date">{{ .Date.Format "2. January, 2006"}}</h4>
<div>
<article id="content">
{{ .Summary }}
</article>
</div>
</section>

View File

@ -1,162 +0,0 @@
@import 'https://fonts.googleapis.com/css?family=Lobster|Quicksand|Cutive+Mono';
body {
width: 600px;
margin: 0 auto;
font-size: 18px;
font-weight: 400;
font-family: 'Quicksand', sans-serif;
min-height: 100vh;
display: flex;
flex-direction: column;
color: #000;
}
main {
flex: 1;
}
@media(max-device-width: 667px) {
body {
width: 100%;
box-sizing: border-box;
padding: 0 80px;
}
}
a {
text-decoration: none;
color: #336699;
}
a:visited {
color: #333;
}
a:hover {
color: #C0C0C0;
}
p {
line-height: 1.4;
text-align: justify;
}
@media(max-device-width: 667px) {
p {
font-size: 3em;
}
}
img {
max-width: 100%;
}
section#header {
margin: 40px 0;
}
section#header h1 {
font-size: 2em;
text-align: center;
font-family: 'Lobster', cursive;
margin: 0 0 9px 0;
}
@media(max-device-width: 667px) {
section#header h1 {
font-size: 6em;
margin: 0 0 30px 0;
}
}
section#header h2 {
font-family: 'Cutive Mono', monospace;
font-size: 0.8em;
text-align: center;
}
@media(max-device-width: 667px) {
section#header h2 {
font-size: 1.5em;
}
}
section.summary {
padding: 0 0 0 10px;
border-left: 1px solid black;
margin: 0 0 60px 0;
}
@media(max-device-width: 667px) {
section.summary {
padding: 0 0 0 0;
border-left: 0px solid black;
}
}
section.summary article {
margin: 15px 0 0 0;
}
section h2 {
font-size: 1.3em;
font-family: 'Lobster', cursive;
}
@media(max-device-width: 667px) {
section h2 {
font-size: 4em;
padding-bottom: 5px;
}
}
section h2 a {
color: #000;
}
section time {
font-family: 'Cutive Mono', monospace;
margin: 0 0 0 2px;
font-size: 0.8em;
}
section article {
margin: 15px 0 0 0;
}
section#paginator {
margin: 0 0 140px 0;
font-family: 'Lobster', cursive;
}
@media(max-device-width: 667px) {
section#paginator {
font-size: 5em;
padding-bottom: 60px;
}
}
section#paginator #next {
float: right;
}
#post {
margin: 0 0 100px 0;
}
.videoWrapper {
position: relative;
padding-bottom: 56.25%; /* 16:9 */
padding-top: 25px;
height: 0;
margin: 10px;
}
.videoWrapper iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

View File

@ -1,12 +0,0 @@
name = "Anybody Home"
license = "MIT"
licenselink = "https://github.com/lasseborly/anybodyhome/blob/master/LICENSE.md"
description = "A simple theme for simple people with simple needs"
homepage = "https://github.com/lasseborly/anybodyhome/"
tags = ["clean", "simple"]
features = ["highlightjs", "Blog only"]
min_version = 0.16
[author]
name = "Lasse Borly"
homepage = "https://lasseborly.com/"

View File

@ -61,6 +61,7 @@ add_library(serene
errors/error.cpp
# IR
slir/slir.cpp
slir/dialect.cpp
slir/value_op.cpp
slir/generatable.cpp

View File

@ -115,14 +115,13 @@ MaybeNode Def::make(SereneContext &ctx, List *list) {
}
};
void Def::generateIR(serene::Namespace &ns) {
auto &module = ns.getModule();
void Def::generateIR(serene::Namespace &ns, mlir::ModuleOp &m) {
if (value->getType() == ExprType::Fn) {
value->generateIR(ns);
value->generateIR(ns, m);
return;
}
module.emitError("Def: not implemented!");
m.emitError("Def: not implemented!");
};
} // namespace exprs
} // namespace serene

View File

@ -105,10 +105,10 @@ MaybeNode Fn::make(SereneContext &ctx, List *list) {
return makeSuccessfulNode<Fn>(ctx, list->location, *args, body);
};
void Fn::generateIR(serene::Namespace &ns) {
void Fn::generateIR(serene::Namespace &ns, mlir::ModuleOp &m) {
auto loc = slir::toMLIRLocation(ns, location.start);
auto &ctx = ns.getContext();
auto &module = ns.getModule();
mlir::OpBuilder builder(&ctx.mlirContext);
// llvm::SmallVector<mlir::Type, 4> arg_types;
@ -118,7 +118,7 @@ void Fn::generateIR(serene::Namespace &ns) {
auto *argSym = llvm::dyn_cast<Symbol>(arg.get());
if (!argSym) {
module->emitError(llvm::formatv(
m->emitError(llvm::formatv(
"Arguments of a function have to be symbols. Fn: '{0}'", name));
return;
}
@ -134,7 +134,7 @@ void Fn::generateIR(serene::Namespace &ns) {
builder.getStringAttr("public"));
if (!fn) {
module.emitError(llvm::formatv("Can't create the function '{0}'", name));
m.emitError(llvm::formatv("Can't create the function '{0}'", name));
}
auto *entryBlock = new mlir::Block();
@ -146,11 +146,11 @@ void Fn::generateIR(serene::Namespace &ns) {
mlir::ReturnOp returnOp = builder.create<mlir::ReturnOp>(loc, retVal);
if (!returnOp) {
module.emitError(
m.emitError(
llvm::formatv("Can't create the return value of function '{0}'", name));
return;
}
module.push_back(fn);
m.push_back(fn);
};
} // namespace exprs
} // namespace serene

View File

@ -46,15 +46,14 @@ bool Number::classof(const Expression *e) {
int Number::toI64() { return std::stoi(this->value); };
void Number::generateIR(serene::Namespace &ns) {
void Number::generateIR(serene::Namespace &ns, mlir::ModuleOp &m) {
mlir::OpBuilder builder(&ns.getContext().mlirContext);
mlir::ModuleOp &module = ns.getModule();
auto op = builder.create<serene::slir::ValueOp>(
serene::slir::toMLIRLocation(ns, location.start), toI64());
if (op) {
module.push_back(op);
m.push_back(op);
}
// TODO: in case of failure attach the error to the NS
};

281
src/serene/jit.cpp Normal file
View File

@ -0,0 +1,281 @@
/*
* Serene programming language.
*
* Copyright (c) 2020 Sameer Rahmani <lxsameer@gnu.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
* Most of the codes in this file is borrowed from the LLVM project so the LLVM
* license applies here
*/
#include "serene/jit.h"
#include "serene/context.h"
#include "serene/namespace.h"
#include <llvm/ExecutionEngine/Orc/CompileUtils.h>
#include <llvm/ExecutionEngine/Orc/ExecutionUtils.h>
#include <llvm/ExecutionEngine/Orc/IRCompileLayer.h>
#include <llvm/ExecutionEngine/Orc/IRTransformLayer.h>
#include <llvm/ExecutionEngine/Orc/JITTargetMachineBuilder.h>
#include <llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h>
#include <llvm/ExecutionEngine/SectionMemoryManager.h>
#include <llvm/Support/ToolOutputFile.h>
#include <mlir/ExecutionEngine/ExecutionEngine.h>
#include <mlir/Support/FileUtilities.h>
#include <stdexcept>
namespace serene {
static std::string makePackedFunctionName(llvm::StringRef name) {
return "_serene_" + name.str();
}
static void packFunctionArguments(llvm::Module *module) {
auto &ctx = module->getContext();
llvm::IRBuilder<> builder(ctx);
llvm::DenseSet<llvm::Function *> interfaceFunctions;
for (auto &func : module->getFunctionList()) {
if (func.isDeclaration()) {
continue;
}
if (interfaceFunctions.count(&func)) {
continue;
}
// Given a function `foo(<...>)`, define the interface function
// `mlir_foo(i8**)`.
auto newType = llvm::FunctionType::get(
builder.getVoidTy(), builder.getInt8PtrTy()->getPointerTo(),
/*isVarArg=*/false);
auto newName = makePackedFunctionName(func.getName());
auto funcCst = module->getOrInsertFunction(newName, newType);
llvm::Function *interfaceFunc =
llvm::cast<llvm::Function>(funcCst.getCallee());
interfaceFunctions.insert(interfaceFunc);
// Extract the arguments from the type-erased argument list and cast them to
// the proper types.
auto bb = llvm::BasicBlock::Create(ctx);
bb->insertInto(interfaceFunc);
builder.SetInsertPoint(bb);
llvm::Value *argList = interfaceFunc->arg_begin();
llvm::SmallVector<llvm::Value *, 8> args;
args.reserve(llvm::size(func.args()));
for (auto &indexedArg : llvm::enumerate(func.args())) {
llvm::Value *argIndex = llvm::Constant::getIntegerValue(
builder.getInt64Ty(), llvm::APInt(64, indexedArg.index()));
llvm::Value *argPtrPtr =
builder.CreateGEP(builder.getInt8PtrTy(), argList, argIndex);
llvm::Value *argPtr =
builder.CreateLoad(builder.getInt8PtrTy(), argPtrPtr);
llvm::Type *argTy = indexedArg.value().getType();
argPtr = builder.CreateBitCast(argPtr, argTy->getPointerTo());
llvm::Value *arg = builder.CreateLoad(argTy, argPtr);
args.push_back(arg);
}
// Call the implementation function with the extracted arguments.
llvm::Value *result = builder.CreateCall(&func, args);
// Assuming the result is one value, potentially of type `void`.
if (!result->getType()->isVoidTy()) {
llvm::Value *retIndex = llvm::Constant::getIntegerValue(
builder.getInt64Ty(), llvm::APInt(64, llvm::size(func.args())));
llvm::Value *retPtrPtr =
builder.CreateGEP(builder.getInt8PtrTy(), argList, retIndex);
llvm::Value *retPtr =
builder.CreateLoad(builder.getInt8PtrTy(), retPtrPtr);
retPtr = builder.CreateBitCast(retPtr, result->getType()->getPointerTo());
builder.CreateStore(result, retPtr);
}
// The interface function returns void.
builder.CreateRetVoid();
}
};
void ObjectCache::notifyObjectCompiled(const llvm::Module *m,
llvm::MemoryBufferRef objBuffer) {
cachedObjects[m->getModuleIdentifier()] =
llvm::MemoryBuffer::getMemBufferCopy(objBuffer.getBuffer(),
objBuffer.getBufferIdentifier());
}
std::unique_ptr<llvm::MemoryBuffer>
ObjectCache::getObject(const llvm::Module *m) {
auto i = cachedObjects.find(m->getModuleIdentifier());
if (i == cachedObjects.end()) {
JIT_LOG("No object for " << m->getModuleIdentifier()
<< " in cache. Compiling.\n");
return nullptr;
}
JIT_LOG("Object for " << m->getModuleIdentifier() << " loaded from cache.\n");
return llvm::MemoryBuffer::getMemBuffer(i->second->getMemBufferRef());
}
void ObjectCache::dumpToObjectFile(llvm::StringRef outputFilename) {
// Set up the output file.
std::string errorMessage;
auto file = mlir::openOutputFile(outputFilename, &errorMessage);
if (!file) {
llvm::errs() << errorMessage << "\n";
return;
}
// Dump the object generated for a single module to the output file.
// TODO: Replace this with a runtime check
assert(cachedObjects.size() == 1 && "Expected only one object entry.");
auto &cachedObject = cachedObjects.begin()->second;
file->os() << cachedObject->getBuffer();
file->keep();
}
JIT::JIT(Namespace &ns, bool enableObjectCache,
bool enableGDBNotificationListener,
bool enablePerfNotificationListener)
: ns(ns), cache(enableObjectCache ? new ObjectCache() : nullptr),
gdbListener(enableGDBNotificationListener
? llvm::JITEventListener::createGDBRegistrationListener()
: nullptr),
perfListener(enablePerfNotificationListener
? llvm::JITEventListener::createPerfJITEventListener()
: nullptr){};
MaybeJIT JIT::make(Namespace &ns,
mlir::ArrayRef<llvm::StringRef> sharedLibPaths,
mlir::Optional<llvm::CodeGenOpt::Level> jitCodeGenOptLevel,
bool enableObjectCache, bool enableGDBNotificationListener,
bool enablePerfNotificationListener) {
auto jitEngine = std::make_unique<JIT>(ns, enableObjectCache,
enableGDBNotificationListener,
enablePerfNotificationListener);
// Why not the llvmcontext from the SereneContext??
// Sice we're going to pass the ownership of this context to a thread
// safe module later on and we will only create the jit function wrappers
// with it, then it is fine to use a new context.
//
// What might go wrong?
// in a repl env when we have to create new modules on top of each other
// having two different contex might be a problem, but i think since we
// use the first context to generate the IR and the second one to just
// run it.
std::unique_ptr<llvm::LLVMContext> ctx(new llvm::LLVMContext);
if (ns.generate().failed()) {
// TODO: Return a MaybeJIT::error() with a proper error
throw std::runtime_error("Can't compile the slir module");
}
auto &llvmModule = ns.getLLVMModule();
packFunctionArguments(&llvmModule);
auto dataLayout = llvmModule.getDataLayout();
// Callback to create the object layer with symbol resolution to current
// process and dynamically linked libraries.
auto objectLinkingLayerCreator = [&](llvm::orc::ExecutionSession &session,
const llvm::Triple &tt) {
auto objectLayer =
std::make_unique<llvm::orc::RTDyldObjectLinkingLayer>(session, []() {
return std::make_unique<llvm::SectionMemoryManager>();
});
// Register JIT event listeners if they are enabled.
if (jitEngine->gdbListener)
objectLayer->registerJITEventListener(*jitEngine->gdbListener);
if (jitEngine->perfListener)
objectLayer->registerJITEventListener(*jitEngine->perfListener);
// COFF format binaries (Windows) need special handling to deal with
// exported symbol visibility.
// cf llvm/lib/ExecutionEngine/Orc/LLJIT.cpp LLJIT::createObjectLinkingLayer
llvm::Triple targetTriple(llvm::Twine(llvmModule.getTargetTriple()));
if (targetTriple.isOSBinFormatCOFF()) {
objectLayer->setOverrideObjectFlagsWithResponsibilityFlags(true);
objectLayer->setAutoClaimResponsibilityForObjectSymbols(true);
}
// Resolve symbols from shared libraries.
for (auto libPath : sharedLibPaths) {
auto mb = llvm::MemoryBuffer::getFile(libPath);
if (!mb) {
llvm::errs() << "Failed to create MemoryBuffer for: " << libPath
<< "\nError: " << mb.getError().message() << "\n";
continue;
}
auto &JD = session.createBareJITDylib(std::string(libPath));
auto loaded = llvm::orc::DynamicLibrarySearchGenerator::Load(
libPath.data(), dataLayout.getGlobalPrefix());
if (!loaded) {
llvm::errs() << "Could not load " << libPath << ":\n "
<< loaded.takeError() << "\n";
continue;
}
JD.addGenerator(std::move(*loaded));
cantFail(objectLayer->add(JD, std::move(mb.get())));
}
return objectLayer;
};
// Callback to inspect the cache and recompile on demand. This follows Lang's
// LLJITWithObjectCache example.
auto compileFunctionCreator = [&](llvm::orc::JITTargetMachineBuilder JTMB)
-> llvm::Expected<
std::unique_ptr<llvm::orc::IRCompileLayer::IRCompiler>> {
if (jitCodeGenOptLevel)
JTMB.setCodeGenOptLevel(jitCodeGenOptLevel.getValue());
auto TM = JTMB.createTargetMachine();
if (!TM)
return TM.takeError();
return std::make_unique<llvm::orc::TMOwningSimpleCompiler>(
std::move(*TM), jitEngine->cache.get());
};
// Create the LLJIT by calling the LLJITBuilder with 2 callbacks.
auto jit =
cantFail(llvm::orc::LLJITBuilder()
.setCompileFunctionCreator(compileFunctionCreator)
.setObjectLinkingLayerCreator(objectLinkingLayerCreator)
.create());
// Add a ThreadSafemodule to the engine and return.
llvm::orc::ThreadSafeModule tsm(std::move(llvmModule), std::move(ctx));
// TODO: Do we need a module transformer here???
cantFail(jit->addIRModule(std::move(tsm)));
jitEngine->engine = std::move(jit);
// Resolve symbols that are statically linked in the current process.
llvm::orc::JITDylib &mainJD = jitEngine->engine->getMainJITDylib();
mainJD.addGenerator(
cantFail(llvm::orc::DynamicLibrarySearchGenerator::GetForCurrentProcess(
dataLayout.getGlobalPrefix())));
return MaybeJIT::success(std::move(jitEngine));
};
} // namespace serene

View File

@ -1,4 +1,4 @@
/**
/*
* Serene programming language.
*
* Copyright (c) 2020 Sameer Rahmani <lxsameer@gnu.org>
@ -24,15 +24,18 @@
#include "serene/namespace.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinOps.h"
#include "serene/context.h"
#include "serene/errors/constants.h"
#include "serene/exprs/expression.h"
#include "serene/llvm/IR/Value.h"
#include "serene/slir/slir.h"
#include <llvm/ADT/StringRef.h>
#include <llvm/Support/FormatVariadic.h>
#include <llvm/Support/raw_ostream.h>
#include <memory>
#include <mlir/IR/Builders.h>
#include <mlir/IR/BuiltinOps.h>
#include <stdexcept>
#include <string>
@ -46,9 +49,6 @@ Namespace::Namespace(SereneContext &ctx, llvm::StringRef ns_name,
: ctx(ctx), name(ns_name)
{
mlir::OpBuilder builder(&ctx.mlirContext);
// TODO: Fix the unknown location by pointing to the `ns` form
module = mlir::ModuleOp::create(builder.getUnknownLoc(), ns_name);
if (filename.hasValue()) {
this->filename.emplace(filename.getValue().str());
}
@ -80,49 +80,60 @@ makeNamespace(SereneContext &ctx, llvm::StringRef name,
uint Namespace::nextFnCounter() { return fn_counter++; };
mlir::ModuleOp &Namespace::getModule() { return this->module; };
SereneContext &Namespace::getContext() { return this->ctx; };
void Namespace::setLLVMModule(std::unique_ptr<llvm::Module> m) {
this->llvmModule = std::move(m);
};
llvm::Module &Namespace::getLLVMModule() {
// TODO: check the llvm module to make sure it is initialized
return *llvmModule;
};
MaybeModuleOp Namespace::generate() {
mlir::OpBuilder builder(&ctx.mlirContext);
// TODO: Fix the unknown location by pointing to the `ns` form
// TODO: We need to call `erase` method of module somewhere to clean it up
// maybe use a unique ptr?
auto module = mlir::ModuleOp::create(builder.getUnknownLoc(), name);
mlir::LogicalResult Namespace::generate() {
for (auto &x : getTree()) {
x->generateIR(*this);
x->generateIR(*this, module);
}
if (mlir::failed(runPasses())) {
if (mlir::failed(runPasses(module))) {
// TODO: throw a proper errer
module.emitError("Failure in passes!");
return mlir::failure();
return MaybeModuleOp::error(true);
}
if (ctx.getTargetPhase() >= CompilationPhase::IR) {
auto llvmTmpModule = slir::toLLVMIR<Namespace>(*this);
this->llvmModule = std::move(llvmTmpModule);
}
return mlir::success();
return MaybeModuleOp::success(module);
}
mlir::LogicalResult Namespace::runPasses() { return ctx.pm.run(module); };
mlir::LogicalResult Namespace::runPasses(mlir::ModuleOp &m) {
return ctx.pm.run(m);
};
void Namespace::dump() {
llvm::outs() << "\nMLIR: \n";
module->dump();
if (llvmModule) {
llvm::outs() << "\nLLVM IR: \n";
llvmModule->dump();
auto maybeModuleOp = generate();
if (!maybeModuleOp) {
llvm::outs() << "Failed to generate the IR.\n";
return;
}
maybeModuleOp.getValue().dump();
};
Namespace::~Namespace() { this->module.erase(); }
namespace slir {
template class Generatable<Namespace>;
}
MaybeModule Namespace::compileToLLVM() {
auto m = generate();
if (!m) {
NAMESPACE_LOG("IR generation failed for '" << name << "'");
return MaybeModule::error(true);
}
if (ctx.getTargetPhase() >= CompilationPhase::IR) {
return MaybeModule::success(
::serene::slir::compileToLLVMIR(ctx, m.getValue()));
}
return MaybeModule::error(true);
};
Namespace::~Namespace(){};
} // namespace serene

64
src/serene/slir/slir.cpp Normal file
View File

@ -0,0 +1,64 @@
/* -*- C++ -*-
* Serene programming language.
*
* Copyright (c) 2019-2021 Sameer Rahmani <lxsameer@gnu.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "serene/slir/slir.h"
namespace serene {
namespace slir {
std::unique_ptr<llvm::Module> compileToLLVMIR(serene::SereneContext &ctx,
mlir::ModuleOp &module) {
// Register the translation to LLVM IR with the MLIR context.
mlir::registerLLVMDialectTranslation(ctx.mlirContext);
// Convert the module to LLVM IR in a new LLVM IR context.
auto llvmModule = mlir::translateModuleToLLVMIR(module, ctx.llvmContext);
if (!llvmModule) {
// TODO: Return a Result type instead
llvm::errs() << "Failed to emit LLVM IR\n";
throw std::runtime_error("Failed to emit LLVM IR\n");
}
// Initialize LLVM targets.
llvm::InitializeNativeTarget();
llvm::InitializeNativeTargetAsmPrinter();
// TODO: replace this call with our own version of setupTargetTriple
mlir::ExecutionEngine::setupTargetTriple(llvmModule.get());
/// Optionally run an optimization pipeline over the llvm module.
auto optPipeline = mlir::makeOptimizingTransformer(
/*optLevel=*/ctx.getOptimizatioLevel(), /*sizeLevel=*/0,
/*targetMachine=*/nullptr);
if (auto err = optPipeline(llvmModule.get())) {
llvm::errs() << "Failed to optimize LLVM IR " << err << "\n";
throw std::runtime_error("Failed to optimize LLVM IR");
}
return llvmModule;
};
} // namespace slir
} // namespace serene