Mercurial > hg > truffle
comparison src/os/solaris/dtrace/libjvm_db.c @ 113:ba764ed4b6f2
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv
Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author | coleenp |
---|---|
date | Sun, 13 Apr 2008 17:43:42 -0400 |
parents | a61af66fc99e |
children | d1605aabd0a1 |
comparison
equal
deleted
inserted
replaced
110:a49a647afe9a | 113:ba764ed4b6f2 |
---|---|
146 uint64_t BufferBlob_vtbl; | 146 uint64_t BufferBlob_vtbl; |
147 uint64_t RuntimeStub_vtbl; | 147 uint64_t RuntimeStub_vtbl; |
148 | 148 |
149 uint64_t Universe_methodKlassObj_address; | 149 uint64_t Universe_methodKlassObj_address; |
150 uint64_t CodeCache_heap_address; | 150 uint64_t CodeCache_heap_address; |
151 uint64_t Universe_heap_base_address; | |
151 | 152 |
152 /* Volatiles */ | 153 /* Volatiles */ |
153 uint64_t Universe_methodKlassObj; | 154 uint64_t Universe_methodKlassObj; |
155 uint64_t Universe_heap_base; | |
154 uint64_t CodeCache_low; | 156 uint64_t CodeCache_low; |
155 uint64_t CodeCache_high; | 157 uint64_t CodeCache_high; |
156 uint64_t CodeCache_segmap_low; | 158 uint64_t CodeCache_segmap_low; |
157 uint64_t CodeCache_segmap_high; | 159 uint64_t CodeCache_segmap_high; |
158 | 160 |
163 | 165 |
164 Nmethod_t *N; /*Inlined methods support */ | 166 Nmethod_t *N; /*Inlined methods support */ |
165 Frame_t prev_fr; | 167 Frame_t prev_fr; |
166 Frame_t curr_fr; | 168 Frame_t curr_fr; |
167 }; | 169 }; |
168 | |
169 | 170 |
170 static int | 171 static int |
171 read_string(struct ps_prochandle *P, | 172 read_string(struct ps_prochandle *P, |
172 char *buf, /* caller's buffer */ | 173 char *buf, /* caller's buffer */ |
173 size_t size, /* upper limit on bytes to read */ | 174 size_t size, /* upper limit on bytes to read */ |
183 buf += 1; | 184 buf += 1; |
184 } | 185 } |
185 return -1; | 186 return -1; |
186 } | 187 } |
187 | 188 |
189 static int read_compressed_pointer(jvm_agent_t* J, uint64_t base, uint32_t *ptr) { | |
190 int err = -1; | |
191 uint32_t ptr32; | |
192 err = ps_pread(J->P, base, &ptr32, sizeof(uint32_t)); | |
193 *ptr = ptr32; | |
194 return err; | |
195 } | |
196 | |
188 static int read_pointer(jvm_agent_t* J, uint64_t base, uint64_t* ptr) { | 197 static int read_pointer(jvm_agent_t* J, uint64_t base, uint64_t* ptr) { |
189 int err = -1; | 198 int err = -1; |
190 uint32_t ptr32; | 199 uint32_t ptr32; |
191 | 200 |
192 switch (DATA_MODEL) { | 201 switch (DATA_MODEL) { |
268 } | 277 } |
269 } else if (vmp->typeName[0] == 'U' && strcmp("Universe", vmp->typeName) == 0) { | 278 } else if (vmp->typeName[0] == 'U' && strcmp("Universe", vmp->typeName) == 0) { |
270 if (strcmp("_methodKlassObj", vmp->fieldName) == 0) { | 279 if (strcmp("_methodKlassObj", vmp->fieldName) == 0) { |
271 J->Universe_methodKlassObj_address = vmp->address; | 280 J->Universe_methodKlassObj_address = vmp->address; |
272 } | 281 } |
282 if (strcmp("_heap_base", vmp->fieldName) == 0) { | |
283 J->Universe_heap_base_address = vmp->address; | |
284 } | |
273 } | 285 } |
274 CHECK_FAIL(err); | 286 CHECK_FAIL(err); |
275 | 287 |
276 base += SIZE_VMStructEntry; | 288 base += SIZE_VMStructEntry; |
277 if (vmp->typeName != NULL) free((void*)vmp->typeName); | 289 if (vmp->typeName != NULL) free((void*)vmp->typeName); |
289 static int read_volatiles(jvm_agent_t* J) { | 301 static int read_volatiles(jvm_agent_t* J) { |
290 uint64_t ptr; | 302 uint64_t ptr; |
291 int err; | 303 int err; |
292 | 304 |
293 err = read_pointer(J, J->Universe_methodKlassObj_address, &J->Universe_methodKlassObj); | 305 err = read_pointer(J, J->Universe_methodKlassObj_address, &J->Universe_methodKlassObj); |
306 CHECK_FAIL(err); | |
307 err = read_pointer(J, J->Universe_heap_base_address, &J->Universe_heap_base); | |
294 CHECK_FAIL(err); | 308 CHECK_FAIL(err); |
295 err = read_pointer(J, J->CodeCache_heap_address + OFFSET_CodeHeap_memory + | 309 err = read_pointer(J, J->CodeCache_heap_address + OFFSET_CodeHeap_memory + |
296 OFFSET_VirtualSpace_low, &J->CodeCache_low); | 310 OFFSET_VirtualSpace_low, &J->CodeCache_low); |
297 CHECK_FAIL(err); | 311 CHECK_FAIL(err); |
298 err = read_pointer(J, J->CodeCache_heap_address + OFFSET_CodeHeap_memory + | 312 err = read_pointer(J, J->CodeCache_heap_address + OFFSET_CodeHeap_memory + |
442 } | 456 } |
443 | 457 |
444 static int is_methodOop(jvm_agent_t* J, uint64_t methodOopPtr) { | 458 static int is_methodOop(jvm_agent_t* J, uint64_t methodOopPtr) { |
445 uint64_t klass; | 459 uint64_t klass; |
446 int err; | 460 int err; |
447 err = read_pointer(J, methodOopPtr + OFFSET_oopDesc_klass, &klass); | 461 // If heap_base is nonnull, this was a compressed oop. |
462 if (J->Universe_heap_base != NULL) { | |
463 uint32_t cklass; | |
464 err = read_compressed_pointer(J, methodOopPtr + OFFSET_oopDesc_metadata, | |
465 &cklass); | |
466 // decode heap oop, same as oop.inline.hpp | |
467 klass = (uint64_t)((uintptr_t)J->Universe_heap_base + | |
468 ((uintptr_t)cklass << 3)); | |
469 } else { | |
470 err = read_pointer(J, methodOopPtr + OFFSET_oopDesc_metadata, &klass); | |
471 } | |
448 if (err != PS_OK) goto fail; | 472 if (err != PS_OK) goto fail; |
449 return klass == J->Universe_methodKlassObj; | 473 return klass == J->Universe_methodKlassObj; |
450 | 474 |
451 fail: | 475 fail: |
452 return 0; | 476 return 0; |