mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 19:14:38 +02:00
8032970: Add stack size check methods to WhiteBox API
Reviewed-by: twisti, kvn, iignatyev
This commit is contained in:
parent
71d4460883
commit
20674a667a
4 changed files with 138 additions and 1 deletions
|
@ -33,9 +33,11 @@
|
|||
#include "prims/whitebox.hpp"
|
||||
#include "prims/wbtestmethods/parserTests.hpp"
|
||||
|
||||
#include "runtime/thread.hpp"
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "runtime/interfaceSupport.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
|
||||
#include "utilities/debug.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
#include "utilities/exceptions.hpp"
|
||||
|
@ -576,6 +578,15 @@ WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jbo
|
|||
WB_END
|
||||
|
||||
|
||||
WB_ENTRY(jlong, WB_GetThreadStackSize(JNIEnv* env, jobject o))
|
||||
return (jlong) Thread::current()->stack_size();
|
||||
WB_END
|
||||
|
||||
WB_ENTRY(jlong, WB_GetThreadRemainingStackSize(JNIEnv* env, jobject o))
|
||||
JavaThread* t = JavaThread::current();
|
||||
return (jlong) t->stack_available(os::current_stack_pointer()) - (jlong) StackShadowPages * os::vm_page_size();
|
||||
WB_END
|
||||
|
||||
//Some convenience methods to deal with objects from java
|
||||
int WhiteBox::offset_for_field(const char* field_name, oop object,
|
||||
Symbol* signature_symbol) {
|
||||
|
@ -690,6 +701,8 @@ static JNINativeMethod methods[] = {
|
|||
{CC"getCPUFeatures", CC"()Ljava/lang/String;", (void*)&WB_GetCPUFeatures },
|
||||
{CC"getNMethod", CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
|
||||
(void*)&WB_GetNMethod },
|
||||
{CC"getThreadStackSize", CC"()J", (void*)&WB_GetThreadStackSize },
|
||||
{CC"getThreadRemainingStackSize", CC"()J", (void*)&WB_GetThreadRemainingStackSize },
|
||||
};
|
||||
|
||||
#undef CC
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue