harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r594180 - in /harmony/enhanced/drlvm/trunk/vm/vmcore/src/init: harmony.properties vm_init.cpp vm_properties.cpp
Date Mon, 12 Nov 2007 15:22:51 GMT
Author: gshimansky
Date: Mon Nov 12 07:22:51 2007
New Revision: 594180

URL: http://svn.apache.org/viewvc?rev=594180&view=rev
Log:
Applied patch from HARMONY-5045
[drlvm][init] Automatic switch to uncompressed mode for large heap


Modified:
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp

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?rev=594180&r1=594179&r2=594180&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/harmony.properties Mon Nov 12 07:22:51
2007
@@ -153,3 +153,4 @@
 WARN042=Fatal error
 WARN043=Fatal exception, terminating
 WARN044={0} internal property is undefined
+WARN045=ERROR: Heap size is too large for precompiled compressed mode.

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=594180&r1=594179&r2=594180&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 Mon Nov 12 07:22:51 2007
@@ -179,6 +179,44 @@
 }
 
 /**
+ * Check compression modes and adjust if needed
+ */
+static jint process_compression_modes(Global_Env * vm_env)
+{
+#if !defined(POINTER64) || defined(REFS_USE_UNCOMPRESSED)
+        return JNI_OK;
+#else
+
+    if (!vm_env->VmProperties()->is_set("gc.ms") &&
+        !vm_env->VmProperties()->is_set("gc.mx"))
+    { // Heap size is not specified, use default compressed mode
+        return JNI_OK;
+    }
+
+    int64 ms = get_numerical_property("gc.ms", 0, VM_PROPERTIES);
+    int64 mx = get_numerical_property("gc.mx", 0, VM_PROPERTIES);
+    // Currently 4Gb is maximum for compressed mode
+    // If GC cannot allocate heap up to 4Gb, gc_init() will fail
+    int64 max_size = ((int64)4096)*1024*1024;
+
+#ifdef REFS_USE_COMPRESSED
+    if (ms >= max_size || mx >= max_size)
+    { // Heap is too large for compressed mode
+        LWARN(45, "ERROR: Heap size is too large for precompiled compressed mode.");
+        return JNI_ERR;
+    }
+#elif defined(REFS_USE_RUNTIME_SWITCH)
+    if (ms >= max_size || mx >= max_size)
+    { // Large heap; use uncompressed references
+        set_property("vm.compress_references", "false", VM_PROPERTIES);
+        vm_env->compress_references = false;
+        return JNI_OK;
+    }
+#endif // REFS_USE_RUNTIME_SWITCH
+#endif // !defined(POINTER64) || defined(REFS_USE_UNCOMPRESSED)
+}
+
+/**
  * Checks whether current platform is supported or not.
  */
 static jint check_platform() {
@@ -695,10 +733,14 @@
     parse_vm_arguments(vm_env);
 
     vm_env->verify = get_boolean_property("vm.use_verifier", TRUE, VM_PROPERTIES);
-#if defined(POINTER64) && defined(REFS_USE_RUNTIME_SWITCH)
+#ifdef REFS_USE_RUNTIME_SWITCH
     vm_env->compress_references = get_boolean_property("vm.compress_references", TRUE,
VM_PROPERTIES);
 #endif
 
+    // Check compression modes and heap size
+    status = process_compression_modes(vm_env);
+    if (status != JNI_OK) return status;
+
     // "Tool Interface" enabling.
     vm_env->TI->setExecutionMode(vm_env);
 
@@ -739,6 +781,10 @@
     // vm_references_are_compressed returns current VM state, not potential
     // ability to support compressed mode
     // So, this check is turned off for now and it is FIXME
+    // 20071109 process_compression_modes() now automatically selects compression
+    // mode depending on heap size requested. If compressed mode is selected,
+    // check_compression() should check if other components support this mode,
+    // and either fail or switch to uncompressed mode
     //status = check_compression();
     //if (status != JNI_OK) return status;
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp?rev=594180&r1=594179&r2=594180&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp Mon Nov 12 07:22:51
2007
@@ -305,7 +305,7 @@
         properties.set_new("gc.dll", PORT_DSO_NAME(GC_DLL));
         properties.set_new("thread.soft_unreservation", "false");
 
-#ifdef POINTER64
+#ifdef REFS_USE_RUNTIME_SWITCH
         properties.set_new("vm.compress_references", "true");
 #endif
 



Mime
View raw message