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

Base implementation of Dynamix, Tim #111

Open
wants to merge 88 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
d499a77
Adapter/task compilation for Dynamix, depend on runtime package
molenzwiebel Mar 25, 2022
bb529aa
Namespace Dynamix files, cleanup
molenzwiebel Mar 25, 2022
0c9b662
Finalize signature generation for Dynamix
molenzwiebel Mar 25, 2022
75dd7ed
Add Tim language implementation and runtime
molenzwiebel Mar 25, 2022
f0d6a71
Add Dynamix Runtime implementation
molenzwiebel Mar 25, 2022
eae224f
Add support for constraint-analyzer property lookup and globals in Dy…
molenzwiebel Apr 3, 2022
ffb6955
Allow configuration of Dynamix entry-point rule
molenzwiebel Apr 21, 2022
a05839a
Minor fixes, include source location in rules for better stack traces
molenzwiebel Apr 21, 2022
9b39ebd
Consult rules in order of specificity during Dynamix evaluation
molenzwiebel Apr 21, 2022
1c7625d
Check for overlapping patterns in Statix, add support for concurrent …
molenzwiebel Apr 21, 2022
e4c6bfa
Add (untested) #array-write primitive to Tim
molenzwiebel Apr 21, 2022
40b2e2c
Merge from upstream
molenzwiebel Apr 21, 2022
389964a
Attempt at more efficiently comparing patterns in Statix
molenzwiebel Apr 21, 2022
83bce2e
Add some more tim primitives, make injected lists more ergonomic in D…
molenzwiebel Apr 28, 2022
81c2318
Make TFuns first-class values, do not generate signatures for bracket…
molenzwiebel May 9, 2022
1913616
Extract Tim runtime into separate project, depend on project
molenzwiebel May 12, 2022
bece936
Reorganize automatically generated Dynamix tasks
molenzwiebel May 12, 2022
ece00c1
An attempt at adding some native strategies to Tim
molenzwiebel May 12, 2022
0aa5a6c
Initial work on a closure conversion strategy
RvanBaarle Sep 10, 2022
22d12fa
Extract closures to outermost level. Fix mutually recursive closures.
RvanBaarle Sep 10, 2022
b2c6774
Add uniquify transform
RvanBaarle Sep 12, 2022
8400495
Inlining of functions
RvanBaarle Sep 20, 2022
37919bf
Support for integer operations
RvanBaarle Sep 20, 2022
a613e40
Add support for array operations
RvanBaarle Sep 21, 2022
a24f490
Add support for refs
RvanBaarle Sep 21, 2022
ca8fafc
Add support for strings
RvanBaarle Sep 22, 2022
4f283af
Add partial record support
RvanBaarle Sep 22, 2022
a063d14
Support for arguments to `#record-new`
RvanBaarle Sep 22, 2022
fae98ed
Add closure type to tim
RvanBaarle Sep 23, 2022
58352b5
Allow for negative indices in closure reads/offsets
RvanBaarle Sep 23, 2022
032df6f
Implement compilation of new closure primops
RvanBaarle Sep 23, 2022
e95a454
Combine closures for each fix expression
RvanBaarle Sep 23, 2022
b6c381b
WIP for closure conversion improvements
RvanBaarle Sep 27, 2022
ed26c61
Creation of project for LLVM IR
RvanBaarle Sep 27, 2022
424162e
Initial version of LLVM syntax
RvanBaarle Sep 27, 2022
07c6db9
Minor syntax fixes
RvanBaarle Sep 27, 2022
af1474a
Move around files and minor syntax changes
RvanBaarle Sep 28, 2022
e4722d0
Get rid of all string interpolation
RvanBaarle Sep 28, 2022
32c4752
C runtime library for Tim
RvanBaarle Sep 28, 2022
adc0604
Differentiate between printing ints and strings
RvanBaarle Sep 28, 2022
0994d8d
Fix statix type of string literal
RvanBaarle Sep 28, 2022
fc3edfc
Add array tail, length and concat operations
RvanBaarle Sep 28, 2022
fdeedb8
Minor fixes to syntax
RvanBaarle Sep 28, 2022
1fc296a
Implement the last missing features
RvanBaarle Sep 29, 2022
dd22445
Fix non-escaping closure optimizations
RvanBaarle Sep 30, 2022
d98d25c
Update compiler flags to emit bitcode
RvanBaarle Sep 30, 2022
3380018
Use static closure address if known at compile time
RvanBaarle Sep 30, 2022
94521ff
Let binding inlining
RvanBaarle Oct 4, 2022
21a43b7
Extend LLVM syntax for GC support
RvanBaarle Oct 4, 2022
3810581
WIP in explicating types further
RvanBaarle Oct 4, 2022
fa3ff44
More explicit typing
RvanBaarle Oct 4, 2022
a91464e
Explicitly typed, and progress towards GC
RvanBaarle Oct 5, 2022
8ca9b1f
quick fixes to correctly compile
RvanBaarle Oct 5, 2022
bdf90ee
Change what gets logged
RvanBaarle Oct 5, 2022
6923584
Fix incorrect base pointer
RvanBaarle Oct 6, 2022
439620e
Arrays start at one, fix tailcall issue
RvanBaarle Oct 6, 2022
e5b55ba
Array type consistency
RvanBaarle Oct 7, 2022
0d370cb
Add gc-leaf-function to function applications
RvanBaarle Oct 7, 2022
1ae60ad
Garbage collector
RvanBaarle Oct 7, 2022
81a4b6a
Remove all unused includes
RvanBaarle Oct 7, 2022
c49e60b
Scan heap for pointers as well
RvanBaarle Oct 11, 2022
20a1f7e
Support for finalizers
RvanBaarle Oct 11, 2022
cd946cd
Add [[maybe_unused]] attributes
RvanBaarle Oct 11, 2022
cd0b74e
Fix array and string operations using old references
RvanBaarle Oct 12, 2022
4c6a686
Garbage collection for closures
RvanBaarle Oct 12, 2022
a69a415
Add LLVM IR to Spoofax LWB
RvanBaarle Oct 13, 2022
246c729
Quick fix for emitting LLVM from Spoofax 3
RvanBaarle Oct 13, 2022
6b254ed
Fix a couple of bugs
RvanBaarle Oct 13, 2022
2edbd52
Change stratego provider to ctree in hopes of harmony between spoofax…
RvanBaarle Oct 14, 2022
8bf568f
Add explicit type annotations in preparation of more efficient types
RvanBaarle Oct 14, 2022
9b15144
Add type annotations to functions as well
RvanBaarle Oct 14, 2022
19ea985
Integer boxing
RvanBaarle Oct 19, 2022
e40cb02
Bitfield encoding and flag-related bugfixes
RvanBaarle Oct 19, 2022
76e1a10
Typed closures
RvanBaarle Oct 19, 2022
9343bf4
Struct type added
RvanBaarle Oct 20, 2022
b4487e5
Add typing additions to dynamix
RvanBaarle Oct 24, 2022
ff437c3
Implement tuples and fixes to types
RvanBaarle Oct 25, 2022
a532600
Rename holy to pluggable
RvanBaarle Oct 26, 2022
515e6bd
Refactor locations of ast.str, type.str and string.str
RvanBaarle Oct 26, 2022
fe20ccd
Struct inheritance
RvanBaarle Oct 26, 2022
a2ed622
Small fixes to Tim
RvanBaarle Nov 1, 2022
0292cc4
Improve performance issue, change names to match those used in Thijs'…
RvanBaarle Nov 2, 2022
a4558af
Fix closure conversion edgecase
RvanBaarle Nov 2, 2022
4409c2c
Fix recursive types and possibility for gc to encounter invalid pointers
RvanBaarle Nov 8, 2022
b06880b
Fix recursive types better
RvanBaarle Nov 8, 2022
6c8d609
Revert changes to tim type system
RvanBaarle Nov 10, 2022
d247dfa
Have structs contain scopes
RvanBaarle Nov 22, 2022
972acd3
Adding str-neq condition, slight LLVM syntax fixes, some other small …
RvanBaarle Dec 6, 2022
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
Prev Previous commit
Next Next commit
Initial version of LLVM syntax
RvanBaarle committed Sep 27, 2022
commit 424162e483a52b8c21de84941db3b4098dd10bba
44 changes: 44 additions & 0 deletions lwb/metalang/llvm/llvm.spoofax2/metaborg.yaml
Original file line number Diff line number Diff line change
@@ -42,5 +42,49 @@ language:
statix:
mode: traditional
exports:
# syntax
- language: ATerm
directory: src-gen/syntax
- language: TemplateLang
directory: syntax
includes: "**/*.sdf3"
- language: SDF
directory: src-gen/syntax
includes: "**/*.sdf"
# stratego injections (needed for syntax)
- language: Stratego-Sugar
directory: src-gen
includes: "injections/llvm/**/*.str"
# stratego pretty-printer (needed for syntax)
- language: Stratego-Sugar
directory: src-gen
includes: "pp/**/*.str"
# stratego completion (needed for syntax)
- language: Stratego-Sugar
directory: src-gen
includes: "completion/llvm/**/*.str"
# stratego signatures
- language: Stratego-Sugar
directory: src-gen
includes: "signatures/llvm/**/*.str"
- language: Stratego-Sugar
directory: src-gen
includes: "signatures/llvm-sig.str"
- language: Stratego-Sugar
directory: src-gen
includes: "signatures/permissive-water-sig.str"
# esv (colors)
- language: EditorService
directory: editor
includes: "editor/llvm/**/*.esv"
# statix signatures
# todo: disabled due to lack of re-exporting of statix specs, manually copied TExp signature
# - language: StatixLang
# directory: src-gen/statix
# includes: "signatures/**/*.stx"
- language: ATerm
directory: src-gen/statix
# pretty printing helper
- language: Stratego-Sugar
directory: trans
includes: "llvm/pp.str"
51 changes: 51 additions & 0 deletions lwb/metalang/llvm/llvm.spoofax2/syntax/Atoms.sdf3
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
module Atoms

imports

Common
Attributes

context-free sorts

Parameter
Type
Atom
Literal
Constant
Variable
TypedAtom

context-free syntax

Parameter.ParamUnnamed = <<Type> <ParameterAttribute*>>
Parameter.ParamNamed = <<Type> <Variable> <ParameterAttribute*>>
Parameter.Vararg = <...>

Type.Int64 = <i64>
Type.Int8 = <i8>
Type.Bool = <i1>
Type.Pointer = <ptr>
Type.Array = <[<POSINT> x <Type>]>
Type.Label = <label>
Type.Void = <void>
Type.Function = <<Type> (<{Parameter ", "}*>)>

Atom.Literal = <<Literal>>
Atom.ConstAtom = <<Constant>>
Atom.VarAtom = <<Variable>>
Atom.PtrToInt = <ptrtoint (ptr <Constant> to <Type>)>

Literal.Int = <<INT>>
Literal.String = <c<STRING>>

TypedAtom.TypedAtom = <<Type> <Atom>>

syntax

Variable-CF.Variable = "%" ID-CF
Constant-CF.Constant = "@" ID-CF

template options

keyword -/- [a-zA-Z0-9\_]
ID = keyword {reject}
54 changes: 54 additions & 0 deletions lwb/metalang/llvm/llvm.spoofax2/syntax/Attributes.sdf3
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
module Attributes

imports

Common

context-free sorts

ParameterAttribute
Linkage
CallConv
GlobalAttribute
FunctionAttribute
ArithAttribute
TailAttribute

context-free syntax

ParameterAttribute.NoCapture = <nocapture>
ParameterAttribute.NoFree = <nofree>
ParameterAttribute.ZeroExt = <zeroext>
ParameterAttribute.SignExt = <signext>

CallConv.DefaultCConv = <>
CallConv.CCConv = <ccc>
CallConv.TailCConv = <tailcc>

Linkage.Private = <private>
Linkage.Weak = <weak>
Linkage.DefaultLinkage = <>

GlobalAttribute.UnnamedAddr = <unnamed_addr>
GlobalAttribute.Global = <global>
GlobalAttribute.Constant = <constant>

FunctionAttribute.NoUnwind = <nounwind>
FunctionAttribute.NoReturn = <noreturn>
FunctionAttribute.InaccessibleMemOnly = <inaccessiblememonly>
FunctionAttribute.AllocKind = <allockind(<STRING>)>
FunctionAttribute.AllocSize = <allocsize(<INT>)>
FunctionAttribute.AllocFamily = <"alloc-family"=<STRING>>

ArithAttribute.NoSignedWrap = <nsw>
ArithAttribute.Exact = <exact>

TailAttribute.Tail = <tail>
TailAttribute.MustTail = <musttail>
TailAttribute.NoTail = <notail>
TailAttribute.DefaultTail = <>

template options

keyword -/- [a-zA-Z]
ID = keyword {reject}
14 changes: 5 additions & 9 deletions lwb/metalang/llvm/llvm.spoofax2/syntax/Common.sdf3
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
module Common

lexical sorts
ID INT STRING
ID INT POSINT STRING
STRING_CHAR BACKSLASH_CHAR
COMMENT_CHAR INSIDE_COMMENT
NEWLINE_EOF EOF

lexical syntax

ID = [a-zA-Z] [a-zA-Z0-9]*
ID = [a-zA-Z0-9\_\.]*
INT = "-"? [0-9]+
POSINT = [0-9]+
STRING = "\"" STRING_CHAR* "\""
STRING_CHAR = ~[\\\"\n]
STRING_CHAR = "\\" [\\\"]
STRING_CHAR = "\\" [0-9a-fA-F] [0-9a-fA-F]
LAYOUT = [\ \t\n\r]
COMMENT_CHAR = [\*]
LAYOUT = "/*" INSIDE_COMMENT* "*/"
INSIDE_COMMENT = ~[\*]
INSIDE_COMMENT = COMMENT_CHAR
LAYOUT = "//" ~[\n\r]* NEWLINE_EOF
LAYOUT = ";" ~[\n\r]* NEWLINE_EOF
NEWLINE_EOF = [\n\r]
NEWLINE_EOF = EOF
EOF =
@@ -27,7 +24,6 @@ lexical restrictions

// Ensure greedy matching for lexicals

COMMENT_CHAR -/- [\/]
INT -/- [0-9]
ID -/- [a-zA-Z0-9\_]

64 changes: 64 additions & 0 deletions lwb/metalang/llvm/llvm.spoofax2/syntax/Statements.sdf3
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
module Statements

imports

Common
Attributes
Atoms

context-free sorts

Block
Label
Terminator
Statement
Expression
Operation
Condition

context-free syntax

Block.Block = <
<lbl:Label>
<stmts:Statement*>
<end:Terminator>> {layout(pp-indent lbl stmts && pp-align-list stmts && pp-align stmts end)}

Label.Label = <<ID>:>
Label.NoLabel = <>
Statement.Hello = <hello>

Terminator.Ret = <ret <TypedAtom>>
Terminator.RetVoid = <ret void>
Terminator.BrCond = <br <TypedAtom>, label <Atom>, label <Atom>>
Terminator.Br = <br label <Atom>>
Terminator.Switch = <switch <TypedAtom>, <TypedAtom> [<{TypedAtom ", "}*>]>
Terminator.Unreachable = <unreachable>

Statement.Assign = <<Variable> = <Expression>>
Statement.Expression = <<Expression>>

Expression.BinaryOp = <<Operation> <ArithAttribute*> <Type> <Atom>, <Atom>>
Expression.ICmp = <icmp <Condition> <Type> <Atom>, <Atom>>
Expression.IntToPtr = <inttoptr <TypedAtom> to <Type>>
Expression.PtrToInt = <ptrtoint <TypedAtom> to <Type>>
Expression.Call = <<TailAttribute> call <Type> <CallConv> <Constant>(<{TypedAtom ", "}*>)>
Expression.Load = <load <Type>, <TypedAtom>>
Expression.Store = <store <TypedAtom>, <TypedAtom>>
Expression.GetElementPtr = <getelementptr <Type>, <{TypedAtom ", "}*>>

Operation.Add = <add>
Operation.Sub = <sub>
Operation.Mul = <mul>
Operation.SDiv = <sdiv>

Condition.Equal = <eq>
Condition.NotEqual = <neq>
Contition.SignedGreaterThan = <sgt>
Contition.SignedGreaterEqual = <sge>
Contition.SignedLessThan = <slt>
Contition.SignedLessEqual = <sle>

template options

keyword -/- [a-zA-Z0-9\_]
ID = keyword {reject}
20 changes: 19 additions & 1 deletion lwb/metalang/llvm/llvm.spoofax2/syntax/llvm.sdf3
Original file line number Diff line number Diff line change
@@ -3,6 +3,9 @@ module llvm
imports

Common
Attributes
Statements
Atoms

context-free start-symbols

@@ -11,7 +14,22 @@ context-free start-symbols
context-free sorts

Start
Definition

context-free syntax

Start.LLVMEmpty = <>
Start.LLVMProgram = <<defs:Definition*>> {layout(pp-align-list defs)}

Definition.TargetTriple = <target triple = <STRING>>
Definition.GlobalDef = <<Constant> = <Linkage> <GlobalAttribute*> <Type> <Literal>>
Definition.FunDecl = <declare <Linkage> <Type> <CallConv> <Constant>(<{Parameter ", "}*>) <FunctionAttribute*>>
Definition.FunDef = <
define <Linkage> <Type> <CallConv> <Constant>(<{Parameter ", "}*>) <FunctionAttribute*> {
<blks:Block*>
}> {layout(pp-align-list blks)}

template options

keyword -/- [a-zA-Z0-9\_]
ID = keyword {reject}

1 change: 1 addition & 0 deletions lwb/metalang/tim/tim.spoofax2/metaborg.yaml
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ dependencies:
source:
- org.metaborg:meta.lib.spoofax:${metaborgVersion}
- org.metaborg:statix.runtime:${metaborgVersion}
- org.metaborg:llvm:0.1.0-SNAPSHOT
pardonedLanguages:
- EditorService
- Stratego-Sugar
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@ imports

signatures/tim/-
signatures/tim-sig
signatures/llvm-sig
compile/explicate-globals
compile/string