mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 17:44:40 +02:00
8259486: Replace PreserveExceptionMark with implementation for CautiouslyPreserveExceptionMark
Reviewed-by: dholmes, sspitsyn
This commit is contained in:
parent
ce94512087
commit
535f2da5e2
14 changed files with 51 additions and 100 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -26,7 +26,6 @@
|
|||
#define SHARE_UTILITIES_PRESERVEEXCEPTION_HPP
|
||||
|
||||
#include "runtime/handles.hpp"
|
||||
#include "runtime/thread.hpp"
|
||||
|
||||
// This file provides more support for exception handling; see also exceptions.hpp
|
||||
class PreserveExceptionMark {
|
||||
|
@ -37,27 +36,11 @@ class PreserveExceptionMark {
|
|||
const char* _preserved_exception_file;
|
||||
|
||||
public:
|
||||
PreserveExceptionMark(Thread*& thread);
|
||||
PreserveExceptionMark(Thread* thread);
|
||||
~PreserveExceptionMark();
|
||||
};
|
||||
|
||||
|
||||
// This is a clone of PreserveExceptionMark which asserts instead
|
||||
// of failing when what it wraps generates a pending exception.
|
||||
// It also addresses bug 6431341.
|
||||
class CautiouslyPreserveExceptionMark {
|
||||
private:
|
||||
Thread* _thread;
|
||||
Handle _preserved_exception_oop;
|
||||
int _preserved_exception_line;
|
||||
const char* _preserved_exception_file;
|
||||
|
||||
public:
|
||||
CautiouslyPreserveExceptionMark(Thread* thread);
|
||||
~CautiouslyPreserveExceptionMark();
|
||||
};
|
||||
|
||||
|
||||
// Like PreserveExceptionMark but allows new exceptions to be generated in
|
||||
// the body of the mark. If a new exception is generated then the original one
|
||||
// is discarded.
|
||||
|
@ -72,8 +55,8 @@ private:
|
|||
void restore();
|
||||
|
||||
public:
|
||||
WeakPreserveExceptionMark(Thread* pThread) : _thread(pThread), _preserved_exception_oop() {
|
||||
if (pThread->has_pending_exception()) {
|
||||
WeakPreserveExceptionMark(Thread* thread) : _thread(thread) {
|
||||
if (thread->has_pending_exception()) {
|
||||
preserve();
|
||||
}
|
||||
}
|
||||
|
@ -84,10 +67,4 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// use global exception mark when allowing pending exception to be set and
|
||||
// saving and restoring them
|
||||
#define PRESERVE_EXCEPTION_MARK Thread* THREAD; PreserveExceptionMark __em(THREAD);
|
||||
|
||||
#endif // SHARE_UTILITIES_PRESERVEEXCEPTION_HPP
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue