Remove uses of unsafeNulls from the JVM backend#26094
Open
SolalPirelli wants to merge 1 commit into
Open
Conversation
7773e17 to
d3f9744
Compare
SolalPirelli
commented
May 19, 2026
| case asm.Type.LONG => LONG | ||
| case asm.Type.FLOAT => FLOAT | ||
| case asm.Type.DOUBLE => DOUBLE | ||
| case _ => null |
Contributor
Author
There was a problem hiding this comment.
turns out this case was hit right below, so I refactored this to not need to have nullness
SolalPirelli
commented
May 19, 2026
| var cnode: ClassNode1 = null | ||
| var thisName: String = null // the internal name of the class being emitted | ||
| private var cnode: ClassNode1 = uninitialized | ||
| private var thisName: String = uninitialized // the internal name of the class being emitted |
Contributor
Author
There was a problem hiding this comment.
unfortunately given the code shape removing the need for uninitialized would require a fair amount of work. But at least we can make those private so nobody accidentally observes them when they shouldn't.
SolalPirelli
commented
May 19, 2026
| TraceUtils.traceMethodIfRequested(mnode) | ||
|
|
||
| mnode = null | ||
| mnode = null.asInstanceOf[MethodNode1] // for GC |
Contributor
Author
There was a problem hiding this comment.
(I'm assuming)
SolalPirelli
commented
May 19, 2026
| @@ -88,22 +82,23 @@ private[jvm] object GeneratedClassHandler { | |||
| private val processingUnits = ListBuffer.empty[CompilationUnitInPostProcess] | |||
|
|
|||
| def process(unit: GeneratedCompilationUnit): Unit = { | |||
Contributor
Author
There was a problem hiding this comment.
this class had the only use of uninitialized outside of the BCode* stuff and it looked easy to remove so... bonus cleanup
d3f9744 to
58a1c8a
Compare
58a1c8a to
c186a23
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No more unsafeNulls in the entire compiler!
How much have you relied on LLM-based tools in this contribution?
Not at all
How was the solution tested?
Covered by existing tests (this is a refactoring)