Skip to content

dlopen: Some cleanup and add future for line numbers#27600

Merged
dlongnecke-cray merged 5 commits intochapel-lang:mainfrom
dlongnecke-cray:dynamic-loading-12
Aug 11, 2025
Merged

dlopen: Some cleanup and add future for line numbers#27600
dlongnecke-cray merged 5 commits intochapel-lang:mainfrom
dlongnecke-cray:dynamic-loading-12

Conversation

@dlongnecke-cray
Copy link
Contributor

@dlongnecke-cray dlongnecke-cray commented Aug 5, 2025

This PR does a small refactor of compiler errors emitted in module code for dynamic loading and procedure pointers. It adds a self-contained future that ilustrates how procedure pointers don't work with insertLineNumbers yet.

Reviewed by @jabraham17. Thanks!

@dlongnecke-cray dlongnecke-cray self-assigned this Aug 5, 2025
@dlongnecke-cray dlongnecke-cray changed the title Cleanup for procedure pointer errors and add future for line numbers dlopen: Some cleanup and add future for line numbers Aug 5, 2025
@jabraham17 jabraham17 self-requested a review August 7, 2025 19:24
Comment on lines 50 to 53
param unsupportedLlvmVersion = CHPL_LLVM_VERSION == "14" ||
CHPL_LLVM_VERSION == "13" ||
CHPL_LLVM_VERSION == "12" ||
CHPL_LLVM_VERSION == "11";
Copy link
Member

Choose a reason for hiding this comment

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

nit, drop 11, 12, and 13 here

Comment on lines 92 to 94
proc isDynamicLoadingEnabled {
return isDynamicLoadingSupported;
}
Copy link
Member

Choose a reason for hiding this comment

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

whats the point of this proc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've kind of waffled between removing it and not, I guess I can just remove it but I can foresee cases where I want to disable dynamic loading at runtime so thought about just leaving it in.

Copy link
Member

Choose a reason for hiding this comment

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

works for me, perhaps a comment is a good idea. Otherwise it just looks like unnecessary indirection

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went ahead and removed it for now. I can always add it again later when I end up running into the particular roadblock I'm thinking of.

const ret = chpl_procToTestInsertLineNumbers;
return ret;
}

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I understand why chpl_procToTestInsertLineNumbers has to be defined in ChapelDynamicLoading, since its basically only added to support this test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I expect this test will continue to exist in the future, so might as well have a symbol for the purpose. I can't think of a better place to put it. Maybe ChapelBase.chpl? I could co-opt an existing symbol that so happens to need line numbers, but that feels kind of strange to me.

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I understand why it has to be an internal symbol?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it has to be a standard or internal symbol in order to activate insertLineNumbers.cpp. I guess it could also be a user-defined proc using the pragma "always propagate line file info" instead, but IDK I didn't really gravitate towards doing that.

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok. Another alternative is --prepend-internal-module-dir.

It just seems really weird to me to have a symbol in an internal module whose entire purpose is to be used to check an assertion, and assertion thar doesn't work properly yet at that.

I think there are enough alternatives here that you should use one of those to write this test, rather than hardcoding something into the module definition

Copy link
Member

Choose a reason for hiding this comment

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

I haven't followed the issues closely enough, do line numbers work ok with the LLVM backend?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They're backend independent, not sure why this skipif is here... 🤔

@dlongnecke-cray
Copy link
Contributor Author

I think this is ready to merge, but I will hold off on that until Monday.

Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
Signed-off-by: David Longnecker <dlongnecke-cray@users.noreply.github.com>
@dlongnecke-cray dlongnecke-cray merged commit da4fe84 into chapel-lang:main Aug 11, 2025
10 checks passed
dlongnecke-cray added a commit that referenced this pull request Aug 19, 2025
Revert changes made in #27237 after #27600 changed the output once
again. A `param` branch was evaluating to `true`, and an array-view was
allocated in a module's `deinit()` code. This accounted for the extra
192 bytes. Now that code does not run (for the moment).
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.

2 participants