236 } _space[NUM_SHARED_MAPS]; // was _space[CompactingPermGenGen::n_regions]; |
236 } _space[NUM_SHARED_MAPS]; // was _space[CompactingPermGenGen::n_regions]; |
237 |
237 |
238 // Ignore the rest of the FileMapHeader. We don't need those fields here. |
238 // Ignore the rest of the FileMapHeader. We don't need those fields here. |
239 }; |
239 }; |
240 |
240 |
241 static bool read_int(struct ps_prochandle* ph, uintptr_t addr, int* pvalue) { |
241 static bool read_jboolean(struct ps_prochandle* ph, uintptr_t addr, jboolean* pvalue) { |
242 int i; |
242 jboolean i; |
243 if (ps_pdread(ph, (psaddr_t) addr, &i, sizeof(i)) == PS_OK) { |
243 if (ps_pdread(ph, (psaddr_t) addr, &i, sizeof(i)) == PS_OK) { |
244 *pvalue = i; |
244 *pvalue = i; |
245 return true; |
245 return true; |
246 } else { |
246 } else { |
247 return false; |
247 return false; |
293 struct FileMapHeader header; |
293 struct FileMapHeader header; |
294 size_t n = 0; |
294 size_t n = 0; |
295 int fd = -1, m = 0; |
295 int fd = -1, m = 0; |
296 uintptr_t base = 0, useSharedSpacesAddr = 0; |
296 uintptr_t base = 0, useSharedSpacesAddr = 0; |
297 uintptr_t sharedArchivePathAddrAddr = 0, sharedArchivePathAddr = 0; |
297 uintptr_t sharedArchivePathAddrAddr = 0, sharedArchivePathAddr = 0; |
298 int useSharedSpaces = 0; |
298 jboolean useSharedSpaces = 0; |
299 map_info* mi = 0; |
299 map_info* mi = 0; |
300 |
300 |
301 memset(classes_jsa, 0, sizeof(classes_jsa)); |
301 memset(classes_jsa, 0, sizeof(classes_jsa)); |
302 jvm_name = lib->name; |
302 jvm_name = lib->name; |
303 useSharedSpacesAddr = lookup_symbol(ph, jvm_name, USE_SHARED_SPACES_SYM); |
303 useSharedSpacesAddr = lookup_symbol(ph, jvm_name, USE_SHARED_SPACES_SYM); |
304 if (useSharedSpacesAddr == 0) { |
304 if (useSharedSpacesAddr == 0) { |
305 print_debug("can't lookup 'UseSharedSpaces' flag\n"); |
305 print_debug("can't lookup 'UseSharedSpaces' flag\n"); |
306 return false; |
306 return false; |
307 } |
307 } |
308 |
308 |
309 if (read_int(ph, useSharedSpacesAddr, &useSharedSpaces) != true) { |
309 // Hotspot vm types are not exported to build this library. So |
|
310 // using equivalent type jboolean to read the value of |
|
311 // UseSharedSpaces which is same as hotspot type "bool". |
|
312 if (read_jboolean(ph, useSharedSpacesAddr, &useSharedSpaces) != true) { |
310 print_debug("can't read the value of 'UseSharedSpaces' flag\n"); |
313 print_debug("can't read the value of 'UseSharedSpaces' flag\n"); |
311 return false; |
314 return false; |
312 } |
315 } |
313 |
316 |
314 if (useSharedSpaces == 0) { |
317 if ((int)useSharedSpaces == 0) { |
315 print_debug("UseSharedSpaces is false, assuming -Xshare:off!\n"); |
318 print_debug("UseSharedSpaces is false, assuming -Xshare:off!\n"); |
316 return true; |
319 return true; |
317 } |
320 } |
318 |
321 |
319 sharedArchivePathAddrAddr = lookup_symbol(ph, jvm_name, SHARED_ARCHIVE_PATH_SYM); |
322 sharedArchivePathAddrAddr = lookup_symbol(ph, jvm_name, SHARED_ARCHIVE_PATH_SYM); |