6420645: Create a vm that uses compressed oops for up to 32gb heapsizes

Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv

Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
This commit is contained in:
Coleen Phillimore 2008-04-13 17:43:42 -04:00
parent 680ecf1611
commit 4a831d45f0
273 changed files with 6585 additions and 2993 deletions

View file

@ -196,7 +196,7 @@ int generateJvmOffsets(GEN_variant gen_variant) {
printf("\n");
GEN_VALUE(OFFSET_HeapBlockHeader_used, offset_of(HeapBlock::Header, _used));
GEN_OFFS(oopDesc, _klass);
GEN_OFFS(oopDesc, _metadata);
printf("\n");
GEN_VALUE(AccessFlags_NATIVE, JVM_ACC_NATIVE);

View file

@ -46,6 +46,7 @@ extern pointer __JvmOffsets;
extern pointer __1cJCodeCacheF_heap_;
extern pointer __1cIUniverseP_methodKlassObj_;
extern pointer __1cIUniverseO_collectedHeap_;
extern pointer __1cIUniverseK_heap_base_;
extern pointer __1cHnmethodG__vtbl_;
extern pointer __1cKBufferBlobG__vtbl_;
@ -107,7 +108,7 @@ dtrace:helper:ustack:
copyin_offset(OFFSET_constantPoolOopDesc_pool_holder);
copyin_offset(OFFSET_HeapBlockHeader_used);
copyin_offset(OFFSET_oopDesc_klass);
copyin_offset(OFFSET_oopDesc_metadata);
copyin_offset(OFFSET_symbolOopDesc_length);
copyin_offset(OFFSET_symbolOopDesc_body);
@ -150,6 +151,7 @@ dtrace:helper:ustack:
this->Universe_methodKlassOop = copyin_ptr(&``__1cIUniverseP_methodKlassObj_);
this->CodeCache_heap_address = copyin_ptr(&``__1cJCodeCacheF_heap_);
this->Universe_heap_base = copyin_ptr(&``__1cIUniverseK_heap_base_);
/* Reading volatile values */
this->CodeCache_low = copyin_ptr(this->CodeCache_heap_address +
@ -293,10 +295,27 @@ dtrace:helper:ustack:
dtrace:helper:ustack:
/!this->done && this->vtbl == this->BufferBlob_vtbl &&
this->Universe_heap_base == NULL &&
this->methodOopPtr > this->heap_start && this->methodOopPtr < this->heap_end/
{
MARK_LINE;
this->klass = copyin_ptr(this->methodOopPtr + OFFSET_oopDesc_klass);
this->klass = copyin_ptr(this->methodOopPtr + OFFSET_oopDesc_metadata);
this->methodOop = this->klass == this->Universe_methodKlassOop;
this->done = !this->methodOop;
}
dtrace:helper:ustack:
/!this->done && this->vtbl == this->BufferBlob_vtbl &&
this->Universe_heap_base != NULL &&
this->methodOopPtr > this->heap_start && this->methodOopPtr < this->heap_end/
{
MARK_LINE;
/*
* Read compressed pointer and decode heap oop, same as oop.inline.hpp
*/
this->cklass = copyin_uint32(this->methodOopPtr + OFFSET_oopDesc_metadata);
this->klass = (uint64_t)((uintptr_t)this->Universe_heap_base +
((uintptr_t)this->cklass << 3));
this->methodOop = this->klass == this->Universe_methodKlassOop;
this->done = !this->methodOop;
}

View file

@ -148,9 +148,11 @@ struct jvm_agent {
uint64_t Universe_methodKlassObj_address;
uint64_t CodeCache_heap_address;
uint64_t Universe_heap_base_address;
/* Volatiles */
uint64_t Universe_methodKlassObj;
uint64_t Universe_heap_base;
uint64_t CodeCache_low;
uint64_t CodeCache_high;
uint64_t CodeCache_segmap_low;
@ -166,7 +168,6 @@ struct jvm_agent {
Frame_t curr_fr;
};
static int
read_string(struct ps_prochandle *P,
char *buf, /* caller's buffer */
@ -185,6 +186,14 @@ read_string(struct ps_prochandle *P,
return -1;
}
static int read_compressed_pointer(jvm_agent_t* J, uint64_t base, uint32_t *ptr) {
int err = -1;
uint32_t ptr32;
err = ps_pread(J->P, base, &ptr32, sizeof(uint32_t));
*ptr = ptr32;
return err;
}
static int read_pointer(jvm_agent_t* J, uint64_t base, uint64_t* ptr) {
int err = -1;
uint32_t ptr32;
@ -270,6 +279,9 @@ static int parse_vmstructs(jvm_agent_t* J) {
if (strcmp("_methodKlassObj", vmp->fieldName) == 0) {
J->Universe_methodKlassObj_address = vmp->address;
}
if (strcmp("_heap_base", vmp->fieldName) == 0) {
J->Universe_heap_base_address = vmp->address;
}
}
CHECK_FAIL(err);
@ -292,6 +304,8 @@ static int read_volatiles(jvm_agent_t* J) {
err = read_pointer(J, J->Universe_methodKlassObj_address, &J->Universe_methodKlassObj);
CHECK_FAIL(err);
err = read_pointer(J, J->Universe_heap_base_address, &J->Universe_heap_base);
CHECK_FAIL(err);
err = read_pointer(J, J->CodeCache_heap_address + OFFSET_CodeHeap_memory +
OFFSET_VirtualSpace_low, &J->CodeCache_low);
CHECK_FAIL(err);
@ -444,7 +458,17 @@ void Jagent_destroy(jvm_agent_t *J) {
static int is_methodOop(jvm_agent_t* J, uint64_t methodOopPtr) {
uint64_t klass;
int err;
err = read_pointer(J, methodOopPtr + OFFSET_oopDesc_klass, &klass);
// If heap_base is nonnull, this was a compressed oop.
if (J->Universe_heap_base != NULL) {
uint32_t cklass;
err = read_compressed_pointer(J, methodOopPtr + OFFSET_oopDesc_metadata,
&cklass);
// decode heap oop, same as oop.inline.hpp
klass = (uint64_t)((uintptr_t)J->Universe_heap_base +
((uintptr_t)cklass << 3));
} else {
err = read_pointer(J, methodOopPtr + OFFSET_oopDesc_metadata, &klass);
}
if (err != PS_OK) goto fail;
return klass == J->Universe_methodKlassObj;