harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wjwashb...@apache.org
Subject svn commit: r545832 - in /harmony/enhanced/drlvm/trunk/vm: include/open/ thread/src/ thread/src/linux/ thread/src/win/ vmcore/include/ vmcore/src/class_support/ vmcore/src/init/ vmcore/src/thread/ vmcore/src/util/linux/ vmcore/src/util/win/ia32_em64t/
Date Sun, 10 Jun 2007 02:56:02 GMT
Author: wjwashburn
Date: Sat Jun  9 19:56:01 2007
New Revision: 545832

URL: http://svn.apache.org/viewvc?view=rev&rev=545832
Log:
Harmony-4001, this patch provides the ability to set the size of a thread's
stack
"build test2" has been known to pass on most platforms


Modified:
    harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h
    harmony/enhanced/drlvm/trunk/vm/include/open/vm.h
    harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def
    harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.exp
    harmony/enhanced/drlvm/trunk/vm/thread/src/linux/os_thread.c
    harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_basic.c
    harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c
    harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h
    harmony/enhanced/drlvm/trunk/vm/thread/src/win/os_thread.c
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/properties.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_threads.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.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

Modified: harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/open/hythread_ext.h Sat Jun  9 19:56:01 2007
@@ -206,6 +206,7 @@
 UDATA VMCALL hythread_tls_get_offset(hythread_tls_key_t key);
 UDATA VMCALL hythread_tls_get_request_offset();
 UDATA VMCALL hythread_get_thread_times(hythread_t thread, int64* pkernel, int64* puser);
+UDATA hythread_get_thread_stacksize(hythread_t thread);
 UDATA VMCALL hythread_uses_fast_tls(void);
 IDATA VMCALL hythread_get_hythread_offset_in_tls(void);
 
@@ -308,6 +309,9 @@
 
 void VMCALL hythread_native_resource_is_live(U_32);
 void VMCALL hythread_reclaim_resources();
+
+IDATA VMCALL hythread_monitor_interrupt_wait(hythread_monitor_t mon_ptr,
+					     hythread_t thread);
 
 IDATA VMCALL hythread_monitor_interrupt_wait(hythread_monitor_t mon_ptr,
 					     hythread_t thread);

Modified: harmony/enhanced/drlvm/trunk/vm/include/open/vm.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/open/vm.h?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/open/vm.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/open/vm.h Sat Jun  9 19:56:01 2007
@@ -23,7 +23,11 @@
 #ifndef _VM_EXPORT_H
 #define _VM_EXPORT_H
 
-
+#ifdef WIN32
+#include <stddef.h>
+#else
+#include <unistd.h>
+#endif
 
 
 
@@ -1084,6 +1088,13 @@
  * returns <code>default_value</code>.
  */
 VMEXPORT int get_int_property(const char *property_name, int default_value, PropertyTable
table_number);
+
+/**
+ * Tries to interpret property value as <code>int</code> and returns it. In case
of failure 
+ * returns <code>default_value</code>.
+ */
+VMEXPORT size_t get_size_property(const char *property_name, size_t default_value, PropertyTable
table_number);
+
 
 //Tries to interpret property value as int and returns it. In case of failure returns default_value.
 // Numbers can include 'm' or 'M' for megabytes, 'k' or 'K' for kilobytes, and 'g' or 'G'
for gigabytes (for example, 32k is the same as 32768).

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.def Sat Jun  9 19:56:01 2007
@@ -52,6 +52,7 @@
 hythread_get_id
 hythread_get_thread
 hythread_get_thread_times
+hythread_get_thread_stacksize
 hythread_struct_init
 hythread_cancel_all
 hythread_group_create
@@ -88,6 +89,9 @@
 hythread_thin_monitor_get_owner
 hythread_native_resource_is_live
 hythread_reclaim_resources
+
+
+
 
 hysem_post
 hysem_wait

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.exp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.exp?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.exp (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/hythr.exp Sat Jun  9 19:56:01 2007
@@ -35,6 +35,7 @@
 hythread_resume;
 hythread_monitor_notify;
 hythread_get_priority;
+hythread_get_thread_stacksize;
 hythread_tls_get;
 hythread_tls_get_request_offset;
 hythread_get_hythread_offset_in_tls;

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/linux/os_thread.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/linux/os_thread.c?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/linux/os_thread.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/linux/os_thread.c Sat Jun  9 19:56:01 2007
@@ -223,3 +223,21 @@
     *puser = tp.tv_sec * 1000000000ULL + tp.tv_nsec;
     return 0;
 }
+
+UDATA os_get_foreign_thread_stack_size() {
+    int err;
+    void* stack_addr;
+    pthread_attr_t pthread_attr;
+    size_t stack_size;
+
+    static UDATA common_stack_size = -1;
+
+    if (common_stack_size == -1) {
+	    pthread_attr_init(&pthread_attr);
+	    err = pthread_attr_getstacksize(&pthread_attr, &common_stack_size);
+	    pthread_attr_destroy(&pthread_attr);
+    }
+
+    return common_stack_size;
+
+}

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_basic.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_basic.c?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_basic.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_java_basic.c Sat Jun  9 19:56:01 2007
@@ -24,6 +24,7 @@
 #include <open/hythread_ext.h>
 #include <apr_atomic.h>
 #include "open/thread_externals.h"
+#include "open/vm.h"
 
 #undef LOG_DOMAIN
 #define LOG_DOMAIN "tm.java"
@@ -32,6 +33,7 @@
 #include "jni.h"
 
 
+
 void stop_callback(void);
 jmethodID getRunMethod(JNIEnv *env, jthread java_thread);
 IDATA increase_nondaemon_threads_count(hythread_t self);
@@ -132,6 +134,7 @@
     hythread_t tm_native_thread = NULL;
     jvmti_thread_t tm_java_thread;
     void *vm_thread_dummies;
+    static int default_stacksize = -1;
     
     wrapper_proc_data * data;
     IDATA status;
@@ -170,6 +173,13 @@
 	return TM_ERROR_OUT_OF_MEMORY;
     }
 
+    if (default_stacksize == -1) {
+      int ss = get_size_property("thread.stacksize", 0, VM_PROPERTIES);
+      default_stacksize = ss ? ss : HY_DEFAULT_STACKSIZE;
+    }
+
+
+
     // prepare args for wrapper_proc
     data->daemon = attrs->daemon;
     data->tiEnv  = attrs->jvmti_env;
@@ -177,7 +187,7 @@
     data->tiProcArgs = (void *)arg;
     data->vm_thread_dummies = vm_thread_dummies;
 
-    status = hythread_create(&tm_native_thread, (attrs->stacksize)?attrs->stacksize:1024000,
+    status = hythread_create(&tm_native_thread, (attrs->stacksize)?attrs->stacksize:default_stacksize,
                                attrs->priority, 0, wrapper_proc, data);
 
     TRACE(("TM: Created thread: id=%d", tm_native_thread->thread_id));

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_native_basic.c Sat Jun  9 19:56:01 2007
@@ -114,6 +114,7 @@
 
     new_thread->library = hythread_self()->library;
     new_thread->priority = priority ? priority : HYTHREAD_PRIORITY_NORMAL;
+    new_thread->stacksize = stacksize ? stacksize : HY_DEFAULT_STACKSIZE;
     //new_thread->suspend_request = suspend ? 1 : 0;
     
     start_proc_data =
@@ -132,7 +133,7 @@
     // we need to make sure thread will not register itself with a thread group
     // until os_thread_create returned and initialized thread->os_handle properly
     hythread_global_lock();
-    r = os_thread_create(&new_thread->os_handle, stacksize,
+    r = os_thread_create(&new_thread->os_handle, new_thread->stacksize,
             priority, thread_start_proc, (void *)start_proc_data);
     assert(/* error */ r || new_thread->os_handle /* or thread created ok */);
     hythread_global_unlock();
@@ -625,6 +626,8 @@
 
     ptr->os_handle  = (osthread_t)NULL;
     ptr->priority   = HYTHREAD_PRIORITY_NORMAL;
+    ptr->stacksize  = os_get_foreign_thread_stack_size();
+    ptr->name       = strdup("NONAME");
     // not implemented
     //ptr->big_thread_local_storage = (void **)calloc(1, sizeof(void*)*tm_tls_capacity);
     
@@ -751,4 +754,9 @@
  */
 UDATA hythread_get_thread_times(hythread_t thread, int64* pkernel, int64* puser) {
     return os_get_thread_times(thread->os_handle, pkernel, puser);
+}
+
+
+UDATA hythread_get_thread_stacksize(hythread_t thread) {
+    return thread->stacksize;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/thread_private.h Sat Jun  9 19:56:01 2007
@@ -55,6 +55,9 @@
 
 #define INITIAL_FAT_TABLE_ENTRIES 16*1024   //make this table exapandible if workloads show
it is necessary
 
+#define HY_DEFAULT_STACKSIZE 512 * 1024 // if default stack size is not through -Xss parameter,
it is 256kb
+
+
 #if !defined (_IPF_)
 //use lock reservation
 #define LOCK_RESERVATION
@@ -285,6 +288,12 @@
     */
     IDATA priority;    
 
+    /**
+     * Size of thread's stack, set on creation
+     */
+
+    UDATA stacksize;
+
 // Monitors
     
     /**
@@ -671,6 +680,7 @@
 int os_get_thread_times(osthread_t os_thread, int64* pkernel, int64* puser);
 
 int os_cond_timedwait(hycond_t *cond, hymutex_t *mutex, I_64 ms, IDATA nano);
+UDATA os_get_foreign_thread_stack_size();
 
 #ifdef __cplusplus
 }

Modified: harmony/enhanced/drlvm/trunk/vm/thread/src/win/os_thread.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/thread/src/win/os_thread.c?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/thread/src/win/os_thread.c (original)
+++ harmony/enhanced/drlvm/trunk/vm/thread/src/win/os_thread.c Sat Jun  9 19:56:01 2007
@@ -16,7 +16,7 @@
  */
 
 #include <apr_atomic.h>
-
+#
 #include "thread_private.h"
 
 /**
@@ -34,7 +34,8 @@
 int os_thread_create(/* out */osthread_t* phandle, UDATA stacksize, UDATA priority,
         int (VMAPICALL *func)(void*), void *data)
 {
-    HANDLE handle = (HANDLE)_beginthreadex(NULL, stacksize, (unsigned(__stdcall *)(void*))func,
data, 0, NULL);
+    HANDLE handle = (HANDLE)_beginthreadex(NULL, stacksize, (unsigned(__stdcall *)(void*))func,
data, STACK_SIZE_PARAM_IS_A_RESERVATION, NULL);
+
     if (handle) {
         *phandle = handle;
         if (priority)
@@ -186,4 +187,18 @@
         return 0;
     } else
         return GetLastError();
+}
+
+UDATA os_get_foreign_thread_stack_size() {
+    void* stack_addr;
+    size_t stack_size;
+    size_t reg_size;
+    MEMORY_BASIC_INFORMATION memory_information;
+
+    VirtualQuery(&memory_information, &memory_information, sizeof(memory_information));
+    reg_size = memory_information.RegionSize;
+    stack_addr = ((char*) memory_information.BaseAddress) + reg_size;
+    stack_size = ((char*) stack_addr) - ((char*) memory_information.AllocationBase);
+
+    return (UDATA)stack_size;
 }

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=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/exceptions.h Sat Jun  9 19:56:01 2007
@@ -273,6 +273,9 @@
 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);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/properties.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/properties.h?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/properties.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/properties.h Sat Jun  9 19:56:01 2007
@@ -45,4 +45,6 @@
     apr_thread_rwlock_t* rwlock_array;
 };
 
+
 #endif // _VM_PROPERTIES_H
+

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_threads.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_threads.h?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_threads.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/vm_threads.h Sat Jun  9 19:56:01 2007
@@ -112,6 +112,9 @@
     // thread stack address
     void* stack_addr;
 
+    // thread stack size
+    unsigned int stack_size;
+
     // Should JVMTI code be notified about exception in p_exception_object
     bool                              ti_exception_callback_pending;
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp Sat Jun  9 19:56:01
2007
@@ -2884,6 +2884,37 @@
     return return_value;
 }
 
+size_t get_size_property(const char *property_name, size_t default_value, PropertyTable table_number)

+{
+  char* size_string; 
+  size_t size; 
+  int sizeModifier;
+  size_t unit = 1;
+
+  size_string = get_property(property_name, table_number);
+
+  if (size_string == NULL) {
+    return default_value;
+  }
+
+  size = atol(size_string);
+  sizeModifier = tolower(size_string[strlen(size_string) - 1]);
+  destroy_property_value(size_string);
+
+  switch (sizeModifier) {
+  case 'k': unit = 1024; break;
+  case 'm': unit = 1024 * 1024; break;
+  case 'g': unit = 1024 * 1024 * 1024;break;
+  }
+
+  size_t res = size * unit;
+  if (res / unit != size) {
+    /* overflow happened */
+    return 0;
+  }
+  return res;
+}
+
 
 static Annotation* lookup_annotation(AnnotationTable* table, Class* owner, Class* antn_type)
{
     for (int i = table->length - 1; i >= 0; --i) {

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties Sat Jun  9 19:56:01
2007
@@ -37,7 +37,7 @@
 ECHO019=WARNING: max heap size is too large, reduced to {0} Mb
 ECHO020=WARNING: min heap size reduced to {0} Mb
 ECHO021=Usage: {0} [-options] class [args...]\n        (to execute a method main() of the
class)\n    or {0} [-options] -jar jarfile [args...]\n        (to execute the jar file)\n\nwhere
options include:\n    -classpath <class search path of directories and zip/jar files>\n
   -cp        <class search path of directories and zip/jar files>\n               
  A '{1}' separated list of directories, jar archives,\n                  and zip archives
to search for class file\n    -D<name>=<value>\n                  set a system
property\n    -showversion  print product version and continue\n    -version      print product
version and exit\n    -verbose[:class|:gc|:jni]\n                  enable verbose output\n
   -agentlib:<library name>[=<agent options>]\n                  load JVMTI agent
library, library name is platform independent\n    -agentpath:<library name>[=<agent
options]\n                  load JVMTI agent library, library name is platform dependent\n
   -verify\n   
                do full bytecode verification\n    -noverify\n                  do no bytecode
verification\n    -enableassertions[:<package>...|:<class>]\n    -ea[:<package>...|:<class>]\n
                 enable assertions\n    -disableassertions[:<package>...|:<class>]\n
   -da[:<package>...|:<class>]\n                  disable assertions\n    -esa
| -enablesystemassertions\n                  enable system assertions\n    -dsa | -disablesystemassertions\n
                 disable system assertions\n    -? -help      print this help message\n  
 -help properties\n                  help on system properties\n    -X            print help
on non-standard options
-ECHO022=\    -Xbootclasspath:<PATH>\n              Set bootclasspath to the specified
value\n    -Xbootclasspath/a:<PATH>\n              Append specified directories and
files to bootclasspath\n    -Xbootclasspath/p:<PATH>\n              Prepend specified
directories and files to bootclasspath\n    -Xjit <JIT options>\n              Specify
JIT specific options\n    -Xms<size>\n              Set Java heap size\n    -Xmx<size>\n
             Set maximum Java heap size\n    -Xdebug\n              Does nothing, this is
a compatibility option\n    -Xnoagent\n              Does nothing, this is a compatibility
option\n    -Xrun\n              Specify debugger agent library\n    -Xverbose[:<category>[:<file>]\n
             Switch logging on [for specified category only\n              [and log that category
to a file]]\n    -Xwarn[:<category>[:<file>]\n              Switch verbose logging
off [for specified category only\n              [and log that category to a file]]\n    -Xver
 boseconf:<file>\n              Set up logging via log4cxx configuration file\n    -Xverboselog:<file>\n
             Log verbose output to a file\n    -Xverify[:none|all]\n              Do full
bytecode verification\n    -Xinvisible\n              Retain invisible annotations at runtime\n
   -Xfileline\n              Add source information to logging messages\n    -Xthread\n  
           Add thread id to logging messages\n    -Xcategory\n              Add category name
to logging messages\n    -Xtimestamp\n              Add timestamp to logging messages\n  
 -Xfunction\n              Add function signature to logging messages
+ECHO022=\    -Xbootclasspath:<PATH>\n              Set bootclasspath to the specified
value\n    -Xbootclasspath/a:<PATH>\n              Append specified directories and
files to bootclasspath\n    -Xbootclasspath/p:<PATH>\n              Prepend specified
directories and files to bootclasspath\n    -Xjit <JIT options>\n              Specify
JIT specific options\n    -Xms<size>\n              Set Java heap size\n    -Xmx<size>\n
             Set maximum Java heap size\n    -Xss<size>\n              Set initial stack
size\n    -Xdebug\n              Does nothing, this is a compatibility option\n    -Xnoagent\n
             Does nothing, this is a compatibility option\n    -Xrun\n              Specify
debugger agent library\n    -Xverbose[:<category>[:<file>]\n              Switch
logging on [for specified category only\n              [and log that category to a file]]\n
   -Xwarn[:<category>[:<file>]\n              Switch verbose logging off [for
specified category only\n     
          [and log that category to a file]]\n    -Xverboseconf:<file>\n           
  Set up logging via log4cxx configuration file\n    -Xverboselog:<file>\n         
    Log verbose output to a file\n    -Xverify[:none|all]\n              Do full bytecode
verification\n    -Xinvisible\n              Retain invisible annotations at runtime\n   
-Xfileline\n              Add source information to logging messages\n    -Xthread\n     
        Add thread id to logging messages\n    -Xcategory\n              Add category name
to logging messages\n    -Xtimestamp\n              Add timestamp to logging messages\n  
 -Xfunction\n              Add function signature to logging messages
 ECHO023=\    -Xlog[:<category>[:<file>]\n              Switch debug logging on
[for specified category only\n              [and log that category to a file]]\n    -Xtrace[:<category>[:<file>]\n
             Switch trace logging on [for specified category only\n              [and log
that category to a file]]
 ECHO024=\    -Xstats:<mask>\n              Generates different statistics
 ECHO025=\    -Xint\n              Use interpreter to execute the program\n    -Xgc:<gc
options>\n              Specify gc specific options\n    -Xem:<em options>\n    
         Specify em specific options\n    -Xdumpstubs\n              Writes stubs generated
by LIL to disk\n    -Xparallel_jit\n              Launch compilation in parallel (default)\n
   -Xno_parallel_jit\n              Do not launch compilation in parallel\n    -Xdumpfile:<file>\n
             Specifies a file name for the dump\n    -XX:<name>=<value>\n    
         set an internal system property

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/parse_arguments.cpp Sat Jun  9 19:56:01
2007
@@ -441,7 +441,14 @@
                 LECHO(34, "Negative or invalid heap size. Default value will be used!");
             }
             p_env->VmProperties()->set("gc.mx", arg);
-        }
+        } else if (begins_with(option, "-Xss")) {
+            const char* arg = option + 4;
+            TRACE2("init", "thread.stacksize = " << arg);
+            if (atoi(arg) == 0) {
+                LECHO(34, "Negative or invalid stack size. Default value will be used!");
+            }
+            p_env->VmProperties()->set("thread.stacksize", arg);
+	}	  
         else if (begins_with(option, "-agentlib:")) {
             p_env->TI->addAgent(option);
         }

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp?view=diff&rev=545832&r1=545831&r2=545832
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_generic.cpp Sat Jun  9 19:56:01
2007
@@ -291,6 +291,12 @@
     // Notify GC about thread detaching.
     gc_thread_kill(&p_vm_thread->_gc_private_information);
     assert(p_vm_thread->gc_frames == 0);
+
+#ifdef PLATFORM_POSIX
+    // Remove guard page on the stack on linux
+    remove_guard_stack();
+#endif
+
     // Remove current VM_thread from TLS.
     set_TLS_data(NULL);
     // Destroy current VM_thread structure.

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=545832&r1=545831&r2=545832
==============================================================================
--- 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 Sat Jun  9 19:56:01
2007
@@ -197,9 +197,11 @@
     err = pthread_attr_getstack(&pthread_attr, &stack_addr, &stack_size);
     assert(!err);
     pthread_attr_destroy(&pthread_attr);
+
     return (void *)((unsigned char *)stack_addr + stack_size);
 }
 
+#if 0
 inline size_t find_stack_size() {
     int err;
     size_t stack_size;
@@ -210,6 +212,7 @@
     pthread_attr_destroy(&pthread_attr);
     return stack_size;
 }
+#endif
 
 inline size_t find_guard_stack_size() {
     return 64*1024;
@@ -226,7 +229,6 @@
     return guard_size;
 }
 
-static size_t common_stack_size;
 static size_t common_guard_stack_size;
 static size_t common_guard_page_size;
 
@@ -235,7 +237,7 @@
 }
 
 inline size_t get_stack_size() {
-    return common_stack_size;
+  return p_TLS_vmthread->stack_size;
 }
 
 inline size_t get_guard_stack_size() {
@@ -250,7 +252,7 @@
 
 void init_stack_info() {
     p_TLS_vmthread->stack_addr = find_stack_addr();
-    common_stack_size = find_stack_size();
+    p_TLS_vmthread->stack_size = hythread_get_thread_stacksize(hythread_self());
     common_guard_stack_size = find_guard_stack_size();
     common_guard_page_size =find_guard_page_size();
 

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=545832&r1=545831&r2=545832
==============================================================================
--- 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 Sat Jun  9 19:56:01
2007
@@ -252,9 +252,11 @@
     err = pthread_attr_getstack(&pthread_attr, &stack_addr, &stack_size);
     assert(!err);
     pthread_attr_destroy(&pthread_attr);
+    
     return (void *)((unsigned char *)stack_addr + stack_size);
 }
 
+#if 0
 inline size_t find_stack_size() {
     int err;
     size_t stack_size;
@@ -265,6 +267,7 @@
     pthread_attr_destroy(&pthread_attr);
     return stack_size;
 }
+#endif
 
 inline size_t find_guard_stack_size() {
     return 64*1024;
@@ -283,7 +286,6 @@
     return guard_size;
 }
 
-static size_t common_stack_size;
 static size_t common_guard_stack_size;
 static size_t common_guard_page_size;
 
@@ -292,7 +294,7 @@
 }
 
 inline size_t get_stack_size() {
-    return common_stack_size;
+    return p_TLS_vmthread->stack_size;
 }
 
 inline size_t get_guard_stack_size() {
@@ -316,13 +318,20 @@
     // fins stack parametrs
     char* stack_addr = (char *)find_stack_addr();
     p_TLS_vmthread->stack_addr = stack_addr;
-    common_stack_size = find_stack_size();
+    unsigned int stack_size = hythread_get_thread_stacksize(hythread_self());
+    
+    assert(stack_size > 0);
+    
+    p_TLS_vmthread->stack_size = stack_size;
+
+    
     common_guard_stack_size = find_guard_stack_size();
     common_guard_page_size =find_guard_page_size();
 
     // stack should be mapped so it's result of future mapping
     char* res;
 
+
     // begin of the stack can be protected by OS, but this part already mapped
     // found address of current stack page
     char* current_page_addr =
@@ -336,18 +345,17 @@
 
     // found size of the stack area which should be maped
     size_t stack_mapping_size = (size_t)mapping_page_addr
-            - (size_t)stack_addr + common_stack_size;
+            - (size_t)stack_addr + stack_size;
 
     // maps unmapped part of the stack
-    res = (char*) mmap(stack_addr - common_stack_size,
+    res = (char*) mmap(stack_addr - stack_size,
             stack_mapping_size,
             PROT_READ | PROT_WRITE,
             MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS | MAP_GROWSDOWN,
             -1,
             0);
-
     // stack should be mapped, checks result
-    assert(res == (stack_addr - common_stack_size));
+    assert(res == (stack_addr - stack_size));
 
     // set guard page
     set_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=545832&r1=545831&r2=545832
==============================================================================
--- 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 Sat Jun  9 19:56:01
2007
@@ -196,6 +196,7 @@
     return (void *)((unsigned char *)stack_addr + stack_size);
 }
 
+#if 0
 inline size_t find_stack_size() {
     int err;
     size_t stack_size;
@@ -206,6 +207,7 @@
     pthread_attr_destroy(&pthread_attr);
     return stack_size;
 }
+#endif
 
 inline size_t find_guard_stack_size() {
     return 64*1024;
@@ -223,7 +225,6 @@
     return guard_size;
 }
 
-static size_t common_stack_size;
 static size_t common_guard_stack_size;
 static size_t common_guard_page_size;
 
@@ -232,7 +233,7 @@
 }
 
 inline size_t get_stack_size() {
-    return common_stack_size;
+    return p_TLS_vmthread->stack_size;
 }
 
 inline size_t get_guard_stack_size() {
@@ -246,9 +247,9 @@
 
 void init_stack_info() {
     p_TLS_vmthread->stack_addr = find_stack_addr();
-    common_stack_size = find_stack_size();
+    p_TLS_vmthread->stack_size = hythread_get_thread_stacksize(hythread_self());
     common_guard_stack_size = find_guard_stack_size();
-    common_guard_page_size =find_guard_page_size();
+    common_guard_page_size = find_guard_page_size();
 
     /* FIXME: doesn't work, BTW, move this code to common file for all linuxes
      *        to avoid code duplication

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=545832&r1=545831&r2=545832
==============================================================================
--- 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
Sat Jun  9 19:56:01 2007
@@ -26,6 +26,7 @@
 #include "stack_dump.h"
 #include "jvmti_break_intf.h"
 #include "m2n.h"
+#include "open/hythread_ext.h"
 
 // Windows specific
 #include <string>
@@ -109,20 +110,6 @@
     return stack_addr;
 }
 
-inline size_t find_stack_size() {
-   void* stack_addr;
-    size_t stack_size;
-    size_t reg_size;
-    MEMORY_BASIC_INFORMATION memory_information;
-
-    VirtualQuery(&memory_information, &memory_information, sizeof(memory_information));
-    reg_size = memory_information.RegionSize;
-    stack_addr = ((char*) memory_information.BaseAddress) + reg_size;
-    stack_size = ((char*) stack_addr) - ((char*) memory_information.AllocationBase);
-
-    return stack_size;
-}
-
 inline size_t find_guard_page_size() {
     size_t  guard_size;
     SYSTEM_INFO system_info;
@@ -138,7 +125,6 @@
     return find_guard_page_size();
 }
 
-static size_t common_stack_size;
 static size_t common_guard_stack_size;
 static size_t common_guard_page_size;
 
@@ -147,7 +133,7 @@
 }
 
 inline size_t get_stack_size() {
-    return common_stack_size;
+  return p_TLS_vmthread->stack_size;
 }
 
 inline size_t get_guard_stack_size() {
@@ -161,9 +147,9 @@
 
 void init_stack_info() {
     p_TLS_vmthread->stack_addr = find_stack_addr();
-    common_stack_size = find_stack_size();
+    p_TLS_vmthread->stack_size = hythread_get_thread_stacksize(hythread_self());
     common_guard_stack_size = find_guard_stack_size();
-    common_guard_page_size =find_guard_page_size();
+    common_guard_page_size = find_guard_page_size();
 }
 
 void set_guard_stack() {



Mime
View raw message