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

constant blocks are in random order #7450

Closed
vicuna opened this issue Jan 3, 2017 · 2 comments
Closed

constant blocks are in random order #7450

vicuna opened this issue Jan 3, 2017 · 2 comments

Comments

@vicuna
Copy link

vicuna commented Jan 3, 2017

Original bug ID: 7450
Reporter: markghayden
Assigned to: @chambart
Status: assigned (set by @chambart on 2017-01-03T21:03:08Z)
Resolution: open
Priority: normal
Severity: feature
Platform: AMD64
OS: MacOS
OS Version: 10.12.2
Version: 4.04.0
Category: middle end (typedtree to clambda)
Tags: flambda

Bug description

Compile a file such as:

let v0 = [0;1;2;3;4;5;6;7;8;9;10;11;12;13;14;15;16;17] ;;

Then review the order of the constant blocks in the resulting assembly (attached). They appear to be in a random order, perhaps as though they were dumped from a hash table.

It is understood that with shared constant blocks the order may at times depend on the specifics of the sharing. However, it seems like a better idea would be to follow some heuristic order rather than scrambling them. with a goal to achieve better locality and cache-behavior. For instance, in this case it might be better if the order were in depth-traversal so that scanning the list resulted in reading forward through memory. Perhaps enumerating constant blocks first by file-order in which the containing block first appeared and then by depth traversal order would be simple and effective.

Steps to reproduce

Compiled with 4.05.0+flambda trunk.

File attachments

@github-actions
Copy link

github-actions bot commented May 9, 2020

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 9, 2020
@lthls
Copy link
Contributor

lthls commented May 9, 2020

I think this one has been fixed some time ago. At least with the provided example, the constant blocks appear in the source file order in this particular case.

Feel free to reopen if you find other examples of bad ordering.

@lthls lthls closed this as completed May 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants