src/os/solaris/dtrace/libjvm_db.c

changeset 548
ba764ed4b6f2
parent 435
a61af66fc99e
child 631
d1605aabd0a1
     1.1 --- a/src/os/solaris/dtrace/libjvm_db.c	Fri Apr 11 09:56:35 2008 -0400
     1.2 +++ b/src/os/solaris/dtrace/libjvm_db.c	Sun Apr 13 17:43:42 2008 -0400
     1.3 @@ -148,9 +148,11 @@
     1.4  
     1.5    uint64_t Universe_methodKlassObj_address;
     1.6    uint64_t CodeCache_heap_address;
     1.7 +  uint64_t Universe_heap_base_address;
     1.8  
     1.9    /* Volatiles */
    1.10    uint64_t Universe_methodKlassObj;
    1.11 +  uint64_t Universe_heap_base;
    1.12    uint64_t CodeCache_low;
    1.13    uint64_t CodeCache_high;
    1.14    uint64_t CodeCache_segmap_low;
    1.15 @@ -166,7 +168,6 @@
    1.16    Frame_t   curr_fr;
    1.17  };
    1.18  
    1.19 -
    1.20  static int
    1.21  read_string(struct ps_prochandle *P,
    1.22          char *buf,              /* caller's buffer */
    1.23 @@ -185,6 +186,14 @@
    1.24    return -1;
    1.25  }
    1.26  
    1.27 +static int read_compressed_pointer(jvm_agent_t* J, uint64_t base, uint32_t *ptr) {
    1.28 +  int err = -1;
    1.29 +  uint32_t ptr32;
    1.30 +  err = ps_pread(J->P, base, &ptr32, sizeof(uint32_t));
    1.31 +  *ptr = ptr32;
    1.32 +  return err;
    1.33 +}
    1.34 +
    1.35  static int read_pointer(jvm_agent_t* J, uint64_t base, uint64_t* ptr) {
    1.36    int err = -1;
    1.37    uint32_t ptr32;
    1.38 @@ -270,6 +279,9 @@
    1.39        if (strcmp("_methodKlassObj", vmp->fieldName) == 0) {
    1.40          J->Universe_methodKlassObj_address = vmp->address;
    1.41        }
    1.42 +      if (strcmp("_heap_base", vmp->fieldName) == 0) {
    1.43 +        J->Universe_heap_base_address = vmp->address;
    1.44 +      }
    1.45      }
    1.46      CHECK_FAIL(err);
    1.47  
    1.48 @@ -292,6 +304,8 @@
    1.49  
    1.50    err = read_pointer(J, J->Universe_methodKlassObj_address, &J->Universe_methodKlassObj);
    1.51    CHECK_FAIL(err);
    1.52 +  err = read_pointer(J, J->Universe_heap_base_address, &J->Universe_heap_base);
    1.53 +  CHECK_FAIL(err);
    1.54    err = read_pointer(J, J->CodeCache_heap_address + OFFSET_CodeHeap_memory +
    1.55                       OFFSET_VirtualSpace_low, &J->CodeCache_low);
    1.56    CHECK_FAIL(err);
    1.57 @@ -444,7 +458,17 @@
    1.58  static int is_methodOop(jvm_agent_t* J, uint64_t methodOopPtr) {
    1.59    uint64_t klass;
    1.60    int err;
    1.61 -  err = read_pointer(J, methodOopPtr + OFFSET_oopDesc_klass, &klass);
    1.62 +  // If heap_base is nonnull, this was a compressed oop.
    1.63 +  if (J->Universe_heap_base != NULL) {
    1.64 +    uint32_t cklass;
    1.65 +    err = read_compressed_pointer(J, methodOopPtr + OFFSET_oopDesc_metadata,
    1.66 +          &cklass);
    1.67 +    // decode heap oop, same as oop.inline.hpp
    1.68 +    klass = (uint64_t)((uintptr_t)J->Universe_heap_base +
    1.69 +            ((uintptr_t)cklass << 3));
    1.70 +  } else {
    1.71 +    err = read_pointer(J, methodOopPtr + OFFSET_oopDesc_metadata, &klass);
    1.72 +  }
    1.73    if (err != PS_OK) goto fail;
    1.74    return klass == J->Universe_methodKlassObj;
    1.75  

mercurial