Skip to content
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

Do all interpreting inside CTFE instead of in optimize(WANTinterpret) #2136

Merged
merged 3 commits into from Jul 9, 2013

Conversation

donc
Copy link
Collaborator

@donc donc commented Jun 5, 2013

This is ultimate goal I've been working towards with all my CTFE patches over the past 18 months. It will fail until all of my remaining patches are merged in.
Once this passes, CTFE will be able to use proper variable storage, fixing a multitude of bugs, and JIT compilation will become possible.

The reason why merging optimize(WANTinterpret) and CTFE is necessary is that in things like:
const int x = bar[ { return $-1; } ];
__dollar is a temporary variable, which CTFE needs to read, but it's not declared in a CTFE function. It's not possible to JIT compile a CTFE function without creating a stack to put all its parameters on.

@don-clugston-sociomantic
Copy link
Contributor

Note that the "run semantic on global variables" commit isn't doing anything new, it is just moving a couple of lines of code from optimize.c into interpret.c.

@yebblies
Copy link
Member

yebblies commented Jul 6, 2013

The recent default argument stuff has changed when it is valid to use pointer comparison to compare types, and I expect this is what is causing the failure here.

Only seems to happen with forward-referenced globals, for example:
const int c23 = b23 * b23;
const int a23 = 1;
const int b23 = a23 * 3;
instead of in the optimizer
@donc
Copy link
Collaborator Author

donc commented Jul 9, 2013

This is finally ready, after 18 months and 53 pull requests! Please merge this now.

WalterBright added a commit that referenced this pull request Jul 9, 2013
Do all interpreting inside CTFE instead of in optimize(WANTinterpret)
@WalterBright WalterBright merged commit e1ce57e into dlang:master Jul 9, 2013
@WalterBright
Copy link
Member

Rock on, Don! You da man!

@donc
Copy link
Collaborator Author

donc commented Jul 9, 2013

Thanks, Walter! This was the toughest bit of work I've ever done in the compiler. The number of bugs it exposed was incredible.
We now have rock-solid treatment of compile time values. Good times.

@9rnsr
Copy link
Contributor

9rnsr commented Jul 9, 2013

Awesome work!

@andralex
Copy link
Member

andralex commented Jul 9, 2013

Awesome indeed!

@ghost
Copy link

ghost commented Jul 30, 2013

Just a note, a regression has come up with this commit: http://d.puremagic.com/issues/show_bug.cgi?id=10722

@quickfur
Copy link
Member

Another regression: http://d.puremagic.com/issues/show_bug.cgi?id=10687

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants