No local var option#270
Draft
Stevendeo wants to merge 10 commits into
Draft
Conversation
Stevendeo
force-pushed
the
no-local-var-option
branch
2 times, most recently
from
July 17, 2025 10:18
da8b397 to
d9a8170
Compare
Contributor
Author
|
Résultats des tests via
|
Stevendeo
force-pushed
the
no-local-var-option
branch
from
July 24, 2025 10:46
f5379f8 to
57fee26
Compare
Stevendeo
force-pushed
the
no-local-var-option
branch
3 times, most recently
from
August 26, 2025 09:11
cfbb9a3 to
778b1d3
Compare
Stevendeo
force-pushed
the
no-local-var-option
branch
from
September 11, 2025 08:56
778b1d3 to
4aead1a
Compare
Stevendeo
marked this pull request as ready for review
September 11, 2025 08:56
Stevendeo
force-pushed
the
no-local-var-option
branch
from
November 12, 2025 10:17
4aead1a to
afc17df
Compare
Contributor
Author
|
@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 ! |
Stevendeo
force-pushed
the
no-local-var-option
branch
from
November 12, 2025 15:37
5e63c23 to
3e50465
Compare
Contributor
Author
|
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). |
Stevendeo
force-pushed
the
no-local-var-option
branch
4 times, most recently
from
November 13, 2025 11:40
819d327 to
d47d498
Compare
Contributor
Author
|
Les commits suivants sont juste du nettoyage |
Stevendeo
force-pushed
the
no-local-var-option
branch
2 times, most recently
from
November 26, 2025 11:18
2ac96fa to
bcabe44
Compare
Stevendeo
marked this pull request as draft
November 26, 2025 15:00
Stevendeo
force-pushed
the
no-local-var-option
branch
from
November 26, 2025 15:00
bcabe44 to
fd456ec
Compare
Stevendeo
force-pushed
the
no-local-var-option
branch
from
February 11, 2026 14:52
fd456ec to
093a46a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.