-
-
Notifications
You must be signed in to change notification settings - Fork 662
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
Reconstruct do-loops #7979
Reconstruct do-loops #7979
Conversation
Are you thinking about reconstructing for loops? IIRC, I had a few optimizations in there, which may have got a bit rusty. |
I put a fix in for hxcpp: |
# Conflicts: # .travis.yml
I have added support for do-while loops to the JVM target. It's not perfect but good enough for now. @jdonaldson Lua still fails: @ncannasse HL still hangs |
I'll check into this, sorry for the delay. |
# Conflicts: # src/generators/genjvm.ml
Updated the branch and added a checkbox for Justin. :) |
/// CHECKBOX CLICKING INTENSIFIES /// |
I want to check this for 4.3 and see where we're at. Maybe I'm even brave enough to fix HL. |
Shockingly, the HL debugger worked and pointed me to function main() {
var a = ~/a+/g.map("aaabacx", function(r) return "[" + r.matched(0).substr(1) + "]");
trace(a);
} According to the debugger, |
final global = true;
function main() {
var offset = 0;
do {
trace(offset);
if (offset >= 3)
break;
offset = 3;
} while (global);
} This infinitely prints |
Version without trace: final global = true;
@:pure(false)
function dontTrace(d:Int) {}
function getOffset() {
return 0;
}
function main() {
var offset = getOffset();
do {
dontTrace(offset);
if (offset >= 3)
break;
offset = 3;
} while (global);
} This is some problem with hlopt. Diff with/without The original compares via registers 11 -> 1 -> 8, the optimized version stores in register 4 but never does anything with it. At the very least this would require a This might be a bit above my paygrade because it likely goes into the register liveness analysis. I'll probably just disable do-reconstruction for HL, but at some point this should definitely be looked into. |
Currently, the analyzer does not reconstruct
do
-loops so the generators never really see them. This PR changes this and surfaced some problems:This somehow generates a label after closing the loop, which throws off native compilation:
while((cur_match < 10)) _hx_goto_1:;
Fails with
/home/travis/build/Simn/haxe/std/lua/_std/EReg.hx:142: characters 5-10 : This expression cannot be compiled to Lua
Just hangs.
I'm assigning the related target maintainers. I don't want to merge this for 4.0 anyway, but we should look into supporting this properly again.