You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by wj...@apache.org on 2006/11/09 05:52:17 UTC
svn commit: r472771 [11/11] - in /incubator/harmony/enhanced/drlvm/trunk/vm:
gc_cc/src/ gcv4/src/ include/ include/open/ interpreter/src/
jitrino/src/jet/ jitrino/src/vm/drl/ port/src/lil/ia32/pim/
port/src/lil/pim/ vmcore/include/ vmcore/src/class_sup...
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/stack/stack_dump.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/stack/stack_dump.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/stack/stack_dump.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/stack/stack_dump.cpp Wed Nov 8 20:52:12 2006
@@ -25,7 +25,9 @@
#include "port_malloc.h"
#include "jit_intf_cpp.h"
#include "Class.h"
+#include "class_member.h"
#include "stack_trace.h"
+#include "cci.h"
#ifdef PLATFORM_NT
@@ -170,19 +172,19 @@
info->line = -1;
info->method_name = NULL;
assert(m);
- if (m->get_class()->src_file_name && m->get_class()->src_file_name->bytes) {
- const char* fname = m->get_class()->src_file_name->bytes;
- size_t flen = strlen(fname);
+ if (m->get_class()->has_source_information() && m->get_class()->get_source_file_name()) {
+ const char* fname = m->get_class()->get_source_file_name();
+ size_t flen = m->get_class()->get_source_file_name_length();
info->file_name = (char*) STD_MALLOC(flen + 1);
strcpy(info->file_name, fname);
}
const char* mname = m->get_name()->bytes;
- size_t mlen = strlen(mname);
- const char* cname = m->get_class()->name->bytes;
- size_t clen = strlen(cname);
+ size_t mlen = m->get_name()->len;
+ const char* cname = m->get_class()->get_name()->bytes;
+ size_t clen = m->get_class()->get_name()->len;
const char* descr = m->get_descriptor()->bytes;
- size_t dlen = strlen(descr);
+ size_t dlen = m->get_descriptor()->len;
info->method_name = (char*) STD_MALLOC(mlen + clen + dlen + 2);
memcpy(info->method_name, cname, clen);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/stack/stack_trace.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/stack/stack_trace.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/stack/stack_trace.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/stack/stack_trace.cpp Wed Nov 8 20:52:12 2006
@@ -27,6 +27,8 @@
#include "jit_intf_cpp.h"
#include "environment.h"
#include "method_lookup.h"
+#include "cci.h"
+#include "class_member.h"
void get_file_and_line(Method_Handle mh, void *ip, bool is_ip_past, const char **file, int *line) {
Method *method = (Method*)mh;
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/mon_enter_exit.cpp Wed Nov 8 20:52:12 2006
@@ -40,6 +40,7 @@
#include "stack_iterator.h"
#include "Class.h"
#include "jit_intf_cpp.h"
+#include "cci.h"
#include "mon_enter_exit.h"
#include "thread_generic.h"
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/object_generic.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/object_generic.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/object_generic.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/object_generic.cpp Wed Nov 8 20:52:12 2006
@@ -84,8 +84,8 @@
set_hash_bits(p_obj);
if ( *P_HASH_CONTENTION_BYTE(p_obj) & HASH_MASK)
- return *P_HASH_CONTENTION_BYTE(p_obj) & HASH_MASK;
-
+ return *P_HASH_CONTENTION_BYTE(p_obj) & HASH_MASK;
+
ASSERT(0, "All the possible cases are supposed to be covered before");
return 0xff;
}
@@ -124,14 +124,14 @@
ObjectHandle h = (ObjectHandle) jobj;
VTable *vt = h->object->vt();
unsigned size;
- if (get_prop_array(vt->class_properties))
+ if((vt->class_properties & CL_PROP_ARRAY_MASK) != 0)
{
// clone an array
int32 length = get_vector_length((Vector_Handle) h->object);
- size = vm_array_size(vt, length);
- result = (ManagedObject *)
- vm_new_vector_using_vtable_and_thread_pointer(
- length, vt->clss->allocation_handle, vm_get_gc_thread_local());
+ size = vt->clss->calculate_array_size(length);
+ result = (ManagedObject*)
+ vm_new_vector_using_vtable_and_thread_pointer(length,
+ vt->clss->get_allocation_handle(), vm_get_gc_thread_local());
}
else
{
@@ -144,8 +144,7 @@
return NULL;
}
size = vt->allocated_size;
- result = (ManagedObject *) vm_alloc_and_report_ti(size,
- vt->clss->allocation_handle, vm_get_gc_thread_local(), vt->clss);
+ result = vt->clss->allocate_instance();
}
if (result == NULL) {
tmn_suspend_enable();
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_dump.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_dump.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_dump.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_dump.cpp Wed Nov 8 20:52:12 2006
@@ -30,9 +30,13 @@
#include "dll_jit_intf.h"
#include "object_generic.h"
+#include "Class.h"
+#include "vtable.h"
+#include "environment.h"
#include "root_set_enum_internal.h"
#include "lock_manager.h"
#include "open/gc.h"
+#include "cci.h"
#define LOG_DOMAIN "thread_dump"
#include "cxxlog.h"
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_manager.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_manager.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_manager.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/thread/thread_manager.cpp Wed Nov 8 20:52:12 2006
@@ -179,7 +179,7 @@
}
extern "C" char *vm_get_object_class_name(void* ptr) {
- return (char*) (((ManagedObject*)ptr)->vt()->clss->name->bytes);
+ return (char*)(((ManagedObject*)ptr)->vt()->clss->get_name()->bytes);
}
void* vm_jthread_get_tm_data(jthread thread)
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/ini_em64t.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/ini_em64t.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/ini_em64t.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/em64t/base/ini_em64t.cpp Wed Nov 8 20:52:12 2006
@@ -211,7 +211,7 @@
assert(VM_Global_State::loader_env->compress_references);
// convert from native to managed NULL
gr_args[gr_nargs++] = handle->object != NULL
- ? (uint64) handle->object : (uint64) Class::managed_null;
+ ? (uint64) handle->object : (uint64) VM_Global_State::loader_env->managed_null;
}
Java_Type type;
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/compile_IA32.cpp Wed Nov 8 20:52:12 2006
@@ -37,6 +37,7 @@
#include "open/types.h"
#include "Class.h"
+#include "type.h"
#include "environment.h"
#include "method_lookup.h"
#include "stack_iterator.h"
@@ -47,6 +48,7 @@
#include "jit_intf.h"
#include "jit_intf_cpp.h"
#include "jit_runtime_support.h"
+#include "type.h"
#include "encoder.h"
@@ -59,6 +61,7 @@
#include "vm_synch.h"
#include "vm_threads.h"
#include "ini.h"
+#include "type.h"
#include "compile.h"
#include "lil.h"
@@ -156,7 +159,7 @@
unsigned stack_pointer_offset) {
if (VM_Global_State::loader_env->compress_references) {
ss = mov(ss, eax_opnd, M_Base_Opnd(esp_reg, stack_pointer_offset));
- ss = alu(ss, cmp_opc, eax_opnd, Imm_Opnd((int32)Class::heap_base) );
+ ss = alu(ss, cmp_opc, eax_opnd, Imm_Opnd((int32)VM_Global_State::loader_env->heap_base) );
ss = branch8(ss, Condition_NE, Imm_Opnd(size_8, 0)); // not null, branch around the mov 0
char *backpatch_address__not_managed_null = ((char *)ss) - 1;
ss = mov(ss, M_Base_Opnd(esp_reg, stack_pointer_offset), Imm_Opnd(0));
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/ini_iA32.cpp Wed Nov 8 20:52:12 2006
@@ -119,7 +119,7 @@
Method *method = (Method*) methodID;
TRACE("enter method "
- << method->get_class()->name->bytes << " "
+ << method->get_class()->get_name()->bytes << " "
<< method->get_name()->bytes << " "
<< method->get_descriptor()->bytes);
int sz = method->get_num_arg_bytes() >> 2;
@@ -247,7 +247,7 @@
}
TRACE("exit method "
- << method->get_class()->name->bytes << " "
+ << method->get_class()->get_name()->bytes << " "
<< method->get_name()->bytes << " "
<< method->get_descriptor()->bytes);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_generic_rt_support_ia32.cpp Wed Nov 8 20:52:12 2006
@@ -1010,11 +1010,11 @@
} //get_log2
#endif
-static void vm_rt_char_arraycopy_no_exc(ManagedObject *src,
- int32 srcOffset,
- ManagedObject *dst,
- int32 dstOffset,
- int32 length)
+static void vm_rt_char_arraycopy_no_exc(ManagedObject* src,
+ int32 srcOffset,
+ ManagedObject* dst,
+ int32 dstOffset,
+ int32 length)
{
// 20030303 Use a C loop to (hopefully) speed up short array copies.
@@ -1025,10 +1025,10 @@
assert(src_class);
Class * UNUSED dst_class = dst->vt()->clss;
assert(dst_class);
- assert((src_class->is_array) && (dst_class->is_array));
- assert((src_class->is_array_of_primitives) && (dst_class->is_array_of_primitives));
- assert(strcmp(src_class->name->bytes, "[C") == 0);
- assert(strcmp(dst_class->name->bytes, "[C") == 0);
+ assert(src_class->is_array() && (dst_class->is_array()));
+ assert(src_class->is_array_of_primitives() && dst_class->is_array_of_primitives());
+ assert(strcmp(src_class->get_name()->bytes, "[C") == 0);
+ assert(strcmp(dst_class->get_name()->bytes, "[C") == 0);
// Check the offsets
assert(srcOffset >= 0);
assert(dstOffset >= 0);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/jit_runtime_support_ia32.cpp Wed Nov 8 20:52:12 2006
@@ -91,7 +91,7 @@
VM_Statistics::get_vm_stats().num_checkcast_null ++;
if (obj != NULL && obj->vt()->clss == c)
VM_Statistics::get_vm_stats().num_checkcast_equal_type ++;
- if (obj != NULL && c->is_suitable_for_fast_instanceof)
+ if (obj != NULL && c->get_fast_instanceof_flag())
VM_Statistics::get_vm_stats().num_checkcast_fast_decision ++;
} //update_checkcast_stats
#endif
@@ -130,7 +130,7 @@
ss = mov(ss, eax_opnd, M_Base_Opnd(esp_reg, +4) );
if (VM_Global_State::loader_env->compress_references) {
- ss = alu(ss, cmp_opc, eax_opnd, Imm_Opnd((unsigned)Class::heap_base)); //is eax == NULL?
+ ss = alu(ss, cmp_opc, eax_opnd, Imm_Opnd((unsigned)VM_Global_State::loader_env->heap_base)); //is eax == NULL?
ss = branch8(ss, Condition_NZ, Imm_Opnd(size_8, 0));
} else {
ss = test(ss, eax_opnd, eax_opnd);
@@ -212,10 +212,10 @@
{
#ifdef VM_STATS
VM_Statistics::get_vm_stats().num_is_class_initialized++;
- clss->num_class_init_checks++;
+ clss->initialization_checked();
#endif // VM_STATS
assert(!hythread_is_suspend_enabled());
- return clss->state == ST_Initialized;
+ return clss->is_initialized();
} //is_class_initialized
@@ -505,10 +505,10 @@
{
if (VM_Global_State::loader_env->compress_references) {
// 20030321 Convert a null reference from a managed (heap_base) to an unmanaged null (NULL/0).
- if (elem == (volatile ManagedObject *)Class::heap_base) {
+ if (elem == (volatile ManagedObject *)VM_Global_State::loader_env->heap_base) {
elem = NULL;
}
- if (array == (ManagedObject *)Class::heap_base) {
+ if (array == (ManagedObject *)VM_Global_State::loader_env->heap_base) {
array = NULL;
}
}
@@ -529,13 +529,14 @@
#ifdef VM_STATS
if (vt == cached_object_array_vtable_ptr)
VM_Statistics::get_vm_stats().num_aastore_object_array ++;
- if (vt->clss->array_element_class->vtable == ((ManagedObject *)elem)->vt())
+ if (vt->clss->get_array_element_class()->get_vtable() == ((ManagedObject *)elem)->vt())
VM_Statistics::get_vm_stats().num_aastore_equal_type ++;
- if (vt->clss->array_element_class->is_suitable_for_fast_instanceof)
+ if (vt->clss->get_array_element_class()->get_fast_instanceof_flag())
VM_Statistics::get_vm_stats().num_aastore_fast_decision ++;
#endif // VM_STATS
- if(vt == cached_object_array_vtable_ptr ||
- class_is_subtype_fast(((ManagedObject *)elem)->vt(), vt->clss->array_element_class)) {
+ if(vt == cached_object_array_vtable_ptr
+ || class_is_subtype_fast(((ManagedObject *)elem)->vt(), vt->clss->get_array_element_class()))
+ {
STORE_REFERENCE((ManagedObject *)array, get_vector_element_address_ref(array, idx), (ManagedObject *)elem);
return 0;
}
@@ -1007,7 +1008,7 @@
if (VM_Global_State::loader_env->compress_references) {
// 20030321 Convert a null reference in %ecx from a managed (heap_base) to an unmanaged null (0/NULL).
- ss = test(ss, ecx_opnd, Imm_Opnd((unsigned)Class::heap_base));
+ ss = test(ss, ecx_opnd, Imm_Opnd((unsigned)VM_Global_State::loader_env->heap_base));
ss = branch8(ss, Condition_NE, Imm_Opnd(size_8, 0)); // branch around mov 0
char *backpatch_address__not_managed_null = ((char *)ss) - 1;
ss = mov(ss, ecx_opnd, Imm_Opnd(0));
@@ -1300,14 +1301,14 @@
switch (f) {
case VM_RT_CHECKCAST:
{
- if (!clss->is_suitable_for_fast_instanceof)
+ if (!clss->get_fast_instanceof_flag())
return NULL;
return gen_lil_typecheck_stub_specialized(true, true, clss);
}
case VM_RT_INSTANCEOF:
{
- if (!clss->is_suitable_for_fast_instanceof)
+ if (!clss->get_fast_instanceof_flag())
return NULL;
return gen_lil_typecheck_stub_specialized(false, true, clss);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/optimize_ia32.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/optimize_ia32.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/optimize_ia32.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ia32/base/optimize_ia32.cpp Wed Nov 8 20:52:12 2006
@@ -66,7 +66,7 @@
static ManagedObject *
get_class_ptr(ManagedObject *obj)
{
- return *(obj->vt()->clss->class_handle);
+ return *(obj->vt()->clss->get_class_handle());
}
// ****** Begin overrides
@@ -124,16 +124,15 @@
s = mov(s, ebp_opnd, M_Base_Opnd(eax_reg, (int)env->vm_class_offset)) ; // ld l0,i0+offset (add offset, ld val)
// Determine if this class supports fast allocation
- size_t offset_is_fast_allocation_possible = (Byte *)&(env->Void_Class->is_fast_allocation_possible) - (Byte *)(env->Void_Class);
- assert(sizeof(env->Void_Class->is_fast_allocation_possible) == 1); // else one byte ld below will fail
+ size_t offset_is_fast_allocation_possible = env->Void_Class->get_offset_of_fast_allocation_flag();
s = movzx(s, ebx_opnd, M_Base_Opnd(ebp_reg, offset_is_fast_allocation_possible), size_8);
s = test(s, ebx_opnd, ebx_opnd); // jc l1=0,fallback
s = branch8(s, Condition_Z, Imm_Opnd(size_8, 50));
// Class supports fast allocation, now use frontier allocation technique
size_t offset_gc_local = (Byte *)&(p_TLS_vmthread->_gc_private_information) - (Byte *)p_TLS_vmthread;
- size_t offset_allocation_handle = (Byte *)&(env->Void_Class->allocation_handle) - (Byte *)(env->Void_Class);
- size_t offset_instance_data_size = (Byte *)&(env->Void_Class->instance_data_size) - (Byte *)(env->Void_Class);
+ size_t offset_allocation_handle = env->Void_Class->get_offset_of_allocation_handle();
+ size_t offset_instance_data_size = env->Void_Class->get_offset_of_instance_data_size();
current_offset += (unsigned) offset_gc_local;
limit_offset += (unsigned) offset_gc_local;
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/compile_ipf.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/compile_ipf.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/compile_ipf.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/compile_ipf.cpp Wed Nov 8 20:52:12 2006
@@ -118,7 +118,7 @@
increment_stats_counter(*mce, &VM_Statistics::get_vm_stats().num_convert_null_u2m);
#endif
mce->ipf_cmp(icmp_eq, cmp_none, SCRATCH_PRED_REG, SCRATCH_PRED_REG2, reg, 0);
- emit_mov_imm_compactor(*mce, reg, (uint64)Class::heap_base, SCRATCH_PRED_REG);
+ emit_mov_imm_compactor(*mce, reg, (uint64)VM_Global_State::loader_env->heap_base, SCRATCH_PRED_REG);
}
} //gen_convert_unmanaged_to_managed_null_ipf
@@ -146,17 +146,16 @@
emitter.ipf_ld(int_mem_size_8, mem_ld_none, mem_none, SCRATCH_GENERAL_REG7, SCRATCH_GENERAL_REG);
// Check that the argument class is instantiatable. Note: we use Void_Class here but any class will do.
- // g1 = g7 + offset_is_fast_allocation_possible // address of (clss->is_fast_allocation_possible)
- // g2 = [g1] // clss->is_fast_allocation_possible
- // p1 = (g2 != 0) // p1 = is clss->is_fast_allocation_possible?
- size_t offset_is_fast_allocation_possible = (Byte *)&(env->Void_Class->is_fast_allocation_possible) - (Byte *)(env->Void_Class);
- assert(sizeof(env->Void_Class->is_fast_allocation_possible) == 1); // else one byte ld below will fail
+ // g1 = g7 + offset_is_fast_allocation_possible // address of (clss->m_is_fast_allocation_possible)
+ // g2 = [g1] // clss->m_is_fast_allocation_possible
+ // p1 = (g2 != 0) // p1 = is clss->m_is_fast_allocation_possible?
+ size_t offset_is_fast_allocation_possible = env->Void_Class->get_offset_of_fast_allocation_flag();
emitter.ipf_adds(SCRATCH_GENERAL_REG, (int)offset_is_fast_allocation_possible, SCRATCH_GENERAL_REG7);
emitter.ipf_ld(int_mem_size_1, mem_ld_none, mem_none, SCRATCH_GENERAL_REG2, SCRATCH_GENERAL_REG);
emitter.ipf_cmp(icmp_ne, cmp_none, SCRATCH_PRED_REG, SCRATCH_PRED_REG2, 0, SCRATCH_GENERAL_REG2);
- // The following instructions are executed only if p1 (i.e., if clss->is_fast_allocation_possible).
+ // The following instructions are executed only if p1 (i.e., if clss->m_is_fast_allocation_possible).
// This is a significantly modified version of the inline code in get_vm_rt_new_with_thread_pointer_compactor().
// Do the fast path without creating a frame. This sequence uses predicated instructions rather than branching,
// although I wonder if it has become too long for this to be effective.
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/ini_ipf.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/ini_ipf.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/ini_ipf.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/ini_ipf.cpp Wed Nov 8 20:52:12 2006
@@ -165,7 +165,7 @@
// 20030318 We are in unmanaged code where null is represented by 0/NULL. Convert a null reference
// to the representation of null in managed code (heap_base).
if (i64 == 0) {
- i64 = (uint64)Class::heap_base;
+ i64 = (uint64)VM_Global_State::loader_env->heap_base;
}
}
arg_words[num_arg_words++] = i64;
@@ -188,7 +188,7 @@
// 20030318 We are in unmanaged code where null is represented by 0/NULL. Convert a null reference
// to the representation of null in managed code (heap_base).
if (i64 == 0) {
- i64 = (uint64)Class::heap_base;
+ i64 = (uint64)VM_Global_State::loader_env->heap_base;
}
}
arg_words[num_arg_words++] = i64;
@@ -196,7 +196,7 @@
#ifdef _DEBUG
{
if (! VM_Global_State::loader_env->compress_references ||
- i64 != (uint64)Class::heap_base) {
+ i64 != (uint64)VM_Global_State::loader_env->heap_base) {
ManagedObject *object = (ManagedObject *)i64;
if(object) {
Class *clss = object->vt()->clss;
@@ -269,7 +269,7 @@
if (VM_Global_State::loader_env->compress_references) {
// 20030318 Convert a null reference in managed code (represented by heap_base)
// to the representation of null in unmanaged code (0 or NULL).
- if ((uint64)int_result == (uint64)Class::heap_base) {
+ if ((uint64)int_result == (uint64)VM_Global_State::loader_env->heap_base) {
int_result = 0;
}
}
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/jit_runtime_support_ipf.cpp Wed Nov 8 20:52:12 2006
@@ -157,8 +157,7 @@
assert(strcmp(c->name->bytes, "java/lang/Class"));
#ifdef VM_STATS
VM_Statistics::get_vm_stats().num_class_alloc_new_object++;
- c->num_allocations++;
- c->num_bytes_allocated += get_instance_data_size(c);
+ c->instance_allocated(c->get_instance_data_size());
#endif //VM_STATS
return (ManagedObject *)vm_malloc_with_thread_pointer(c->instance_data_size, c->allocation_handle, vm_get_gc_thread_local());
} //vm_rt_new_resolved
@@ -285,8 +284,7 @@
#ifdef VM_STATS
VTable *vt = ManagedObject::allocation_handle_to_vtable(ah);
Class *c = vt->clss;
- c->num_allocations++;
- c->num_bytes_allocated += get_instance_data_size(c);
+ c->instance_allocated(get_instance_data_size(c));
#endif
}
@@ -651,9 +649,9 @@
int sub_object, int super_class, int pred,
bool is_instanceof, int call_label)
{
- // sc1 = &super_class->is_suitable_for_fast_instanceof
+ // sc1 = super_class->get_offset_of_fast_instanceof_flag()
// sc3 = [sub_object]
- // sc6 = &super_class->depth
+ // sc6 = super_class->get_offset_of_depth()
// sc4 = offset(superclasses) - 8
// sc2 = [sc1]
@@ -691,19 +689,16 @@
const unsigned sc9 = SCRATCH_GENERAL_REG9;
Class *dummy_class = NULL;
- const int offset_is_suitable = (int) ((Byte*)&dummy_class->is_suitable_for_fast_instanceof - (Byte*)dummy_class);
- assert(sizeof(dummy_class->is_suitable_for_fast_instanceof) == 4);
-
- const int offset_depth = (int) ((Byte*)&dummy_class->depth - (Byte*)dummy_class);
- assert(sizeof(dummy_class->depth) == 4);
+ const int offset_is_suitable = (int)Class::get_offset_of_fast_instanceof_flag(dummy_class);
+ const int offset_depth = (int)Class::get_offset_of_depth(dummy_class);
VTable *dummy_vtable = NULL;
const int offset_superclasses = (int) ((Byte*)&dummy_vtable->superclasses[-1] - (Byte*)dummy_vtable);
const int offset_clss = (int) ((Byte*)&dummy_vtable->clss - (Byte*)dummy_vtable);
- // sc1 = &super_class->is_suitable_for_fast_instanceof
+ // sc1 = super_class->get_offset_of_fast_instanceof_flag()
// sc3 = [sub_object]
- // sc6 = &super_class->depth
+ // sc6 = super_class->get_offset_of_depth()
// sc4 = offset(superclasses) - 8
emitter.ipf_adds(sc1, offset_is_suitable, super_class);
if (vm_vtable_pointers_are_compressed())
@@ -1092,7 +1087,7 @@
// reg1 = [reg0]
// reg1 = reg1 + 1
// [reg0] = reg1
- emitter.ipf_adds(SCRATCH_GENERAL_REG, (int)((Byte*)&dummy->num_class_init_checks-(Byte*)dummy), IN_REG0);
+ emitter.ipf_adds(SCRATCH_GENERAL_REG, (int)Class::get_offset_of_class_init_checks(dummy), IN_REG0);
emitter.ipf_ld(int_mem_size_8, mem_ld_none, mem_none, SCRATCH_GENERAL_REG2, SCRATCH_GENERAL_REG);
emitter.ipf_adds(SCRATCH_GENERAL_REG2, 1, SCRATCH_GENERAL_REG2);
emitter.ipf_st(int_mem_size_8, mem_st_none, mem_none, SCRATCH_GENERAL_REG, SCRATCH_GENERAL_REG2);
@@ -1132,7 +1127,7 @@
// 20030502 This JIT support routine expects to be called directly from managed code.
static void *vm_rt_get_interface_vtable(ManagedObject *object, Class *clss)
{
- assert(object != (ManagedObject *)Class::managed_null);
+ assert(object != (ManagedObject *)VM_Global_State::loader_env->managed_null);
void *vt = vm_get_interface_vtable(object, clss);
return vt;
} //vm_rt_get_interface_vtable
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/stub_code_utils.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/stub_code_utils.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/stub_code_utils.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/ipf/base/stub_code_utils.cpp Wed Nov 8 20:52:12 2006
@@ -184,7 +184,7 @@
{
assert(VM_Global_State::loader_env->compress_references);
const bool cmp4 = true;
- uint32 null_low = (uint32) (uint64) Class::managed_null;
+ uint32 null_low = (uint32) (uint64) VM_Global_State::loader_env->managed_null;
if (null_low == 0)
{
emitter.ipf_cmp(icmp_eq, cmp_none, predicate1, predicate2, src, 0, cmp4);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_stats.cpp Wed Nov 8 20:52:12 2006
@@ -251,10 +251,9 @@
num_monitor_exit_decr_rec_count = 0;
num_monitor_exit_very_slow_path = 0;
- num_monitor_enters_with_zero_headers = 0;
+ num_monitor_enters_with_zero_headers = 0;
num_monitor_enters_with_nonzero_headers = 0;
-
num_monitor_enter_wait = 0;
num_sleep_monitor_enter = 0;
num_sleep_monitor_exit = 0;
@@ -301,6 +300,17 @@
num_compileme_generated = 0;
num_compileme_used = 0;
+ num_statics_allocations = 0;
+ num_nonempty_statics_allocations = 0;
+ num_vtable_allocations = 0;
+ num_hot_statics_allocations = 0;
+ num_hot_vtable_allocations = 0;
+
+ total_statics_bytes = 0;
+ total_vtable_bytes = 0;
+ total_hot_statics_bytes = 0;
+ total_hot_vtable_bytes = 0;
+
// Enter the JIT RT support functions into a <function number> -> <function name, argument number> map.
for (int i = 0; i < sizeof_jit_rt_function_entries; i++) {
char *fn_name;
@@ -340,12 +350,12 @@
for (it = ct->begin(); it != ct->end(); it++)
{
Class *c = it->second;
- if(c->num_throws) {
+ if(c->get_times_thrown()) {
if(first_time) {
first_time = false;
printf("\nFollowing exceptions were thrown:\n");
}
- printf("%11" FMT64 "u :::: %s\n", c->num_throws, c->name->bytes);
+ printf("%11" FMT64 "u :::: %s\n", c->get_times_thrown(), c->get_name()->bytes);
}
}
if(!first_time) {
@@ -356,12 +366,12 @@
for (it = ct->begin(); it != ct->end(); it++)
{
Class *c = it->second;
- if(c->num_class_init_checks) {
+ if(c->get_times_init_checked() != 0) {
if(first_time) {
first_time = false;
printf("Following classes were checked for init state:\n");
}
- printf("%11" FMT64 "u :::: %s\n", c->num_class_init_checks, c->name->bytes);
+ printf("%11" FMT64 "u :::: %s\n", c->get_times_init_checked(), c->get_name()->bytes);
}
}
if(!first_time) {
@@ -372,13 +382,14 @@
for (it = ct->begin(); it != ct->end(); it++)
{
Class *c = it->second;
- if(c->num_instanceof_slow) {
+ if(c->get_times_instanceof_slow_path_taken() != 0) {
if(first_time) {
first_time = false;
printf("Following classes were used in the instanceof test:\n");
}
printf("%11" FMT64 "u :::: %-50s : [intf=%d, depth=%2d]\n",
- c->num_instanceof_slow, c->name->bytes, (class_is_interface(c) ? 1 : 0), c->depth);
+ c->get_times_instanceof_slow_path_taken(), c->get_name()->bytes,
+ (c->is_interface() ? 1 : 0), c->get_depth());
}
}
if(!first_time) {
@@ -389,18 +400,18 @@
for (it = ct->begin(); it != ct->end(); it++)
{
Class *c = it->second;
- total_bytes_allocated += c->num_bytes_allocated;
+ total_bytes_allocated += c->get_total_bytes_allocated();
}
first_time = true;
for (it = ct->begin(); it != ct->end(); it++)
{
Class *c = it->second;
- if(c->num_allocations) {
+ if(c->get_times_allocated() != 0) {
if(first_time) {
first_time = false;
printf("Number of instances [and # from Class.newInstance],\nand total allocated bytes for the following classes:\n");
}
- uint64 nb = c->num_bytes_allocated;
+ uint64 nb = c->get_total_bytes_allocated();
#if defined (__INTEL_COMPILER)
#pragma warning( push )
@@ -413,21 +424,24 @@
#endif
if (false && nb > 1000000) {
uint64 nk = (nb/1024);
- if (c->is_array) {
- printf(" %60s %10" FMT64 "u [%10" FMT64 "u] = %10" FMT64 "uK %3u%%\n",
- c->name->bytes, c->num_allocations, c->num_allocations_from_newInstance, nk, percent);
+ if (c->is_array()) {
+ printf(" %60s %10" FMT64 "u = %10" FMT64 "uK %3u%%\n",
+ c->get_name()->bytes, c->get_times_allocated(),
+ nk, percent);
} else {
- printf(" %60s %10" FMT64 "u [%10" FMT64 "u] * %4u = %10" FMT64 "uK %3u%%\n",
- c->name->bytes, c->num_allocations, c->num_allocations_from_newInstance, get_instance_data_size(c), nk, percent);
+ printf(" %60s %10" FMT64 "u * %4u = %10" FMT64 "uK %3u%%\n",
+ c->get_name()->bytes, c->get_times_allocated(),
+ c->get_instance_data_size(), nk, percent);
}
} else {
- if (c->is_array) {
- printf("%10" FMT64 "u : %10" FMT64 "u : : %10" FMT64 "u :%-60s:%2u%%\n",
- c->num_allocations, c->num_allocations_from_newInstance, nb, c->name->bytes, percent);
+ if (c->is_array()) {
+ printf("%10" FMT64 "u : : %10" FMT64 "u :%-60s:%2u%%\n",
+ c->get_times_allocated(),
+ nb, c->get_name()->bytes, percent);
} else {
- printf("%10" FMT64 "u : %10" FMT64 "u : * %4u = : %10" FMT64 "u :%-60s:%2u%%\n",
- c->num_allocations, c->num_allocations_from_newInstance,
- get_instance_data_size(c), nb, c->name->bytes, percent);
+ printf("%10" FMT64 "u * %4u = : %10" FMT64 "u :%-60s:%2u%%\n",
+ c->get_times_allocated(),
+ c->get_instance_data_size(), nb, c->get_name()->bytes, percent);
}
}
}
@@ -449,28 +463,29 @@
{
Class *c = it->second;
// Only print out those classes with padding bytes that also have instances allocated.
- if((c->num_field_padding_bytes) && (c->num_allocations)) {
+ if((c->get_total_padding_bytes() != 0) && (c->get_times_allocated() != 0)) {
if(first_time) {
first_time = false;
- if (Class::compact_fields) {
+ if (VM_Global_State::loader_env->compact_fields) {
printf("Field alignment bytes and total allocated alignment bytes for the following classes:\n");
} else {
printf("Field padding and alignment bytes and the total such bytes for the following classes:\n");
}
}
- if (c->is_array) {
- printf("%11u :::: %s\n", (unsigned)c->num_field_padding_bytes, c->name->bytes);
+ if (c->is_array()) {
+ printf("%11u :::: %s\n", (unsigned)c->get_total_padding_bytes(), c->get_name()->bytes);
} else {
- uint64 bytes_allocated = (c->num_allocations * (uint64)(c->num_field_padding_bytes));
+ uint64 bytes_allocated = c->get_times_allocated()*(uint64)c->get_total_padding_bytes();
total_pad_bytes_allocated += bytes_allocated;
- printf("%11u : %11" FMT64 "u ::: %s\n", c->num_field_padding_bytes, bytes_allocated, c->name->bytes);
+ printf("%11u : %11" FMT64 "u ::: %s\n", c->get_total_padding_bytes(),
+ bytes_allocated, c->get_name()->bytes);
}
}
}
if(!first_time) {
printf(": ----------\n");
printf(": %15" FMT64 "u\n", total_pad_bytes_allocated);
- printf("\n");
+ printf("\n");
}
} //print_classes
@@ -487,22 +502,19 @@
for (it = ct->begin(); it != ct->end(); it++)
{
Class *c = it->second;
- int n_methods = c->n_methods;
+ int n_methods = c->get_number_of_methods();
for(int i = 0; i < n_methods; i++) {
- Method *m = &(c->methods[i]);
+ Method* m = c->get_method(i);
if (m->is_fake_method()) {
continue; // ignore fake methods
}
if(m->num_accesses) {
- const char *cname = c->name->bytes;
- const char *mname = m->get_name()->bytes;
- const char *descr = m->get_descriptor()->bytes;
printf("%11" FMT64 "u : %11" FMT64 "u ::: %s.%s%s\n",
m->num_accesses,
m->num_slow_accesses,
- cname,
- mname,
- descr);
+ c->get_name()->bytes,
+ m->get_name()->bytes,
+ m->get_descriptor()->bytes);
}
}
}
@@ -839,18 +851,19 @@
printf("%11" FMT64 "u ::::Number of Java yield sleeps\n", num_sleep_java_thread_yield);
printf("%11" FMT64 "u ::::Number of wait for object\n", num_wait_WaitForSingleObject);
printf("%11" FMT64 "u ::::Number of hashcode sleeps\n", num_sleep_hashcode);
- printf("%11" FMT64 "u ::::Number of mon owner sleeps\n", num_sleep_monitor_ownership);
+ printf("%11" FMT64 "u ::::Number of mon owner sleeps\n", num_sleep_monitor_ownership);
- // 20020923 Print total number of allocations and total number of bytes for class-related data structures.
+ // Print total number of allocations and total number of bytes
+ // for class-related data structures.
printf("\nAllocations of storage for statics:\n");
- printf("%11d ::::number allocated\n", Class::num_statics_allocations);
- printf("%11d ::::number nonempty allocated\n", Class::num_nonempty_statics_allocations);
- printf("%11d ::::bytes allocated\n", Class::total_statics_bytes);
+ printf("%11d ::::number allocated\n", num_statics_allocations);
+ printf("%11d ::::number nonempty allocated\n", num_nonempty_statics_allocations);
+ printf("%11d ::::bytes allocated\n", total_statics_bytes);
fflush(stdout);
-
+
printf("\nAllocations of storage for vtables:\n");
- printf("%11d ::::number allocated\n", Class::num_vtable_allocations);
- printf("%11d ::::bytes allocated\n", Class::total_vtable_bytes);
+ printf("%11d ::::number allocated\n", num_vtable_allocations);
+ printf("%11d ::::bytes allocated\n", total_vtable_bytes);
printf("\n");
printf("%11" FMT64 "u ::::# times free_local_handle_2 was called\n", num_free_local_called);
Modified: incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_strings.cpp
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_strings.cpp?view=diff&rev=472771&r1=472770&r2=472771
==============================================================================
--- incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_strings.cpp (original)
+++ incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/util/vm_strings.cpp Wed Nov 8 20:52:12 2006
@@ -243,17 +243,16 @@
clss = global_env->ArrayOfByte_Class;
assert(clss);
- unsigned sz = vm_array_size(clss->vtable, unicode_length);
- Vector_Handle array = vm_alloc_and_report_ti(sz, clss->allocation_handle,
- vm_get_gc_thread_local(), clss);
- if (!array) { // OutOfMemory should be thrown
+ unsigned sz = clss->calculate_array_size(unicode_length);
+ Vector_Handle array = vm_alloc_and_report_ti(sz, clss->get_allocation_handle(),
+ vm_get_gc_thread_local(), clss);
+ if(!array) { // OutOfMemory should be thrown
*str = NULL;
exn_raise_object(VM_Global_State::loader_env->java_lang_OutOfMemoryError);
return;
}
#ifdef VM_STATS
- clss->num_allocations++;
- clss->num_bytes_allocated += sz;
+ clss->instance_allocated(sz);
#endif //VM_STATS
set_vector_length(array, unicode_length);
@@ -590,20 +589,17 @@
}
-Java_java_lang_String *
-vm_instantiate_cp_string_slow(Class *c, unsigned cp_index)
+Java_java_lang_String*
+vm_instantiate_cp_string_slow(Class* c, unsigned cp_index)
{
ASSERT_THROW_AREA;
#ifdef VM_STATS
VM_Statistics::get_vm_stats().num_instantiate_cp_string_slow++;
#endif
- Java_java_lang_String *result;
- assert(cp_index < c->cp_size);
- Const_Pool *cp = c->const_pool;
-
- String *str = cp[cp_index].CONSTANT_String.string;
- assert(cp_is_constant(cp, cp_index));
+ Java_java_lang_String* result;
+ ConstantPool& cp = c->get_constant_pool();
+ String* str = cp.get_string(cp_index);
BEGIN_RAISE_AREA;
result = vm_instantiate_cp_string_resolved(str);