-
Notifications
You must be signed in to change notification settings - Fork 13
No local var option #270
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: adaptation_correctif
Are you sure you want to change the base?
No local var option #270
Conversation
da8b397 to
d9a8170
Compare
|
Résultats des tests via
|
f5379f8 to
57fee26
Compare
cfbb9a3 to
778b1d3
Compare
778b1d3 to
4aead1a
Compare
4aead1a to
afc17df
Compare
|
@david-michel1 La PR a eté rebasée sur adaptation_correctif pour gagner du temps sur le merge, tu peux la review et la merger quand tu veux ! |
5e63c23 to
3e50465
Compare
|
J'ai rajouté quelques fix pour que les tests passent mieux - notamment, j'ai corrigé la représentation des binops au niveau compilateur pour limiter la quantité de parentheses, car dans l'état on dépassait les 256 parentheses (ce qui lève un gros flag au moment de la compilation). |
819d327 to
d47d498
Compare
|
Les commits suivants sont juste du nettoyage |
2ac96fa to
bcabe44
Compare
bcabe44 to
fd456ec
Compare
This PR adds a new
--no-local-varoption that forces mlang not to define local vars when calculating expressions.Expressions were compiled as sets of simple binary operations of the form
inti = intj || int k;. While this is memory efficient, I believe having the whole expression could lead to some optimizations.C compilers can optimize code with smarter heuristics. For example, when checking the definition of a given variable, the current code calculates all the possible branches while some of them could be simplified quickly (if
DC_[A] = 1, thenDC_[A] || DC_[B] || DC_[C] || DC_[D]can be evaluated to1directly, whileint0 = DC_[A] || DC_[B]; int1 = int0 || DC_[C]; int0 = int1 || DC_[D];requires to calculate everything.)We could simplify boolean expressions with some basic boolean algebra.
Ideally, the
--no-local-varoption is meant to be temporary. Either the optimization makes the code more efficient and the option becomes the default behavior, or this PR will document why mlang behaves like this.