Skip to content

Conversation

@Keno
Copy link
Member

@Keno Keno commented Feb 21, 2023

This fixes an intermittent segfault in the Diffractor tests. I tried for a while to come up with a more minimal test case, but failed to do so, because it very closely depends on the order of events, but essentially what happens is that a GlobalVariable gets stored into mergedConstants, but then deleted in jl_merge_module when the opaque closure module is merged into its parent.

@Keno
Copy link
Member Author

Keno commented Feb 21, 2023

Managed to get a testcase after all.

Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

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

Why is there a jl_merge_module call? I think there is a lot more state sometimes destroyed than just this, so I would just say there should not be a merge-modules call, and fallback to the workqueue as designed.

@Keno
Copy link
Member Author

Keno commented Feb 21, 2023

Yeah, the design could probably be improved. I just wanted to fix the segfault for now.

@Keno
Copy link
Member Author

Keno commented Feb 23, 2023

Shall we merge this anyway and we can revisit the design in the future? It's be good to fix the immediate segfaults.

This fixes an intermittent segfault in the Diffractor test.
The error very closely depends on the order of events,
but essentially what happens is that a
GlobalVariable gets stored into mergedConstants, but then
deleted in jl_merge_module when the opaque closure module
is merged into its parent. A test case is included, but it
is quite specific to current codegen, so it'll probably stop
being useful the next time we restructure things. It's also
intermittent (though would show up under valgrind/asan).
Hopefully, it'll nevertheless be useful.
@oscardssmith
Copy link
Member

oscardssmith commented Jul 17, 2023

Does this need to be merged?

@oscardssmith oscardssmith added bugfix This change fixes an existing bug compiler:codegen Generation of LLVM IR and native code labels Jul 17, 2023
@oscardssmith oscardssmith requested a review from vtjnash July 17, 2023 20:08
@vtjnash
Copy link
Member

vtjnash commented Jul 17, 2023

Seems a rather heavy solution to a problem that should not exist. We made codegen non-recursive to avoid issues like this.

@vtjnash
Copy link
Member

vtjnash commented Aug 31, 2023

#50724

@vtjnash vtjnash closed this Aug 31, 2023
@vtjnash vtjnash deleted the kf/mconsts branch August 31, 2023 01:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This change fixes an existing bug compiler:codegen Generation of LLVM IR and native code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants