--- old/hotspot/src/os/solaris/dtrace/libjvm_db.c 2009-08-01 04:08:46.884462435 +0100 +++ new/hotspot/src/os/solaris/dtrace/libjvm_db.c 2009-08-01 04:08:46.798136049 +0100 @@ -2,7 +2,7 @@ #pragma ident "@(#)libjvm_db.c 1.29 07/05/05 17:04:38 JVM" #endif /* - * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2003-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -151,9 +151,11 @@ 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; @@ -169,7 +171,6 @@ Frame_t curr_fr; }; - static int read_string(struct ps_prochandle *P, char *buf, /* caller's buffer */ @@ -188,6 +189,14 @@ 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; @@ -273,6 +282,9 @@ 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); @@ -295,6 +307,8 @@ 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); @@ -447,7 +461,17 @@ 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;