Index: ../vm/gc_gen/src/common/gc_for_vm.cpp =================================================================== --- ../vm/gc_gen/src/common/gc_for_vm.cpp (revision 582829) +++ ../vm/gc_gen/src/common/gc_for_vm.cpp (working copy) @@ -69,7 +69,10 @@ p_global_gc = gc; gc_parse_options(gc); - + + // ppervov: reference compression and vtable compression are orthogonal + vtable_base = vm_get_vtable_base(); + gc_tls_init(); gc_get_system_info(gc); @@ -135,7 +138,6 @@ #ifdef COMPRESS_REFERENCE Boolean gc_supports_compressed_references() { - vtable_base = vm_get_vtable_base(); return TRUE; } #endif Index: ../vm/vmcore/src/jit/jit_runtime_support.cpp =================================================================== --- ../vm/vmcore/src/jit/jit_runtime_support.cpp (revision 582829) +++ ../vm/vmcore/src/jit/jit_runtime_support.cpp (working copy) @@ -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 Index: ../vm/vmcore/src/class_support/String_Pool.cpp =================================================================== --- ../vm/vmcore/src/class_support/String_Pool.cpp (revision 582829) +++ ../vm/vmcore/src/class_support/String_Pool.cpp (working copy) @@ -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); Index: ../vm/vmcore/src/class_support/C_Interface.cpp =================================================================== --- ../vm/vmcore/src/class_support/C_Interface.cpp (revision 582829) +++ ../vm/vmcore/src/class_support/C_Interface.cpp (working copy) @@ -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); + tmn_suspend_enable(); END_RAISE_AREA; - tmn_suspend_enable(); } if (env->compress_references) { Index: ../vm/vmcore/src/init/vm_properties.cpp =================================================================== --- ../vm/vmcore/src/init/vm_properties.cpp (revision 582829) +++ ../vm/vmcore/src/init/vm_properties.cpp (working copy) @@ -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 Index: ../vm/vmcore/src/init/vm_init.cpp =================================================================== --- ../vm/vmcore/src/init/vm_init.cpp (revision 582829) +++ ../vm/vmcore/src/init/vm_init.cpp (working copy) @@ -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(); Index: ../vm/gc_cc/src/gc_for_vm.cpp =================================================================== --- ../vm/gc_cc/src/gc_for_vm.cpp (revision 582829) +++ ../vm/gc_cc/src/gc_for_vm.cpp (working copy) @@ -41,7 +41,6 @@ #ifdef POINTER64 GCExport Boolean gc_supports_compressed_references() { - vtable_base = (Ptr) vm_get_vtable_base(); return true; } #endif Index: ../vm/gc_cc/src/init.cpp =================================================================== --- ../vm/gc_cc/src/init.cpp (revision 582829) +++ ../vm/gc_cc/src/init.cpp (working copy) @@ -293,11 +293,16 @@ disable_assert_dialogs(); } +#ifdef POINTER64 + vtable_base = (Ptr)vm_get_vtable_base(); +#endif + init_mem(); init_slots(); init_select_gc(); gc_end = apr_time_now(); timer_init(); + return JNI_OK; }