You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by gs...@apache.org on 2007/10/10 12:07:49 UTC
svn commit: r583417 - in /harmony/enhanced/drlvm/trunk/vm: gc_cc/src/
gc_gen/src/common/ vmcore/src/class_support/ vmcore/src/init/ vmcore/src/jit/
Author: gshimansky
Date: Wed Oct 10 03:07:45 2007
New Revision: 583417
URL: http://svn.apache.org/viewvc?rev=583417&view=rev
Log:
Applied patch from HARMONY-4913
[drlvm][linux][em64t] Add runtime switch for reference compression.
Modified:
harmony/enhanced/drlvm/trunk/vm/gc_cc/src/gc_for_vm.cpp
harmony/enhanced/drlvm/trunk/vm/gc_cc/src/init.cpp
harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/C_Interface.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/String_Pool.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_init.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/init/vm_properties.cpp
harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
Modified: harmony/enhanced/drlvm/trunk/vm/gc_cc/src/gc_for_vm.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/gc_for_vm.cpp?rev=583417&r1=583416&r2=583417&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_cc/src/gc_for_vm.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_cc/src/gc_for_vm.cpp Wed Oct 10 03:07:45 2007
@@ -30,7 +30,6 @@
volatile int thread_list_lock;
int num_threads = 0;
-Ptr vtable_base;
size_t tls_offset_current=MAX_UINT32, tls_offset_clean=MAX_UINT32, tls_offset_ceiling=MAX_UINT32;
static hythread_tls_key_t tls_key_current=MAX_UINT32, tls_key_clean=MAX_UINT32, tls_key_ceiling=MAX_UINT32;
@@ -41,7 +40,6 @@
#ifdef POINTER64
GCExport Boolean gc_supports_compressed_references() {
- vtable_base = (Ptr) vm_get_vtable_base();
return true;
}
#endif
Modified: harmony/enhanced/drlvm/trunk/vm/gc_cc/src/init.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_cc/src/init.cpp?rev=583417&r1=583416&r2=583417&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_cc/src/init.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_cc/src/init.cpp Wed Oct 10 03:07:45 2007
@@ -58,6 +58,7 @@
Ptr heap_base;
size_t max_heap_size;
size_t min_heap_size;
+Ptr vtable_base;
bool ignore_finalizers = false;
bool remember_root_set = false;
const char *lp_hint = NULL;
@@ -293,12 +294,19 @@
disable_assert_dialogs();
}
+#ifdef POINTER64
+ if(vm_vtable_pointers_are_compressed()) {
+ vtable_base = (Ptr)vm_get_vtable_base();
+ }
+#endif
+
vm_gc_lock_init();
init_mem();
init_slots();
init_select_gc();
gc_end = apr_time_now();
timer_init();
+
return JNI_OK;
}
Modified: harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp?rev=583417&r1=583416&r2=583417&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/gc_gen/src/common/gc_for_vm.cpp Wed Oct 10 03:07:45 2007
@@ -71,7 +71,12 @@
p_global_gc = gc;
gc_parse_options(gc);
-
+
+ if(vm_vtable_pointers_are_compressed()) {
+ // ppervov: reference compression and vtable compression are orthogonal
+ vtable_base = vm_get_vtable_base();
+ }
+
gc_tls_init();
gc_get_system_info(gc);
@@ -137,7 +142,6 @@
#ifdef COMPRESS_REFERENCE
Boolean gc_supports_compressed_references()
{
- vtable_base = vm_get_vtable_base();
return TRUE;
}
#endif
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?rev=583417&r1=583416&r2=583417&view=diff
==============================================================================
--- 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 Wed Oct 10 03:07:45 2007
@@ -800,13 +800,13 @@
}
if (must_instantiate) {
+ BEGIN_RAISE_AREA;
// vm_instantiate_cp_string_resolved assumes that GC is disabled
tmn_suspend_disable();
// Discard the result. We are only interested in the side-effect of setting str->intern.
- BEGIN_RAISE_AREA;
vm_instantiate_cp_string_resolved(str);
- END_RAISE_AREA;
tmn_suspend_enable();
+ END_RAISE_AREA;
}
if (env->compress_references) {
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?rev=583417&r1=583416&r2=583417&view=diff
==============================================================================
--- 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 Wed Oct 10 03:07:45 2007
@@ -326,7 +326,7 @@
ManagedObject * String_Pool::intern(String * str) {
jobject string = oh_allocate_local_handle();
ManagedObject* lang_string = string_create_from_utf8(str->bytes, str->len);
-
+
if (!lang_string) { // if OutOfMemory
return NULL;
}
@@ -356,13 +356,13 @@
if (VM_Global_State::loader_env->compress_references) {
COMPRESSED_REFERENCE compressed_lang_string =
compress_reference(string->object);
- assert(is_compressed_reference(compressed_lang_string));
+ assert(is_compressed_reference(compressed_lang_string));
uint32 result = apr_atomic_cas32(
/*destination*/ (volatile uint32 *)&str->intern.compressed_ref,
- /*exchange*/ compressed_lang_string,
- /*comparand*/ 0);
+ /*exchange*/ compressed_lang_string,
+ /*comparand*/ 0);
if (result == 0) {
- // Note the successful write of the object.
+ // Note the successful write of the object.
gc_heap_write_global_slot_compressed(
(COMPRESSED_REFERENCE *)&str->intern.compressed_ref,
(Managed_Object_Handle)string->object);
@@ -374,11 +374,11 @@
} else {
void *result =
(void *)apr_atomic_casptr(
- /*destination*/ (volatile void **)&str->intern.raw_ref,
- /*exchange*/ (void *)string->object,
- /*comparand*/ (void *)NULL);
+ /*destination*/ (volatile void **)&str->intern.raw_ref,
+ /*exchange*/ (void *)string->object,
+ /*comparand*/ (void *)NULL);
if (result == NULL) {
- // Note the successful write of the object.
+ // Note the successful write of the object.
gc_heap_write_global_slot(
(Managed_Object_Handle *)&str->intern.raw_ref,
(Managed_Object_Handle)string->object);
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=583417&r1=583416&r2=583417&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 Oct 10 03:07:45 2007
@@ -687,6 +687,9 @@
parse_vm_arguments(vm_env);
vm_env->verify = get_boolean_property("vm.use_verifier", TRUE, VM_PROPERTIES);
+#ifdef POINTER64
+ vm_env->compress_references = get_boolean_property("vm.compress_references", TRUE, VM_PROPERTIES);
+#endif
// "Tool Interface" enabling.
vm_env->TI->setExecutionMode(vm_env);
@@ -723,8 +726,13 @@
// 20030404 This handshaking protocol isn't quite correct. It doesn't
// work at the moment because JIT has not yet been modified to support
// compressed references, so it never answers "true" to supports_compressed_references().
- status = check_compression();
- if (status != JNI_OK) return status;
+ // ppervov: this check is not correct since a call to
+ // gc_supports_compressed_references returns capability while a call to
+ // 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
+ //status = check_compression();
+ //if (status != JNI_OK) return status;
// Prepares to load natives
status = natives_init();
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=583417&r1=583416&r2=583417&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 Wed Oct 10 03:07:45 2007
@@ -289,6 +289,10 @@
properties.set_new("gc.dll", PORT_DSO_NAME(GC_DLL));
properties.set_new("thread.soft_unreservation", "false");
+#ifdef POINTER64
+ properties.set_new("vm.compress_references", "true");
+#endif
+
int n_api_dll_files = sizeof(api_dll_files) / sizeof(char *);
/*
* pass NULL for the pathname as we don't want
Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp?rev=583417&r1=583416&r2=583417&view=diff
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/jit_runtime_support.cpp Wed Oct 10 03:07:45 2007
@@ -3300,8 +3300,8 @@
c->instanceof_slow_path_taken();
#endif
- ManagedObject *null_ref = (ManagedObject *)VM_Global_State::loader_env->managed_null;
- if (obj == null_ref) {
+ // managed null is NULL too
+ if (obj == NULL) {
#ifdef VM_STATS
VM_Statistics::get_vm_stats().num_instanceof_null++;
#endif