Skip to content
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.

Commit

Permalink
Address code review feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
erozenfeld committed Apr 17, 2015
1 parent 2dc5993 commit 3b4dc4e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/Reader/readerir.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ class GenIR : public ReaderBase {
};

void rethrow() override { throw NotYetImplementedException("rethrow"); };
void returnOpcode(IRNode *Opr, bool SynchronizedMethod) override;
void returnOpcode(IRNode *Opr, bool IsSynchronizedMethod) override;
IRNode *shift(ReaderBaseNS::ShiftOpcode Opcode, IRNode *ShiftAmount,
IRNode *ShiftOperand) override;
IRNode *sizeofOpcode(CORINFO_RESOLVED_TOKEN *ResolvedToken) override;
Expand Down
15 changes: 8 additions & 7 deletions lib/Reader/readerir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,10 @@ void GenIR::readerPrePass(uint8_t *Buffer, uint32_t NumBytes) {
ABIMethodSignature(MethodSignature, *this, *JitContext->TheABIInfo);
Function = ABIMethodSig.createFunction(*this, *JitContext->CurrentModule);

llvm::LLVMContext *LLVMContext = JitContext->LLVMContext;
EntryBlock = BasicBlock::Create(*LLVMContext, "entry", Function);
llvm::LLVMContext &LLVMContext = *JitContext->LLVMContext;
EntryBlock = BasicBlock::Create(LLVMContext, "entry", Function);

LLVMBuilder = new IRBuilder<>(*LLVMContext);
LLVMBuilder = new IRBuilder<>(LLVMContext);
LLVMBuilder->SetInsertPoint(EntryBlock);

// Note numArgs may exceed the IL argument count when there
Expand Down Expand Up @@ -368,7 +368,7 @@ 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();

// Check for syncronized method. If a method is syncronized the JIT is
// Check for synchronized method. If a method is synchronized the JIT is
// required to insert a helper call to MONITOR_ENTER before we start the user
// code. A similar call to MONITOR_EXIT will be placed at the return site.
// TODO: when we start catching exceptions we should create a try/fault for
Expand All @@ -377,7 +377,7 @@ void GenIR::readerPrePass(uint8_t *Buffer, uint32_t NumBytes) {
SyncFlag = nullptr;
if (MethodFlags & CORINFO_FLG_SYNCH) {
MethodSyncHandle = rdrGetCritSect();
Type *SyncFlagType = Type::getInt8Ty(*LLVMContext);
Type *SyncFlagType = Type::getInt8Ty(LLVMContext);

// Create address taken local SyncFlag. This will be passed by address to
// MONITOR_ENTER and MONITOR_EXIT. MONITOR_ENTER will set SyncFlag once lock
Expand Down Expand Up @@ -4272,8 +4272,9 @@ void GenIR::returnOpcode(IRNode *Opr, bool IsSynchronizedMethod) {
const CallArgType &ResultArgType = MethodSignature.getResultType();
CorInfoType ResultCorType = ResultArgType.CorType;
Value *ResultValue = nullptr;
bool IsVoidReturn = ResultCorType == CORINFO_TYPE_VOID;

if (ResultCorType == CORINFO_TYPE_VOID) {
if (IsVoidReturn) {
assert(Opr == nullptr);
assert(ResultInfo.getType()->isVoidTy());
} else {
Expand Down Expand Up @@ -4311,7 +4312,7 @@ void GenIR::returnOpcode(IRNode *Opr, bool IsSynchronizedMethod) {
callMonitorHelper(IsEnter);
}

if (ResultCorType == CORINFO_TYPE_VOID) {
if (IsVoidReturn) {
LLVMBuilder->CreateRetVoid();
} else {
LLVMBuilder->CreateRet(ResultValue);
Expand Down

0 comments on commit 3b4dc4e

Please sign in to comment.