harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r549552 - in /harmony/enhanced/drlvm/trunk/vm: interpreter/src/ jitrino/src/codegenerator/ia32/ port/include/ port/src/lil/em64t/pim/ port/src/lil/ia32/pim/ port/src/lil/ipf/pim/ vmcore/include/ vmcore/src/class_support/ vmcore/src/exceptio...
Date Thu, 21 Jun 2007 17:12:55 GMT
Author: gshimansky
Date: Thu Jun 21 10:12:53 2007
New Revision: 549552

URL: http://svn.apache.org/viewvc?view=rev&rev=549552
Log:
Applied HARMONY-1859
[drlvm][util] StackOverflowError handling leads to Segmentation fault on Linux with -Xem:opt
and jet and is handled incorrectly with -Xint on both Win and Linux


Modified:
    harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32StackInfo.cpp
    harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h
    harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp
    harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp
    harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions_jit.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/String_Pool.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_em64t.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ipf.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32_em64t/nt_exception_filter_common.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/exception_filter.h

Modified: harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp Thu Jun 21 10:12:53 2007
@@ -2595,7 +2595,6 @@
         if (!(state & INTERP_STATE_STACK_OVERFLOW)) {
             state |= INTERP_STATE_STACK_OVERFLOW;
             interp_throw_exception("java/lang/StackOverflowError");
-            state &= ~INTERP_STATE_STACK_OVERFLOW;
 
             if (frame.framePopListener)
                 frame_pop_callback(frame.framePopListener, frame.method, true);
@@ -3090,6 +3089,12 @@
             frame.stack.pick().cr = COMPRESS_REF(frame.exc);
             frame.stack.ref() = FLAG_OBJECT;
             frame.exc = NULL;
+            
+            int &state = get_thread_ptr()->interpreter_state;
+
+            if (state & INTERP_STATE_STACK_OVERFLOW) {
+                state &= ~INTERP_STATE_STACK_OVERFLOW;
+            }
             continue;
         }
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32StackInfo.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32StackInfo.cpp?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32StackInfo.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32StackInfo.cpp Thu Jun
21 10:12:53 2007
@@ -188,7 +188,11 @@
         if (entry && (entry->info.callSize == i)) {
             stackDepth = entry->info.stackDepth;
         } else {
-            stackDepth = frameSize;
+            if (((POINTER_SIZE_INT)pMethodDesc->getCodeBlockAddress(0)) == eip) {
+                stackDepth = 0;
+            } else {
+                stackDepth = frameSize;
+            }
         }
 
         if (Log::cat_rt()->isEnabled())

Modified: harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/include/stack_iterator.h Thu Jun 21 10:12:53 2007
@@ -144,6 +144,15 @@
 void si_goto_previous(StackIterator* si, bool over_popped = true);
 
 /**
+ * Gets the pointer to the top of the stack.
+ *
+ * @param[in] si -  the pointer to the stack iterator indicating stack
+ *
+ * @return The pointer to the top of the stack.
+ */
+void* si_get_sp(StackIterator* si);
+
+/**
  * Gets the instruction pointer for the current frame.
  *
  * @param[in] si -  the pointer to the stack iterator indicating the current frame

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/lil/em64t/pim/stack_iterator_em64t.cpp Thu Jun
21 10:12:53 2007
@@ -403,6 +403,10 @@
     STD_FREE(si);
 }
 
+void* si_get_sp(StackIterator* si) {
+    return (void*)si->jit_frame_context.rsp;
+}
+
 NativeCodePtr si_get_ip(StackIterator * si) {
     ASSERT_NO_INTERPRETER
     return (NativeCodePtr)(*si->jit_frame_context.p_rip);

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/lil/ia32/pim/stack_iterator_ia32.cpp Thu Jun
21 10:12:53 2007
@@ -349,6 +349,10 @@
     STD_FREE(si);
 }
 
+void* si_get_sp(StackIterator* si) {
+    return (void*)si->c.esp;
+}
+
 NativeCodePtr si_get_ip(StackIterator* si)
 {
     ASSERT_NO_INTERPRETER

Modified: harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/port/src/lil/ipf/pim/stack_iterator_ipf.cpp Thu Jun 21
10:12:53 2007
@@ -560,6 +560,10 @@
     STD_FREE(si);
 }
 
+void* si_get_sp(StackIterator* si) {
+    return (void*)si->c.sp;
+}
+
 NativeCodePtr si_get_ip(StackIterator* si)
 {
     return (NativeCodePtr)*si->c.p_eip;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions.h?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions.h Thu Jun 21 10:12:53 2007
@@ -269,17 +269,15 @@
 void exn_rethrow();
 void exn_rethrow_if_pending();
 
-#ifndef _EM64T_
 void set_guard_stack();
-#endif
 void init_stack_info();
 #ifndef WIN32
 void remove_guard_stack();
 #endif
 VMEXPORT size_t get_available_stack_size();
-#ifndef _EM64T_
 VMEXPORT bool check_available_stack_size(size_t required_size);
-#endif
 VMEXPORT size_t get_default_stack_size();
+VMEXPORT size_t get_restore_stack_size();
+bool check_stack_size_enough_for_exception_catch(void* sp);
 
 #endif // _EXCEPTIONS_H_

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions_jit.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions_jit.h?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions_jit.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions_jit.h Thu Jun 21 10:12:53 2007
@@ -94,6 +94,7 @@
 Class_Handle exn_get_class_cast_exception_type();
 
 // Exception catch callback for jvm ti support implementation
+extern "C" void asm_exception_catch_callback();
 extern "C" void asm_jvmti_exception_catch_callback();
 
 #endif // _EXCEPTIONS_JIT_H_

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/String_Pool.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/String_Pool.cpp?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/String_Pool.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/String_Pool.cpp Thu Jun 21 10:12:53
2007
@@ -330,6 +330,11 @@
     if (!lang_string) { // if OutOfMemory
         return NULL;
     }
+
+    if (exn_raised()) { //if RuntimeException or Error
+        return NULL;
+    }
+
     string->object = lang_string;
     assert(!hythread_is_suspend_enabled());
 
@@ -339,7 +344,10 @@
     assert(env->VM_intern);
     vm_execute_java_method_array((jmethodID)env->VM_intern,
         (jvalue*)&string, args);
-    assert(!exn_raised());
+
+    if (exn_raised()) { //if RuntimeException or Error
+        return NULL;
+    }
     assert(string);
     assert(string->object);
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_impl.cpp Thu Jun 21 10:12:53
2007
@@ -246,6 +246,10 @@
     exc_object->object = man_obj;
     args[0].l = exc_object;
 
+    if (exn_raised()) { //if RuntimeException or Error
+        return NULL;
+    }
+
     vm_execute_java_method_array((jmethodID) exc_init, 0, args);
 
     if (suspended_enabled) {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/exception/exceptions_jit.cpp Thu Jun 21 10:12:53
2007
@@ -166,6 +166,7 @@
     return result;
 }   //create_object_lazily
 
+
 //////////////////////////////////////////////////////////////////////////
 // Main Exception Propogation Function
 
@@ -206,6 +207,7 @@
     Method *interrupted_method;
     NativeCodePtr interrupted_method_location;
     JIT *interrupted_method_jit;
+    bool restore_guard_page = p_TLS_vmthread->restore_guard_page;
 
     if (!si_is_native(si))
     {
@@ -302,6 +304,13 @@
                         }
                     }
 #endif // VM_STATS
+
+                    if (restore_guard_page) {
+                        if (!check_stack_size_enough_for_exception_catch(si_get_sp(si)))
{
+                            break;
+                        }
+                    }
+
                     // Setup handler context
                     jit->fix_handler_context(method, si_get_jit_context(si));
                     si_set_ip(si, handler->get_handler_ip(), false);
@@ -472,6 +481,10 @@
         NativeCodePtr callback = (NativeCodePtr)
                 asm_jvmti_exception_catch_callback;
         si_set_callback(si, &callback);
+    } else if (p_TLS_vmthread->restore_guard_page) {
+        NativeCodePtr callback = (NativeCodePtr)
+                asm_exception_catch_callback;
+        si_set_callback(si, &callback);
     }
 
     // don't put any call here
@@ -530,18 +543,14 @@
 // exception catch callback to restore stack after Stack Overflow Error
 void exception_catch_callback() {
     if (p_TLS_vmthread->restore_guard_page) {
-#ifndef _EM64T_
         set_guard_stack();
-#endif
     }
 }
 
 // exception catch support for JVMTI, also restore stack after Stack Overflow Error
 void jvmti_exception_catch_callback(Registers* regs) {
     if (p_TLS_vmthread->restore_guard_page) {
-#ifndef _EM64T_
         set_guard_stack();
-#endif
     }
 
     M2nFrame *m2nf = m2n_push_suspended_frame(regs);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_em64t.cpp?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_em64t.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_em64t.cpp Thu Jun 21 10:12:53
2007
@@ -104,8 +104,48 @@
     uc->uc_mcontext.gregs[REG_RSP] = regs->rsp;
 }
 
+// exception catch support for stack restore
+extern "C" {
+    static void __attribute__ ((used)) exception_catch_callback_wrapper(){
+        exception_catch_callback();
+    }
+}
+
+void asm_exception_catch_callback() {
+    asm (
+        "pushq %%rax;\n"
+        "pushq %%rbx;\n"
+        "pushq %%rcx;\n"
+        "pushq %%rdx;\n"
+        "pushq %%rsi;\n"
+        "pushq %%rdi;\n"
+        "pushq %%r8;\n"
+        "pushq %%r9;\n"
+        "pushq %%r10;\n"
+        "pushq %%r11;\n"
+        "call exception_catch_callback_wrapper;\n"
+        "popq %%r11;\n"
+        "popq %%r10;\n"
+        "popq %%r9;\n"
+        "popq %%r8;\n"
+        "popq %%rdi;\n"
+        "popq %%rsi;\n"
+        "popq %%rdx;\n"
+        "popq %%rcx;\n"
+        "popq %%rbx;\n"
+        "popq %%rax;\n"
+        : /* no output operands */
+        : /* no input operands */
+    );
+}
+
+// exception catch support for JVMTI
 void asm_jvmti_exception_catch_callback() {
+    // FIXME: not implemented
+    fprintf(stderr, "FIXME: asm_jvmti_exception_catch_callback: not implemented\n");
     assert(0);
+    abort();
+
 }
 static void throw_from_sigcontext(ucontext_t *uc, Class* exc_clss)
 {
@@ -284,7 +324,7 @@
     size_t used_stack_size = stack_adrr - ((char*)&stack_adrr);
     size_t available_stack_size =
             get_stack_size() - used_stack_size
-            - get_guard_page_size() - get_guard_stack_size();
+            - 2 * get_guard_page_size() - get_guard_stack_size();
     return available_stack_size;
 }
 
@@ -296,6 +336,19 @@
     } else {
         return true;
     }
+}
+
+size_t get_restore_stack_size() {
+    return 0x8000;
+}
+
+bool check_stack_size_enough_for_exception_catch(void* sp) {
+    char* stack_adrr = (char*) get_stack_addr();
+    size_t used_stack_size = ((size_t)stack_adrr) - ((size_t)sp);
+    size_t available_stack_size =
+            get_stack_size() - used_stack_size
+            - 2 * get_guard_page_size() - get_guard_stack_size();
+    return get_restore_stack_size() < available_stack_size;
 }
 
 void remove_guard_stack() {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ia32.cpp Thu Jun 21 10:12:53
2007
@@ -106,6 +106,29 @@
     uc->uc_mcontext.gregs[REG_EFL] = regs->eflags;
 }
 
+// exception catch support for stack restore
+extern "C" {
+    static void __attribute__ ((used, cdecl)) exception_catch_callback_wrapper(){
+        exception_catch_callback();
+    }
+}
+
+void __attribute__ ((cdecl)) asm_exception_catch_callback() {
+    asm (
+        "pushl %%eax;\n"
+        "pushl %%ebx;\n"
+        "pushl %%ecx;\n"
+        "pushl %%edx;\n"
+        "call exception_catch_callback_wrapper;\n"
+        "popl %%edx;\n"
+        "popl %%ecx;\n"
+        "popl %%ebx;\n"
+        "popl %%eax;\n"
+        : /* no output operands */
+        : /* no input operands */
+    );
+}
+
 // exception catch support for JVMTI
 extern "C" {
     static void __attribute__ ((used, cdecl)) jvmti_exception_catch_callback_wrapper(Registers
regs){
@@ -390,7 +413,7 @@
     size_t used_stack_size = stack_adrr - ((char*)&stack_adrr);
     size_t available_stack_size =
             get_stack_size() - used_stack_size
-            - get_guard_page_size() - get_guard_stack_size();
+            - 2 * get_guard_page_size() - get_guard_stack_size();
     return available_stack_size;
 }
 size_t get_default_stack_size() {
@@ -405,6 +428,19 @@
     } else {
         return true;
     }
+}
+
+size_t get_restore_stack_size() {
+    return 0x8000;
+}
+
+bool check_stack_size_enough_for_exception_catch(void* sp) {
+    char* stack_adrr = (char*) get_stack_addr();
+    size_t used_stack_size = ((size_t)stack_adrr) - ((size_t)sp);
+    size_t available_stack_size =
+            get_stack_size() - used_stack_size
+            - 2 * get_guard_page_size() - get_guard_stack_size();
+    return get_restore_stack_size() < available_stack_size;
 }
 
 void remove_guard_stack() {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ipf.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ipf.cpp?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ipf.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/linux/signals_ipf.cpp Thu Jun 21 10:12:53
2007
@@ -104,6 +104,13 @@
 }
 
 
+void asm_exception_catch_callback() {
+    // FIXME: not implemented
+    fprintf(stderr, "FIXME: asm_jvmti_exception_catch_callback: not implemented\n");
+    assert(0);
+    abort();
+}
+
 void asm_jvmti_exception_catch_callback() {
     // FIXME: not implemented
     fprintf(stderr, "FIXME: asm_jvmti_exception_catch_callback: not implemented\n");
@@ -301,7 +308,7 @@
     size_t used_stack_size = stack_adrr - ((char*)&stack_adrr);
     size_t available_stack_size =
             get_stack_size() - used_stack_size
-            - get_guard_page_size() - get_guard_stack_size();
+            - 2 * get_guard_page_size() - get_guard_stack_size();
     return available_stack_size;
 }
 
@@ -318,6 +325,20 @@
         return true;
     }
 }
+
+size_t get_restore_stack_size() {
+    return 0x8000;
+}
+
+bool check_stack_size_enough_for_exception_catch(void* sp) {
+    char* stack_adrr = (char*) get_stack_addr();
+    size_t used_stack_size = ((size_t)stack_adrr) - ((size_t)sp);
+    size_t available_stack_size =
+            get_stack_size() - used_stack_size
+            - 2 * get_guard_page_size() - get_guard_stack_size();
+    return get_restore_stack_size() < available_stack_size;
+}
+
 
 void remove_guard_stack() {
     int err;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32_em64t/nt_exception_filter_common.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32_em64t/nt_exception_filter_common.cpp?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32_em64t/nt_exception_filter_common.cpp
(original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/ia32_em64t/nt_exception_filter_common.cpp
Thu Jun 21 10:12:53 2007
@@ -179,7 +179,7 @@
     size_t used_stack_size = ((size_t)stack_adrr) - ((size_t)(&stack_adrr));
     size_t available_stack_size =
             get_stack_size() - used_stack_size
-            - get_guard_page_size() - get_guard_stack_size();
+            - 2 * get_guard_page_size() - get_guard_stack_size();
     return available_stack_size;
 }
 size_t get_default_stack_size() {
@@ -195,6 +195,20 @@
         return true;
     }
 }
+
+size_t get_restore_stack_size() {
+    return 0x8000;
+}
+
+bool check_stack_size_enough_for_exception_catch(void* sp) {
+    char* stack_adrr = (char*) get_stack_addr();
+    size_t used_stack_size = ((size_t)stack_adrr) - ((size_t)sp);
+    size_t available_stack_size =
+            get_stack_size() - used_stack_size
+            - 2 * get_guard_page_size() - get_guard_stack_size();
+    return get_restore_stack_size() < available_stack_size;
+}
+
 
 // exception catch callback to restore stack after Stack Overflow Error
 void __cdecl exception_catch_callback_wrapper(){

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/exception_filter.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/exception_filter.h?view=diff&rev=549552&r1=549551&r2=549552
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/exception_filter.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/win/include/exception_filter.h Thu Jun
21 10:12:53 2007
@@ -45,7 +45,7 @@
 // exception catch support for JVMTI
  void __cdecl jvmti_exception_catch_callback_wrapper();
 // Assembler wrappers; are used to restore registers
-void asm_exception_catch_callback();
+//void asm_exception_catch_callback(); // Declared in exceptions_jit.h
 //void asm_jvmti_exception_catch_callback(); // Declared in exceptions_jit.h
 
 #ifdef __cplusplus



Mime
View raw message