Skip to content

Commit afde232

Browse files
committed
check results of FlushInstructionCache
1 parent 21bf50f commit afde232

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

lib/Backend/EmitBuffer.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,10 @@ bool EmitBufferManager<TAlloc, TPreReservedAlloc, SyncObject>::CommitBufferForIn
409409
return false;
410410
}
411411

412-
FlushInstructionCache(this->processHandle, pBuffer, bufferSize);
412+
if (!FlushInstructionCache(this->processHandle, pBuffer, bufferSize))
413+
{
414+
return false;
415+
}
413416

414417
return true;
415418
}
@@ -515,7 +518,11 @@ EmitBufferManager<TAlloc, TPreReservedAlloc, SyncObject>::CommitBuffer(TEmitBuff
515518
}
516519
}
517520

518-
FlushInstructionCache(this->processHandle, bufferToFlush, sizeToFlush);
521+
if (!FlushInstructionCache(this->processHandle, bufferToFlush, sizeToFlush))
522+
{
523+
return false;
524+
}
525+
519526
#if DBG_DUMP
520527
this->totalBytesCode += bytes;
521528
#endif

lib/Backend/JITThunkEmitter.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,10 @@ JITThunkEmitter<TAlloc>::CreateThunk(uintptr_t entryPoint)
119119
this->firstBitToCheck = (thunkIndex + 1 < JITThunkEmitter<TAlloc>::TotalThunkCount) ? thunkIndex + 1 : 0;
120120
this->freeThunks.Clear(thunkIndex);
121121

122-
FlushInstructionCache(this->processHandle, (PVOID)thunkAddress, ThunkSize);
122+
if (!FlushInstructionCache(this->processHandle, (PVOID)thunkAddress, ThunkSize))
123+
{
124+
return NULL;
125+
}
123126

124127
return thunkAddress;
125128
}

lib/JITServer/JITServer.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,11 @@ ServerNewInterpreterThunkBlock(
533533
&thunkCount
534534
);
535535

536-
emitBufferManager->CommitBufferForInterpreter(alloc, runtimeAddress, InterpreterThunkEmitter::BlockSize);
536+
if (!emitBufferManager->CommitBufferForInterpreter(alloc, runtimeAddress, InterpreterThunkEmitter::BlockSize))
537+
{
538+
Js::Throw::OutOfMemory();
539+
}
540+
537541
// Call to set VALID flag for CFG check
538542
if (CONFIG_FLAG(OOPCFGRegistration))
539543
{

0 commit comments

Comments
 (0)