[DDMD] [refactor] Move Expression::interpret into a visitor class#3251
[DDMD] [refactor] Move Expression::interpret into a visitor class#3251yebblies merged 1 commit intodlang:masterfrom
Conversation
|
Is this comment still relevant or can you remove it? https://github.com/yebblies/dmd/blob/expinterpret/src/interpret.c#L2167 |
|
Just one thing, there's apparently a performance regression since recently: https://d.puremagic.com/issues/show_bug.cgi?id=12137 I don't want to point fingers since I haven't done any tests, but have you noticed whether these pulls have made any impact on performance? |
|
Nitpick: assert(((IndexExp*)el)->e1 != e);
|
|
|
|
A few things I really like about these transformations:
|
|
And #3: Rather than having to chase recursive calls (and see where a result is finally returned), you can immediately tell where a result is stored. |
|
Here's a classic example of what I said in #2 which I just found in the old diff: That's just horrible code, hiding a |
|
|
I don't know what you mean, that line is not a comment.
I honestly have no idea, but I didn't introduce any new heap allocations. Kenji's comment makes it sound like a problem with the beta build.
Changed to
Ok, spaced out all the
My main gripe with it is that all returns become fugly. Things like I'm not so sure about 3, you can make the returns very hard to follow with a couple of helpers. It is nice though to have a single entry point in case you want to check the result. |
|
Around: https://github.com/yebblies/dmd/blob/expinterpret/src/interpret.c#L3564 e1 = new SliceExp(e->loc, e1,
new IntegerExp(e->loc, 0, Type::tsize_t),This used to be: e1 = new SliceExp(loc, e1,
new IntegerExp(Loc(), 0, Type::tsize_t),IOW, a default Loc() was used for the |
|
Yeah that's pretty nasty. |
Damn github is wrongly displaying the line count for me, I meant this comment: |
Are you sure? That seems highly unlikely, is it possible it's a diff mismatch? |
If it did it would change no-line-number into has-line-number which would be an improvement, |
|
Yeah those |
|
Well if it improves the diagnostics all the better, but I'm not sure why |
|
The comment was lying, I changed it to: |
Well that certainly does look like I changed it. I still have no idea how that could have happened though. It would have used |
Oops. Well I know how that one happened, fixed. |
|
This would have to go into one of Steve McConnell's books for how not to write APIs: if (e->isBool(false))
result = 0;
else if (isTrueBool(e))
result = 1; |
|
I never really grasped how enormous the interpreter was before this pull. 10000 lines of crazy special cases. |
|
Review done. |
|
Auto-merge toggled on |
|
Thanks for the hard work. |
Thanks for the hard review. These pulls would be going nowhere without your help. I better get some sleep now, it's almost 6am here. |
|
Win32 failure is not pull-related. |
[DDMD] [refactor] Move Expression::interpret into a visitor class


Haha, diff too big to be shown.