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
Static array and array literal improvements #375
Conversation
Your fix for bug 2356 is good when the array is small (length <= about 8), but a full fix would check if all elements are compile-time constants. If they are, create a const initializer, and blit it across. Also note that CTFE can create an array literal as well, so the transformation needs to happen in the glue layer, not in expression.c. |
I was able to move static array construction codes into |
Interpret.c should not be changed. Array literals MUST survive until the glue layer. |
glue layer == e2ir.c ? (I think expression.c is front-end, and src/backend is backend layer.) |
Remove fixing 5290. Because it is not bug fix, it is enhancement. |
What prevents this from being merged? |
No, and I have no schedule to implement it in near future. |
Could you please split this into several pull requests so the smaller issues can be fixed? |
…dy processed at the starting of semantic.
…unction parameter Call dtor of static array parameter at function scope end.
…ction argument call element postblits of static array on function argument
- Call postblits on array slice assign - Call postblits on array literal elements
Remove commit for bug 2356, and reconstructed commits. |
Static array and array literal improvements
Check static-array length matching on assign expression.
Issue 5290 - Static array literals with too few elementsCheck static-array length matching on initialiging.
Call postblits of array literal elements correctly.
Issue 2356 - array literal as non static initializer generates horribly inefficient code
If array literal is used as static-array initializer, the initializing is converted as initializings of elements.
An initializing of static-array
S[n] sa = [e0, e1, ..., en-1];
is converted to
sa[0] = e0, sa[1] = e1, ..., sa[n-1] = en-1;