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

Fix scope overlapping in NAOT DWARF info #444

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

agocke
Copy link
Member

@agocke agocke commented Jun 30, 2023

We currently create a new lexical scope for each live variable range as reported by the JIT. Liveness ranges, however, are not the same as lexical scopes. In particular, lexical scopes are never partially overlapping. Liveness ranges are. Overlapping scopes produce errors in llvm-dwarfdump --verify. This change maps the objwriter behavior to use one lexical scope for the whole method, which is the semantic used in IL. This is overly broad, but correct according to the DWARF spec. We can add support for proper lexical scopes using the PDB information in the future.

We currently create a new lexical scope for each live variable
range as reported by the JIT. Liveness ranges, however, are
not the same as lexical scopes. In particular, lexical scopes
are never partially overlapping. Liveness ranges are. Overlapping
scopes produce errors in llvm-dwarfdump --verify. This change maps
the objwriter behavior to use one lexical scope for the whole method,
which is the semantic used in IL. This is overly broad, but correct
according to the DWARF spec. We can add support for proper lexical
scopes using the PDB information in the future.
Comment on lines +496 to +497
/// there is only one scope for the whole method. We could be more precise
/// in the future by pulling the scope information from the PDB.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know how the lexical scope information is used by debugger? I suppose it allows the debugger to provide the values of only the subset of locals that are relevant in the current context of the function?

Note that the JIT will shorten and lengthen the live ranges of locals in arbitrary ways when optimizing, but presumably the debugger handles the live ranges and the lexical scopes as two separate sources of "which local values should be displayed here".

In debug the JIT will extend the live range of all IL locals to the full function, regardless of when they are last used (both as a throughput optimization and for diagnostic purposes). Without having these lexical scopes I assume it means that the debugger may display multiple separate locals of the same name (e.g. think two i induction variables from separate loops). If I understand correctly this is what makes having these lexical scopes desirable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that description sounds right to me.

@agocke agocke merged commit 8e95993 into dotnet:dotnet/main Jun 30, 2023
directhex pushed a commit that referenced this pull request Jun 30, 2023
We currently create a new lexical scope for each live variable
range as reported by the JIT. Liveness ranges, however, are
not the same as lexical scopes. In particular, lexical scopes
are never partially overlapping. Liveness ranges are. Overlapping
scopes produce errors in llvm-dwarfdump --verify. This change maps
the objwriter behavior to use one lexical scope for the whole method,
which is the semantic used in IL. This is overly broad, but correct
according to the DWARF spec. We can add support for proper lexical
scopes using the PDB information in the future.

(cherry picked from commit 8e95993)
@agocke agocke deleted the varscope-to-method branch June 30, 2023 16:07
filipnavara added a commit to filipnavara/runtime that referenced this pull request Sep 27, 2023
filipnavara added a commit to filipnavara/runtime that referenced this pull request Oct 2, 2023
filipnavara added a commit to filipnavara/runtime that referenced this pull request Oct 23, 2023
filipnavara added a commit to filipnavara/runtime that referenced this pull request Dec 6, 2023
filipnavara added a commit to filipnavara/runtime that referenced this pull request Dec 11, 2023
filipnavara added a commit to filipnavara/runtime that referenced this pull request Dec 17, 2023
radekdoulik pushed a commit to radekdoulik/llvm-project that referenced this pull request May 9, 2024
We currently create a new lexical scope for each live variable
range as reported by the JIT. Liveness ranges, however, are
not the same as lexical scopes. In particular, lexical scopes
are never partially overlapping. Liveness ranges are. Overlapping
scopes produce errors in llvm-dwarfdump --verify. This change maps
the objwriter behavior to use one lexical scope for the whole method,
which is the semantic used in IL. This is overly broad, but correct
according to the DWARF spec. We can add support for proper lexical
scopes using the PDB information in the future.

(cherry picked from commit 8e95993)
akoeplinger pushed a commit that referenced this pull request May 17, 2024
We currently create a new lexical scope for each live variable
range as reported by the JIT. Liveness ranges, however, are
not the same as lexical scopes. In particular, lexical scopes
are never partially overlapping. Liveness ranges are. Overlapping
scopes produce errors in llvm-dwarfdump --verify. This change maps
the objwriter behavior to use one lexical scope for the whole method,
which is the semantic used in IL. This is overly broad, but correct
according to the DWARF spec. We can add support for proper lexical
scopes using the PDB information in the future.

(cherry picked from commit 8e95993)
radekdoulik pushed a commit that referenced this pull request Aug 16, 2024
We currently create a new lexical scope for each live variable
range as reported by the JIT. Liveness ranges, however, are
not the same as lexical scopes. In particular, lexical scopes
are never partially overlapping. Liveness ranges are. Overlapping
scopes produce errors in llvm-dwarfdump --verify. This change maps
the objwriter behavior to use one lexical scope for the whole method,
which is the semantic used in IL. This is overly broad, but correct
according to the DWARF spec. We can add support for proper lexical
scopes using the PDB information in the future.

(cherry picked from commit 8e95993)
radekdoulik pushed a commit that referenced this pull request Sep 2, 2024
We currently create a new lexical scope for each live variable
range as reported by the JIT. Liveness ranges, however, are
not the same as lexical scopes. In particular, lexical scopes
are never partially overlapping. Liveness ranges are. Overlapping
scopes produce errors in llvm-dwarfdump --verify. This change maps
the objwriter behavior to use one lexical scope for the whole method,
which is the semantic used in IL. This is overly broad, but correct
according to the DWARF spec. We can add support for proper lexical
scopes using the PDB information in the future.

(cherry picked from commit 8e95993)
radekdoulik pushed a commit that referenced this pull request Sep 12, 2024
We currently create a new lexical scope for each live variable
range as reported by the JIT. Liveness ranges, however, are
not the same as lexical scopes. In particular, lexical scopes
are never partially overlapping. Liveness ranges are. Overlapping
scopes produce errors in llvm-dwarfdump --verify. This change maps
the objwriter behavior to use one lexical scope for the whole method,
which is the semantic used in IL. This is overly broad, but correct
according to the DWARF spec. We can add support for proper lexical
scopes using the PDB information in the future.

(cherry picked from commit 8e95993)
radekdoulik pushed a commit that referenced this pull request Sep 19, 2024
We currently create a new lexical scope for each live variable
range as reported by the JIT. Liveness ranges, however, are
not the same as lexical scopes. In particular, lexical scopes
are never partially overlapping. Liveness ranges are. Overlapping
scopes produce errors in llvm-dwarfdump --verify. This change maps
the objwriter behavior to use one lexical scope for the whole method,
which is the semantic used in IL. This is overly broad, but correct
according to the DWARF spec. We can add support for proper lexical
scopes using the PDB information in the future.

(cherry picked from commit 8e95993)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants