harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r598969 - in /harmony/enhanced/drlvm/trunk/vm/vmcore: include/environment.h include/mem_alloc.h src/class_support/Environment.cpp src/class_support/classloader.cpp src/init/vm_init.cpp
Date Wed, 28 Nov 2007 11:38:30 GMT
Author: gshimansky
Date: Wed Nov 28 03:38:26 2007
New Revision: 598969

URL: http://svn.apache.org/viewvc?rev=598969&view=rev
Log:
Applied patch from HARMONY-4914
[drlvm] increasing default sizes for code and vtable pools give a little boost


Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/mem_alloc.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h?rev=598969&r1=598968&r2=598969&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/environment.h Wed Nov 28 03:38:26 2007
@@ -46,6 +46,8 @@
     apr_pool_t*               mem_pool; // memory pool
     BootstrapClassLoader*     bootstrap_class_loader;
     UserDefinedClassLoader*   system_class_loader;
+    size_t                    bootstrap_code_pool_size;
+    size_t                    user_code_pool_size;
     DebugUtilsTI*             TI;
     GlobalNCAI*               NCAI;
     NSOTableItem*             nsoTable;
@@ -323,10 +325,6 @@
     }
 
 
-    /**
-     * Load a class via bootstrap classloader.
-     */
-
     int isVmInitializing() {
         return vm_state == VM_INITIALIZING;
     }
@@ -342,8 +340,6 @@
     /**
      * Load a class via bootstrap classloader.
      */
-
-
     Class* LoadCoreClass(const String* name);
     Class* LoadCoreClass(const char* name);
 
@@ -353,7 +349,6 @@
      * exception objects. I.e. all required classes (such as </code>java/lang/Trowable</code>)
      * are loaded.
      */
-
     void ReadyForExceptions()
     {
         ready_for_exceptions = true;
@@ -376,6 +371,8 @@
     Properties* VmProperties() {
         return m_vm_properties;
     }
+
+    void init_pools();
 
 private:
     bool bootstrapping;

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/mem_alloc.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/mem_alloc.h?rev=598969&r1=598968&r2=598969&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/mem_alloc.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/mem_alloc.h Wed Nov 28 03:38:26 2007
@@ -25,12 +25,20 @@
 #include "jit_import.h"
 #include "port_vmem.h"
 
-#define DEFAULT_COMMOT_JIT_CODE_POOL_SIZE 32*1024  // pool is used for common stub code
-#define DEFAULT_COMMOT_VTABLE_POOL_SIZE_NO_RESIZE 8*1024*1024 // used for comressed VTable
pointers
-#define DEFAULT_CLASSLOADER_VTABLE_POOL_SIZE 32*1024
-#define DEFAULT_CLASSLOADER_JIT_CODE_POOL_SIZE 64*1024
-#define DEFAULT_BOOTSTRAP_JIT_CODE_POOL_SIZE 256*1024  
-#define DEFAULT_VTABLE_POOL_SIZE   128*1024  
+#define KBYTE 1024
+#define MBYTE 1024*KBYTE
+#define GBYTE 1024*MBYTE
+
+// pool is used for common stub code
+#define DEFAULT_COMMOT_JIT_CODE_POOL_SIZE           256*KBYTE
+// used for comressed VTable pointers
+#define DEFAULT_COMMOT_VTABLE_POOL_SIZE_NO_RESIZE   8*MBYTE
+//used for uncompressed VTable pointers
+#define DEFAULT_VTABLE_POOL_SIZE                    256*KBYTE
+// used for compiled code of a user class loader
+#define DEFAULT_CLASSLOADER_JIT_CODE_POOL_SIZE      256*KBYTE
+// used for compiled code of the bootstrap class loader
+#define DEFAULT_BOOTSTRAP_JIT_CODE_POOL_SIZE        1*MBYTE
 
 #define MEMORY_UTILIZATION_LIMIT 15
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp?rev=598969&r1=598968&r2=598969&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Environment.cpp Wed Nov 28 03:38:26
2007
@@ -129,17 +129,6 @@
         system_page_size = ps[0];
     }
 
-    GlobalCodeMemoryManager = new PoolManager(DEFAULT_COMMOT_JIT_CODE_POOL_SIZE, system_page_size,
use_large_pages, 
-        true/*is_code*/, true/*is_resize_allowed*/);
-    if (vm_vtable_pointers_are_compressed()) {
-        VTableMemoryManager = new PoolManager(DEFAULT_COMMOT_VTABLE_POOL_SIZE_NO_RESIZE,
system_page_size, use_large_pages, 
-            false/*is_code*/, false/*is_resize_allowed*/);
-    }
-    else {
-        VTableMemoryManager = new PoolManager(DEFAULT_VTABLE_POOL_SIZE, system_page_size,
use_large_pages, 
-            false/*is_code*/, true/*is_resize_allowed*/);
-    }
-
     verify_all = false;
     verify_strict = false;
     verify = true;
@@ -297,3 +286,47 @@
 {
     return LoadCoreClass(this->string_pool.lookup(s));
 }
+
+static size_t parse_pool_size(const char* name, size_t default_size) {
+    if(!is_property_set(name, VM_PROPERTIES)) {
+        return default_size;
+    }
+
+    char* value = get_property(name, VM_PROPERTIES);
+    size_t size = atol(value);
+    int sizeModifier = tolower(value[strlen(value) - 1]);
+    destroy_property_value(value);
+
+    size_t modifier;
+    switch(sizeModifier) {
+        case 'k': modifier = 1024; break;
+        case 'm': modifier = 1024*1024; break;
+        default: modifier = 1; break;
+    }
+
+    return size*modifier;
+}
+
+void Global_Env::init_pools() {
+    size_t pool_size;
+
+    pool_size = parse_pool_size("vm.code_pool_size.stubs", DEFAULT_COMMOT_JIT_CODE_POOL_SIZE);
+    assert(pool_size);
+    GlobalCodeMemoryManager = new PoolManager(pool_size, system_page_size, use_large_pages,

+        true/*is_code*/, true/*is_resize_allowed*/);
+
+    bool compress_vtables = vm_vtable_pointers_are_compressed();
+    pool_size = parse_pool_size("vm.vtable_pool_size",
+        compress_vtables?DEFAULT_COMMOT_VTABLE_POOL_SIZE_NO_RESIZE:DEFAULT_VTABLE_POOL_SIZE);
+    assert(pool_size);
+    VTableMemoryManager = new PoolManager(pool_size, system_page_size, use_large_pages, 
+        false/*is_code*/, !compress_vtables/*is_resize_allowed*/);
+
+    bootstrap_code_pool_size = pool_size = parse_pool_size("vm.code_pool_size.bootstrap_loader",
+        DEFAULT_BOOTSTRAP_JIT_CODE_POOL_SIZE);
+    assert(pool_size);
+    user_code_pool_size = pool_size = parse_pool_size("vm.code_pool_size.user_loader",
+        DEFAULT_CLASSLOADER_JIT_CODE_POOL_SIZE);
+    assert(pool_size);
+}
+

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp?rev=598969&r1=598968&r2=598969&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/classloader.cpp Wed Nov 28 03:38:26
2007
@@ -85,8 +85,14 @@
     if(!m_javaTypes) return false;
 
     Global_Env *env = VM_Global_State::loader_env;
-    assert (env);
-    size_t code_pool_size = IsBootstrap() ? DEFAULT_BOOTSTRAP_JIT_CODE_POOL_SIZE : DEFAULT_CLASSLOADER_JIT_CODE_POOL_SIZE;
+    assert(env);
+
+    assert(env->bootstrap_code_pool_size);
+    assert(env->user_code_pool_size);
+    size_t code_pool_size = IsBootstrap()
+        ? env->bootstrap_code_pool_size
+        : env->user_code_pool_size;
+
     CodeMemoryManager = new PoolManager(code_pool_size, env->system_page_size, env->use_large_pages,
true/*is_code*/, true/*is_resize_allowed*/);
     if(!CodeMemoryManager) return false;
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp?rev=598969&r1=598968&r2=598969&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp Wed Nov 28 03:38:26 2007
@@ -744,6 +744,8 @@
     vm_env->sort_fields = get_boolean_property("vm.sort_fields", vm_env->sort_fields,
VM_PROPERTIES);
     vm_env->compact_fields = get_boolean_property("vm.compact_fields", vm_env->compact_fields,
VM_PROPERTIES);
 
+    vm_env->init_pools();
+
     // Check compression modes and heap size
     status = process_compression_modes(vm_env);
     if (status != JNI_OK) return status;



Mime
View raw message