harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r494838 - /harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp
Date Wed, 10 Jan 2007 15:04:09 GMT
Author: gshimansky
Date: Wed Jan 10 07:04:08 2007
New Revision: 494838

URL: http://svn.apache.org/viewvc?view=rev&rev=494838
Log:
Applied HARMONY-2916 [drlvm][interpreter] Use vm stack limit instead of harcoded value

Tests passed on Ubuntu6 x86, Windows 2003 Server x86 and SuSE9 x86_64


Modified:
    harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp

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=494838&r1=494837&r2=494838
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/interpreter/src/interpreter.cpp Wed Jan 10 07:04:08 2007
@@ -2522,6 +2522,7 @@
     uint8 ip0 = 0;
     bool breakpoint_processed = false;
     int stackLength = 0;
+    size_t available;
     
     DEBUG_TRACE_PLAIN("interpreter: "
             << class_get_name(method_get_class(frame.method))
@@ -2536,14 +2537,18 @@
          goto got_exception;
     }
     assert(!hythread_is_suspend_enabled());
+
+
+
+    available = get_available_stack_size();
     
-    first = (uint8*) get_thread_ptr()->firstFrame;
-    stackLength = ((uint8*)first) - ((uint8*)&frame);
-    if (stackLength > 500000) { // FIXME: hardcoded stack limit
-        if (!(get_thread_ptr()->interpreter_state & INTERP_STATE_STACK_OVERFLOW))
{
-            get_thread_ptr()->interpreter_state |= INTERP_STATE_STACK_OVERFLOW;
+    if (available < 100000) {
+        int &state = get_thread_ptr()->interpreter_state;
+
+        if (!(state & INTERP_STATE_STACK_OVERFLOW)) {
+            state |= INTERP_STATE_STACK_OVERFLOW;
             interp_throw_exception("java/lang/StackOverflowError");
-            get_thread_ptr()->interpreter_state &= ~INTERP_STATE_STACK_OVERFLOW;
+            state &= ~INTERP_STATE_STACK_OVERFLOW;
 
             if (frame.framePopListener)
                 frame_pop_callback(frame.framePopListener, frame.method, true);



Mime
View raw message