546
547 if (longConstantEntryArrayStride == 0L) {
548 throw new RuntimeException("zero stride: cannot read types.");
549 }
550
551 // Fetch the address of the VMLongConstantEntry*
552 Address entryAddr = lookupInProcess("gHotSpotVMLongConstants");
553 // Dereference this once to get the pointer to the first VMLongConstantEntry
554 entryAddr = entryAddr.getAddressAt(0);
555 if (entryAddr == null) {
556 throw new RuntimeException("gHotSpotVMLongConstants was not initialized properly in the remote process; can not continue");
557 }
558
559 // Start iterating down it until we find an entry with no name
560 Address nameAddr = null;
561 do {
562 // Fetch the type name first
563 nameAddr = entryAddr.getAddressAt(longConstantEntryNameOffset);
564 if (nameAddr != null) {
565 String name = CStringUtilities.getString(nameAddr);
566 int value = (int) entryAddr.getCIntegerAt(longConstantEntryValueOffset, C_INT64_SIZE, true);
567
568 // Be a little resilient
569 Long oldValue = lookupLongConstant(name, false);
570 if (oldValue == null) {
571 addLongConstant(name, value);
572 } else {
573 if (oldValue.longValue() != value) {
574 throw new RuntimeException("Error: the long constant \"" + name +
575 "\" had its value redefined (old was " + oldValue +
576 ", new is " + value + ". Aborting.");
577 } else {
578 System.err.println("Warning: the long constant \"" + name + "\" (declared in the remote VM in VMStructs::localHotSpotVMLongConstants) " +
579 "had its value declared as " + value + " twice. Continuing.");
580 duplicateDefCount++;
581 }
582 }
583 }
584
585 entryAddr = entryAddr.addOffsetTo(longConstantEntryArrayStride);
586 } while (nameAddr != null && duplicateDefCount < MAX_DUPLICATE_DEFINITIONS);
|
546
547 if (longConstantEntryArrayStride == 0L) {
548 throw new RuntimeException("zero stride: cannot read types.");
549 }
550
551 // Fetch the address of the VMLongConstantEntry*
552 Address entryAddr = lookupInProcess("gHotSpotVMLongConstants");
553 // Dereference this once to get the pointer to the first VMLongConstantEntry
554 entryAddr = entryAddr.getAddressAt(0);
555 if (entryAddr == null) {
556 throw new RuntimeException("gHotSpotVMLongConstants was not initialized properly in the remote process; can not continue");
557 }
558
559 // Start iterating down it until we find an entry with no name
560 Address nameAddr = null;
561 do {
562 // Fetch the type name first
563 nameAddr = entryAddr.getAddressAt(longConstantEntryNameOffset);
564 if (nameAddr != null) {
565 String name = CStringUtilities.getString(nameAddr);
566 long value = entryAddr.getCIntegerAt(longConstantEntryValueOffset, C_INT64_SIZE, true);
567
568 // Be a little resilient
569 Long oldValue = lookupLongConstant(name, false);
570 if (oldValue == null) {
571 addLongConstant(name, value);
572 } else {
573 if (oldValue.longValue() != value) {
574 throw new RuntimeException("Error: the long constant \"" + name +
575 "\" had its value redefined (old was " + oldValue +
576 ", new is " + value + ". Aborting.");
577 } else {
578 System.err.println("Warning: the long constant \"" + name + "\" (declared in the remote VM in VMStructs::localHotSpotVMLongConstants) " +
579 "had its value declared as " + value + " twice. Continuing.");
580 duplicateDefCount++;
581 }
582 }
583 }
584
585 entryAddr = entryAddr.addOffsetTo(longConstantEntryArrayStride);
586 } while (nameAddr != null && duplicateDefCount < MAX_DUPLICATE_DEFINITIONS);
|