[K/N] Small refactoring (review fixes)

This commit is contained in:
Elena Lepilkina
2021-10-25 12:43:10 +03:00
committed by Space
parent 778bbaf5b0
commit 48e3df5224
9 changed files with 16 additions and 16 deletions
@@ -45,13 +45,11 @@ void ThrowException(KRef exception) {
#endif
}
void HandleCurrentExceptionForCInterop() {
void HandleCurrentExceptionWhenLeavingKotlinCode() {
try {
std::rethrow_exception(std::current_exception());
} catch (ExceptionObjHolder& e) {
std::terminate(); // Terminate when it's a kotlin exception.
} catch (...) {
throw; // Just rethrow if it's unknown.
}
}
@@ -28,7 +28,7 @@ void ThrowException(KRef exception);
void SetKonanTerminateHandler();
void HandleCurrentExceptionForCInterop();
void HandleCurrentExceptionWhenLeavingKotlinCode();
RUNTIME_NOTHROW OBJ_GETTER(Kotlin_getExceptionObject, void* holder);
@@ -18,7 +18,6 @@
#define RUNTIME_MEMORY_H
#include <utility>
#include <functional>
#include "KAssert.h"
#include "Common.h"
@@ -1080,7 +1080,7 @@ JobKind Worker::processQueueElement(bool blocking) {
#if !KONAN_NO_EXCEPTIONS
FrameOverlay* currentFrame = getCurrentFrame();
#else
RuntimeFail("Exceptions aren't supported!\n");
#error "Exceptions aren't supported!"
#endif
try {
#if KONAN_OBJC_INTEROP
@@ -45,6 +45,6 @@ FrameOverlay* mm::ShadowStack::getCurrentFrame() noexcept {
return currentFrame_;
}
void mm::ShadowStack::checkCurrentFrame(FrameOverlay* frame) noexcept {
ALWAYS_INLINE void mm::ShadowStack::checkCurrentFrame(FrameOverlay* frame) noexcept {
RuntimeAssert(currentFrame_ == frame, "Frame is expected to be %p, but current frame is %p", frame, currentFrame_);
}
@@ -55,7 +55,7 @@ public:
void LeaveFrame(ObjHeader** start, int parameters, int count) noexcept;
void SetCurrentFrame(ObjHeader** start) noexcept;
FrameOverlay* getCurrentFrame() noexcept;
void checkCurrentFrame(FrameOverlay* frame) noexcept;
ALWAYS_INLINE void checkCurrentFrame(FrameOverlay* frame) noexcept;
Iterator begin() noexcept { return Iterator(currentFrame_); }
Iterator end() noexcept { return Iterator(nullptr); }