File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -3943,9 +3943,16 @@ export function compileAbort(
3943
3943
var abortInstance = program . abortInstance ;
3944
3944
if ( ! ( abortInstance && compiler . compileFunction ( abortInstance ) ) ) return module . unreachable ( ) ;
3945
3945
3946
- var messageArg = message != null
3947
- ? compiler . compileExpression ( message , stringInstance . type , ContextualFlags . IMPLICIT )
3948
- : stringInstance . type . toNativeZero ( module ) ;
3946
+ var messageArg : ExpressionRef ;
3947
+ if ( message !== null ) {
3948
+ // The message argument works much like an arm of an IF that does not become executed if the
3949
+ // assertion succeeds respectively is only being computed if the program actually crashes.
3950
+ // Hence, let's make it so that the autorelease is skipped at the end of the current block,
3951
+ // essentially ignoring the message GC-wise. Doesn't matter anyway on a crash.
3952
+ messageArg = compiler . compileExpression ( message , stringInstance . type , ContextualFlags . IMPLICIT | ContextualFlags . SKIP_AUTORELEASE ) ;
3953
+ } else {
3954
+ messageArg = stringInstance . type . toNativeZero ( module ) ;
3955
+ }
3949
3956
3950
3957
var filenameArg = compiler . ensureStaticString ( reportNode . range . source . normalizedPath ) ;
3951
3958
You can’t perform that action at this time.
0 commit comments