Skip to content

Commit

Permalink
Only disable optmizations of -optimize is false. Not when any symbols…
Browse files Browse the repository at this point in the history
… are emitted.
  • Loading branch information
wasabii committed Dec 12, 2024
1 parent 0389c9a commit a2cc374
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/IKVM.Tools.Importer/ImportClassLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,12 @@ internal ModuleBuilder CreateModuleBuilder()
if (EmitStackTraceInfo)
Context.AttributeHelper.SetSourceFile(moduleBuilder, null);

// if configured to emit debug info or stack trace info, add debug DebuggableAttribute
if (EmitSymbols || EmitStackTraceInfo)
{
var debugModes = DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints;
if (EmitSymbols)
debugModes |= DebuggableAttribute.DebuggingModes.DisableOptimizations;

Context.AttributeHelper.SetDebuggingModes(assemblyBuilder, debugModes);
}
// latest roslyn emits ignore symbol store always, but only disables optimizations if specified through args
var debugModes = DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints;
if (EnableOptimizations == false)
debugModes |= DebuggableAttribute.DebuggingModes.DisableOptimizations;

Context.AttributeHelper.SetDebuggingModes(assemblyBuilder, debugModes);
Context.AttributeHelper.SetRuntimeCompatibilityAttribute(assemblyBuilder);

if (state.baseAddress != 0)
Expand Down

0 comments on commit a2cc374

Please sign in to comment.