-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add DOTNET_MODIFIABLE_ASSEMBLIES env var for hot reload support #48731
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -686,11 +686,6 @@ void Module::Initialize(AllocMemTracker *pamTracker, LPCWSTR szName) | |
Module::CreateAssemblyRefByNameTable(pamTracker); | ||
} | ||
|
||
// If the program has the "ForceEnc" env variable set we ensure every eligible | ||
// module has EnC turned on. | ||
if (g_pConfig->ForceEnc() && IsEditAndContinueCapable()) | ||
EnableEditAndContinue(); | ||
|
||
#if defined(PROFILING_SUPPORTED) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE) | ||
m_pJitInlinerTrackingMap = NULL; | ||
if (ReJitManager::IsReJITInlineTrackingEnabled()) | ||
|
@@ -1078,17 +1073,13 @@ void Module::SetDebuggerInfoBits(DebuggerAssemblyControlFlags newBits) | |
m_dwTransientFlags |= (newBits << DEBUGGER_INFO_SHIFT_PRIV); | ||
|
||
#ifdef DEBUGGING_SUPPORTED | ||
BOOL setEnC = ((newBits & DACF_ENC_ENABLED) != 0) && IsEditAndContinueCapable(); | ||
|
||
// The only way can change Enc is through debugger override. | ||
if (setEnC) | ||
if (IsEditAndContinueCapable()) | ||
{ | ||
EnableEditAndContinue(); | ||
} | ||
else | ||
{ | ||
if (!g_pConfig->ForceEnc()) | ||
DisableEditAndContinue(); | ||
BOOL setEnC = (newBits & DACF_ENC_ENABLED) != 0 || g_pConfig->ForceEnc() || (g_pConfig->DebugAssembliesModifiable() && CORDisableJITOptimizations(GetDebuggerInfoBits())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that It suggests that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assumed up to this point that when the ForceEnc env var was set all release and debug built binaries are ENC'able (except system, dynamic, resource and ready to run). If what you implied above that DACF_ALLOW_JIT_OPTS is already set when the Module or ENC module is created, then yes |
||
if (setEnC) | ||
{ | ||
EnableEditAndContinue(); | ||
} | ||
} | ||
#endif // DEBUGGING_SUPPORTED | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code depends on
IsEditAndContinueCapable
to be invariant, but it may actually change because of it depends onGetDebuggerInfoBits
that the debugger can change. There is commented out assert inBOOL IsEditAndContinueEnabled()
that suggest it may actually happen in some cases. I think that this can interact poorly with this change, depending on how the debugger decides to change the bits.I think we should:
Module::Create
BOOL IsEditAndContinueCapable()
to virtual method that returns false inclass Module
and returns true inclass EditAndContinueModule
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, enable the assert in
IsEditAndContinueEnabled
and change it to justreturn ((m_dwTransientFlags & IS_EDIT_AND_CONTINUE) != 0);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that after Module::Create the DACF_ALLOW_JIT_OPTS in the Assembly will not change? What about the debugger API (via DacDbiInterfaceImpl::SetCompilerFlags)? Isn't the module already created by then? It is clear to me and it is confusing because Assembly, DomainAssembly and Module all have flags.
To double check what you are saying about IsEditAndContinueCapable():
Module::Create() doesn't need any changes because it already creates an
EditAndContinueModule
instance ifIsEditAndContinueCapable(pAssembly, file)
returns true.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it is confusing and hard to reason about.
Correct.