-
Notifications
You must be signed in to change notification settings - Fork 152
Conversation
@@ -303,9 +303,10 @@ void GenIR::readerPrePass(uint8_t *Buffer, uint32_t NumBytes) { | |||
ABIMethodSignature(MethodSignature, *this, *JitContext->TheABIInfo); | |||
Function = ABIMethodSig.createFunction(*this, *JitContext->CurrentModule); | |||
|
|||
EntryBlock = BasicBlock::Create(*JitContext->LLVMContext, "entry", Function); | |||
llvm::LLVMContext *LLVMContext = JitContext->LLVMContext; |
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.
Nit: this could be LLVMContext &LLVMContext = *JitContext->LLVMContext
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.
Changed.
LGTM modulo two nits. |
@@ -367,9 +368,26 @@ void GenIR::readerPrePass(uint8_t *Buffer, uint32_t NumBytes) { | |||
// Check for special cases where the Jit needs to do extra work. | |||
const uint32_t MethodFlags = getCurrentMethodAttribs(); | |||
|
|||
// TODO: support for synchronized methods | |||
// Check for syncronized method. If a method is syncronized the JIT is |
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.
typo (2x): synchronized
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.
Fixed.
Ditto, LGTM with just a few other nits. |
} else { | ||
HelperId = IsEnter ? CORINFO_HELP_MON_ENTER : CORINFO_HELP_MON_EXIT; | ||
} | ||
callHelperImpl(HelperId, Type::getVoidTy(*JitContext->LLVMContext), |
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.
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.
Sounds good. I'll merge once CI build is done.
These calls are guaranteed not to throw and the monitor object is guaranteed not to be null.
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.
These calls are guaranteed not to throw and the monitor object is guaranteed not to be null.
Is this true for an arbitrary mscorlib?
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.
What does arbitrary mean in this context? Is this possibly a non-CoreCLR/modern surface mscorlib? (we do not support desktop)
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.
These are calls to jit helpers, they don't call into mscorlib.
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.
Yeah, I just looked. Disregard my comment.
Add calls to MONITOR_ENTER on entry to the method and MONITOR_EXIT on returns. We can't catch exceptions yet; when we can we will need to add a try/fault for the entire method so that we can call MONITOR_EXIT on unhandled exceptions. We have a synchronized method in HelloWorld (System.IO.TextWriter+SyncTextWriter.WriteLine). I verified that the generated IR looks correct. I also tested with a simple two-thread race that the behavior of synchronized instance and static methods is as expected.
3b4dc4e
to
ac30783
Compare
Support for synchronized methods.
Add calls to MONITOR_ENTER on entry to the method and MONITOR_EXIT on returns.
We can't catch exceptions yet; when we can we will need to add a try/fault for the entire method
so that we can call MONITOR_EXIT on unhandled exceptions.
We have a synchronized method in HelloWorld (System.IO.TextWriter+SyncTextWriter.WriteLine).
I verified that the generated IR looks correct. I also tested with a simple two-thread race that the
behavior of synchronized instance and static methods is as expected.