Comments (9)
The new plan is not to do A normal form, since the JVM bytecode is stack based, and that is easier to generate straight from an AST.
I am going to be creating and moving some more complete programs, to experiment on, into the examples/domains/
folder.
These should make for good compilation targets.
from flix.
I want to give a few pointers on what I think is important for the CodeGen:
- Attach debug information (e.g. filename, line no, col no) to generated class(es). This will be immensely useful for debugging and profiling.
- Don't worry about the performance of the CodeGenerator. Use all available help facilities from ASM5. This includes letting it calculate max variables and frames, but also running with all the checkers.
- Focus on generating the code. We will figure out how to execute it later. Probably we will decorate one of our ASTs with references to the code loaded via reflection. You should still be able to write tests though. Just write a simple wrapper around a class loader.
- If longs are too troublesome, then you can start with Ints. I will leave this choice to you. Ultimately we probably have Longs, or both Int and Longs.
- Use the CodeGenIR AST and modified it to have what you need. Once you have a reasonable implementation, we can write a simple translation from TypedAst to it. (For a subset of expressions at first).
Less important, but "nice-to-have" in the future:
- Instead of generating one class with names like Belnap$Leq, we should map the Flix namespaces to Java packages, so A::B::C::Leq would create packages A and B, with class C and method Leq on C.
from flix.
Oh, and I forgot, and this is important:
Make sure the CodeGen is functional. Thus, I think it is better to explicitly pass around the Class/Method visitors. Unless you see a strong reason not to.
from flix.
Don't worry about the performance of the CodeGenerator. Use all available help facilities from ASM5. This includes letting it calculate max variables and frames, but also running with all the checkers.
I'll need to look into this (maybe later), but it seems that the stack and frame computation runs after the CheckClassAdapter
. So I have to put large bogus numbers (and hope they're large enough) to ensure the CheckClassAdapter
doesn't crash. These bogus numbers are then overwritten by the actual numbers.
Make sure the CodeGen is functional. Thus, I think it is better to explicitly pass around the Class/Method visitors. Unless you see a strong reason not to.
I don't see a reason not to, but I'm curious, what's the reason for explicitly passing the visitors around?
from flix.
I don't see a reason not to, but I'm curious, what's the reason for explicitly passing the visitors around?
Mostly to ensure that Flix can be instantiated multiple times in the same JVM, and in the future to ensure that we can even run the same Flix instance in parallel. Thus staying as close as possible to functional programming is preferable.
from flix.
I think we will have the following (backend) IRs:
SimplifiedIR
- The TypedAst withmatch
,switch
, and other high-level constructs eliminated. Variables are numbered etc.ReducedIR
- TheSimplifiedIR
with partial evaluation applied. E.g. constant expressions are folded. Functions may be inlined, etc. The compiler will generate code from this IR.ExecutableIR
- The only mutable AST/IR. Decorated with the code generator from the compiler. (We can make it so that if a function was not compiled, then it is interpreted. I think that would be nice). This IR uses arrays, mutablevar
's that hold references toIndexedRelation
andIndexedStore
. Rules may hold mutable cost and queries plans, etc. etc. The sameExecutableIR
cannot be evaluated twice.
from flix.
(Note to self: Where are the data types packed? In the ReducedIR or in a separate IR?)
from flix.
I think we can get rid of ReducedIR
. At least for now. Instead we should just merge ReducedIR and SimplifiedIR into one thing.
We will still have ExecutableIR though, which should be the output of the CodeGen phase.
Lets make this change together.
from flix.
Closing this and opening fine-grained issues instead.
from flix.
Related Issues (20)
- Typer: refactor package and class names
- Typer: Refactor uses of `mkUnion`
- Typer: Use `FastBoolUnification`
- Typer: Break type equality down into smaller equalities
- Add GitHub action to greet new pull requests
- Memory usage for `gradle test` HOT 12
- Investigate and improve steady-state memory usage
- Add `MonoType.Void`
- Local dependencies, project mode, and folder mode HOT 2
- Parser: `Parser2.currentSourceLocation` calls `token.text.length` which always materializes the lazy text HOT 2
- Add output of `Xmemory` to arewefast
- Reduce backend ast caching HOT 11
- Canonicalize Boolean formulas used in `BoolFormulaTable`
- Reduce memory usage of `Type.Apply`
- Parser: Possibly replace `trait Child` with `trait TreeOrToken` to reduce memory usage
- A smart constructors for all types?
- Duplicate entries in htmldoc
- Leftover type constraints HOT 4
- Confusing type error with regions/effects
- Parser: Refactor `SourceLocation` to consist of two `SourcePosition`s
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flix.