--- old/src/share/vm/prims/whitebox.cpp 2014-05-21 17:09:14.890211752 +0400 +++ new/src/share/vm/prims/whitebox.cpp 2014-05-21 17:09:14.766211757 +0400 @@ -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_END +WB_ENTRY(jlong, WB_GetThreadFullStackSize(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 @@ {CC"getCPUFeatures", CC"()Ljava/lang/String;", (void*)&WB_GetCPUFeatures }, {CC"getNMethod", CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;", (void*)&WB_GetNMethod }, + {CC"getThreadFullStackSize", CC"()J", (void*)&WB_GetThreadFullStackSize }, + {CC"getThreadRemainingStackSize", CC"()J", (void*)&WB_GetThreadRemainingStackSize }, }; #undef CC