This commit is contained in:
J. Duke 2017-09-04 11:04:26 +02:00
commit e1303706b5
20 changed files with 452 additions and 378 deletions

View File

@ -445,3 +445,4 @@ b803e6cff41e72a1e6d8782e1ef7c25a6e3e5ee3 jdk-10+19
d2982a786f53814367698e63efe6349c9128e1db jdk-9+180 d2982a786f53814367698e63efe6349c9128e1db jdk-9+180
b656dea9398ef601f7fc08d1a5157a560e0ccbe0 jdk-9+181 b656dea9398ef601f7fc08d1a5157a560e0ccbe0 jdk-9+181
682e2a6df836f4731f92eb2ddcd467075047f6ea jdk-10+20 682e2a6df836f4731f92eb2ddcd467075047f6ea jdk-10+20
90cdfe56f1543267a8005e638bd1b44551fda189 jdk-10+21

View File

@ -1046,7 +1046,7 @@ AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
# Set some additional per-CPU defines. # Set some additional per-CPU defines.
if test "x$OPENJDK_$1_OS-$OPENJDK_$1_CPU" = xwindows-x86; then if test "x$OPENJDK_$1_OS-$OPENJDK_$1_CPU" = xwindows-x86; then
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -arch:IA32" $2JVM_CFLAGS="[$]$2JVM_CFLAGS -arch:IA32"
elif test "x$OPENJDK_$1_CPU" = xsparcv9; then elif test "x$OPENJDK_$1_OS-$OPENJDK_$1_CPU" = xsolaris-sparcv9; then
$2JVM_CFLAGS="[$]$2JVM_CFLAGS -xarch=sparc" $2JVM_CFLAGS="[$]$2JVM_CFLAGS -xarch=sparc"
elif test "x$OPENJDK_$1_CPU" = xppc64; then elif test "x$OPENJDK_$1_CPU" = xppc64; then
if test "x$OPENJDK_$1_OS" = xlinux; then if test "x$OPENJDK_$1_OS" = xlinux; then
@ -1358,7 +1358,7 @@ $2LDFLAGS_JDKLIB="${$2LDFLAGS_JDKLIB} ${$2JAVA_BASE_LDFLAGS}"
$2SOLARIS_LIBM_LIBS="/usr/lib/sparcv9/libm.so.1" $2SOLARIS_LIBM_LIBS="/usr/lib/sparcv9/libm.so.1"
fi fi
$2JVM_LIBS="[$]$2JVM_LIBS -lsocket -lsched -ldl $SOLARIS_LIBM_LIBS -lCrun \ $2JVM_LIBS="[$]$2JVM_LIBS -lsocket -lsched -ldl $SOLARIS_LIBM_LIBS -lCrun \
-lthread -ldoor -lc -ldemangle -lnsl -lkstat -lrt" -lthread -ldoor -lc -ldemangle -lnsl -lrt"
elif test "x$OPENJDK_$1_OS" = xmacosx; then elif test "x$OPENJDK_$1_OS" = xmacosx; then
$2JVM_LIBS="[$]$2JVM_LIBS -lm" $2JVM_LIBS="[$]$2JVM_LIBS -lm"
elif test "x$OPENJDK_$1_OS" = xaix; then elif test "x$OPENJDK_$1_OS" = xaix; then

View File

@ -5151,7 +5151,7 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE #CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks: # Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1503411624 DATE_WHEN_GENERATED=1504187184
############################################################################### ###############################################################################
# #
@ -15719,6 +15719,12 @@ test -n "$target_alias" &&
VAR_CPU_BITS=32 VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little VAR_CPU_ENDIAN=little
;; ;;
alpha*)
VAR_CPU=alpha
VAR_CPU_ARCH=alpha
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
arm*) arm*)
VAR_CPU=arm VAR_CPU=arm
VAR_CPU_ARCH=arm VAR_CPU_ARCH=arm
@ -15731,6 +15737,36 @@ test -n "$target_alias" &&
VAR_CPU_BITS=64 VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little VAR_CPU_ENDIAN=little
;; ;;
m68k)
VAR_CPU=m68k
VAR_CPU_ARCH=m68k
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
;;
mips)
VAR_CPU=mips
VAR_CPU_ARCH=mips
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
;;
mipsel)
VAR_CPU=mipsel
VAR_CPU_ARCH=mipsel
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
mips64)
VAR_CPU=mips64
VAR_CPU_ARCH=mips64
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big
;;
mips64el)
VAR_CPU=mips64el
VAR_CPU_ARCH=mips64el
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
powerpc) powerpc)
VAR_CPU=ppc VAR_CPU=ppc
VAR_CPU_ARCH=ppc VAR_CPU_ARCH=ppc
@ -15761,6 +15797,18 @@ test -n "$target_alias" &&
VAR_CPU_BITS=64 VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big VAR_CPU_ENDIAN=big
;; ;;
sh*eb)
VAR_CPU=sh
VAR_CPU_ARCH=sh
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
;;
sh*)
VAR_CPU=sh
VAR_CPU_ARCH=sh
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
sparc) sparc)
VAR_CPU=sparc VAR_CPU=sparc
VAR_CPU_ARCH=sparc VAR_CPU_ARCH=sparc
@ -15858,6 +15906,12 @@ $as_echo "$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" >&6; }
VAR_CPU_BITS=32 VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little VAR_CPU_ENDIAN=little
;; ;;
alpha*)
VAR_CPU=alpha
VAR_CPU_ARCH=alpha
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
arm*) arm*)
VAR_CPU=arm VAR_CPU=arm
VAR_CPU_ARCH=arm VAR_CPU_ARCH=arm
@ -15870,6 +15924,36 @@ $as_echo "$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" >&6; }
VAR_CPU_BITS=64 VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little VAR_CPU_ENDIAN=little
;; ;;
m68k)
VAR_CPU=m68k
VAR_CPU_ARCH=m68k
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
;;
mips)
VAR_CPU=mips
VAR_CPU_ARCH=mips
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
;;
mipsel)
VAR_CPU=mipsel
VAR_CPU_ARCH=mipsel
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
mips64)
VAR_CPU=mips64
VAR_CPU_ARCH=mips64
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big
;;
mips64el)
VAR_CPU=mips64el
VAR_CPU_ARCH=mips64el
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
powerpc) powerpc)
VAR_CPU=ppc VAR_CPU=ppc
VAR_CPU_ARCH=ppc VAR_CPU_ARCH=ppc
@ -15900,6 +15984,18 @@ $as_echo "$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" >&6; }
VAR_CPU_BITS=64 VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big VAR_CPU_ENDIAN=big
;; ;;
sh*eb)
VAR_CPU=sh
VAR_CPU_ARCH=sh
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
;;
sh*)
VAR_CPU=sh
VAR_CPU_ARCH=sh
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
sparc) sparc)
VAR_CPU=sparc VAR_CPU=sparc
VAR_CPU_ARCH=sparc VAR_CPU_ARCH=sparc
@ -16045,6 +16141,12 @@ $as_echo "$COMPILE_TYPE" >&6; }
elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then elif test "x$OPENJDK_TARGET_OS" != xmacosx && test "x$OPENJDK_TARGET_CPU" = xx86_64; then
# On all platforms except MacOSX replace x86_64 with amd64. # On all platforms except MacOSX replace x86_64 with amd64.
OPENJDK_TARGET_CPU_LEGACY="amd64" OPENJDK_TARGET_CPU_LEGACY="amd64"
elif test "x$OPENJDK_TARGET_CPU" = xalpha; then
# Avoid name collisions with variables named alpha
OPENJDK_TARGET_CPU_LEGACY="_alpha_"
elif test "x$OPENJDK_TARGET_CPU" = xsh; then
# Avoid name collisions with variables named sh
OPENJDK_TARGET_CPU_LEGACY="_sh_"
fi fi
@ -16197,6 +16299,12 @@ $as_echo "$COMPILE_TYPE" >&6; }
elif test "x$OPENJDK_BUILD_OS" != xmacosx && test "x$OPENJDK_BUILD_CPU" = xx86_64; then elif test "x$OPENJDK_BUILD_OS" != xmacosx && test "x$OPENJDK_BUILD_CPU" = xx86_64; then
# On all platforms except MacOSX replace x86_64 with amd64. # On all platforms except MacOSX replace x86_64 with amd64.
OPENJDK_BUILD_CPU_LEGACY="amd64" OPENJDK_BUILD_CPU_LEGACY="amd64"
elif test "x$OPENJDK_BUILD_CPU" = xalpha; then
# Avoid name collisions with variables named alpha
OPENJDK_BUILD_CPU_LEGACY="_alpha_"
elif test "x$OPENJDK_BUILD_CPU" = xsh; then
# Avoid name collisions with variables named sh
OPENJDK_BUILD_CPU_LEGACY="_sh_"
fi fi
@ -51563,7 +51671,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
# Set some additional per-CPU defines. # Set some additional per-CPU defines.
if test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = xwindows-x86; then if test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = xwindows-x86; then
JVM_CFLAGS="$JVM_CFLAGS -arch:IA32" JVM_CFLAGS="$JVM_CFLAGS -arch:IA32"
elif test "x$OPENJDK_TARGET_CPU" = xsparcv9; then elif test "x$OPENJDK_TARGET_OS-$OPENJDK_TARGET_CPU" = xsolaris-sparcv9; then
JVM_CFLAGS="$JVM_CFLAGS -xarch=sparc" JVM_CFLAGS="$JVM_CFLAGS -xarch=sparc"
elif test "x$OPENJDK_TARGET_CPU" = xppc64; then elif test "x$OPENJDK_TARGET_CPU" = xppc64; then
if test "x$OPENJDK_TARGET_OS" = xlinux; then if test "x$OPENJDK_TARGET_OS" = xlinux; then
@ -51968,7 +52076,7 @@ LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} ${JAVA_BASE_LDFLAGS}"
SOLARIS_LIBM_LIBS="/usr/lib/sparcv9/libm.so.1" SOLARIS_LIBM_LIBS="/usr/lib/sparcv9/libm.so.1"
fi fi
JVM_LIBS="$JVM_LIBS -lsocket -lsched -ldl $SOLARIS_LIBM_LIBS -lCrun \ JVM_LIBS="$JVM_LIBS -lsocket -lsched -ldl $SOLARIS_LIBM_LIBS -lCrun \
-lthread -ldoor -lc -ldemangle -lnsl -lkstat -lrt" -lthread -ldoor -lc -ldemangle -lnsl -lrt"
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
JVM_LIBS="$JVM_LIBS -lm" JVM_LIBS="$JVM_LIBS -lm"
elif test "x$OPENJDK_TARGET_OS" = xaix; then elif test "x$OPENJDK_TARGET_OS" = xaix; then
@ -52442,7 +52550,7 @@ $as_echo "$as_me: GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLA
# Set some additional per-CPU defines. # Set some additional per-CPU defines.
if test "x$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" = xwindows-x86; then if test "x$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" = xwindows-x86; then
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -arch:IA32" OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -arch:IA32"
elif test "x$OPENJDK_BUILD_CPU" = xsparcv9; then elif test "x$OPENJDK_BUILD_OS-$OPENJDK_BUILD_CPU" = xsolaris-sparcv9; then
OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -xarch=sparc" OPENJDK_BUILD_JVM_CFLAGS="$OPENJDK_BUILD_JVM_CFLAGS -xarch=sparc"
elif test "x$OPENJDK_BUILD_CPU" = xppc64; then elif test "x$OPENJDK_BUILD_CPU" = xppc64; then
if test "x$OPENJDK_BUILD_OS" = xlinux; then if test "x$OPENJDK_BUILD_OS" = xlinux; then
@ -52847,7 +52955,7 @@ OPENJDK_BUILD_LDFLAGS_JDKLIB="${OPENJDK_BUILD_LDFLAGS_JDKLIB} ${OPENJDK_BUILD_JA
OPENJDK_BUILD_SOLARIS_LIBM_LIBS="/usr/lib/sparcv9/libm.so.1" OPENJDK_BUILD_SOLARIS_LIBM_LIBS="/usr/lib/sparcv9/libm.so.1"
fi fi
OPENJDK_BUILD_JVM_LIBS="$OPENJDK_BUILD_JVM_LIBS -lsocket -lsched -ldl $SOLARIS_LIBM_LIBS -lCrun \ OPENJDK_BUILD_JVM_LIBS="$OPENJDK_BUILD_JVM_LIBS -lsocket -lsched -ldl $SOLARIS_LIBM_LIBS -lCrun \
-lthread -ldoor -lc -ldemangle -lnsl -lkstat -lrt" -lthread -ldoor -lc -ldemangle -lnsl -lrt"
elif test "x$OPENJDK_BUILD_OS" = xmacosx; then elif test "x$OPENJDK_BUILD_OS" = xmacosx; then
OPENJDK_BUILD_JVM_LIBS="$OPENJDK_BUILD_JVM_LIBS -lm" OPENJDK_BUILD_JVM_LIBS="$OPENJDK_BUILD_JVM_LIBS -lm"
elif test "x$OPENJDK_BUILD_OS" = xaix; then elif test "x$OPENJDK_BUILD_OS" = xaix; then

View File

@ -42,6 +42,12 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
VAR_CPU_BITS=32 VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little VAR_CPU_ENDIAN=little
;; ;;
alpha*)
VAR_CPU=alpha
VAR_CPU_ARCH=alpha
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
arm*) arm*)
VAR_CPU=arm VAR_CPU=arm
VAR_CPU_ARCH=arm VAR_CPU_ARCH=arm
@ -54,6 +60,36 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
VAR_CPU_BITS=64 VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little VAR_CPU_ENDIAN=little
;; ;;
m68k)
VAR_CPU=m68k
VAR_CPU_ARCH=m68k
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
;;
mips)
VAR_CPU=mips
VAR_CPU_ARCH=mips
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
;;
mipsel)
VAR_CPU=mipsel
VAR_CPU_ARCH=mipsel
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
mips64)
VAR_CPU=mips64
VAR_CPU_ARCH=mips64
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big
;;
mips64el)
VAR_CPU=mips64el
VAR_CPU_ARCH=mips64el
VAR_CPU_BITS=64
VAR_CPU_ENDIAN=little
;;
powerpc) powerpc)
VAR_CPU=ppc VAR_CPU=ppc
VAR_CPU_ARCH=ppc VAR_CPU_ARCH=ppc
@ -84,6 +120,18 @@ AC_DEFUN([PLATFORM_EXTRACT_VARS_FROM_CPU],
VAR_CPU_BITS=64 VAR_CPU_BITS=64
VAR_CPU_ENDIAN=big VAR_CPU_ENDIAN=big
;; ;;
sh*eb)
VAR_CPU=sh
VAR_CPU_ARCH=sh
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=big
;;
sh*)
VAR_CPU=sh
VAR_CPU_ARCH=sh
VAR_CPU_BITS=32
VAR_CPU_ENDIAN=little
;;
sparc) sparc)
VAR_CPU=sparc VAR_CPU=sparc
VAR_CPU_ARCH=sparc VAR_CPU_ARCH=sparc
@ -289,6 +337,12 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then elif test "x$OPENJDK_$1_OS" != xmacosx && test "x$OPENJDK_$1_CPU" = xx86_64; then
# On all platforms except MacOSX replace x86_64 with amd64. # On all platforms except MacOSX replace x86_64 with amd64.
OPENJDK_$1_CPU_LEGACY="amd64" OPENJDK_$1_CPU_LEGACY="amd64"
elif test "x$OPENJDK_$1_CPU" = xalpha; then
# Avoid name collisions with variables named alpha
OPENJDK_$1_CPU_LEGACY="_alpha_"
elif test "x$OPENJDK_$1_CPU" = xsh; then
# Avoid name collisions with variables named sh
OPENJDK_$1_CPU_LEGACY="_sh_"
fi fi
AC_SUBST(OPENJDK_$1_CPU_LEGACY) AC_SUBST(OPENJDK_$1_CPU_LEGACY)

View File

@ -200,7 +200,7 @@ var getJibProfiles = function (input) {
data.configuration_make_arg = "CONF_NAME="; data.configuration_make_arg = "CONF_NAME=";
// Exclude list to use when Jib creates a source bundle // Exclude list to use when Jib creates a source bundle
data.src_bundle_excludes = "./build webrev .hg */.hg */*/.hg */*/*/.hg"; data.src_bundle_excludes = "./build webrev* */webrev* */*/webrev* */*/*/webrev* .hg */.hg */*/.hg */*/*/.hg";
// Include list to use when creating a minimal jib source bundle which // Include list to use when creating a minimal jib source bundle which
// contains just the jib configuration files. // contains just the jib configuration files.
data.conf_bundle_includes = "*/conf/jib-profiles.* common/autoconf/version-numbers" data.conf_bundle_includes = "*/conf/jib-profiles.* common/autoconf/version-numbers"

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -47,9 +47,9 @@ package jdk.test.lib.hprof.model;
public class HackJavaValue extends JavaValue { public class HackJavaValue extends JavaValue {
private String value; private String value;
private int size; private long size;
public HackJavaValue(String value, int size) { public HackJavaValue(String value, long size) {
this.value = value; this.value = value;
this.size = size; this.size = size;
} }
@ -58,7 +58,8 @@ public class HackJavaValue extends JavaValue {
return value; return value;
} }
public int getSize() { @Override
public long getSize() {
return size; return size;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -403,7 +403,8 @@ public class JavaClass extends JavaHeapObject {
/** /**
* @return the size of this object * @return the size of this object
*/ */
public int getSize() { @Override
public long getSize() {
JavaClass cl = mySnapshot.getJavaLangClass(); JavaClass cl = mySnapshot.getJavaLangClass();
if (cl == null) { if (cl == null) {
return 0; return 0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -64,7 +64,7 @@ public abstract class JavaHeapObject extends JavaThing {
private int referersLen = 0; // -1 when resolved private int referersLen = 0; // -1 when resolved
public abstract JavaClass getClazz(); public abstract JavaClass getClazz();
public abstract int getSize(); public abstract long getSize();
public abstract long getId(); public abstract long getId();
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -47,7 +47,8 @@ public abstract class JavaLazyReadObject extends JavaHeapObject {
this.offset = offset; this.offset = offset;
} }
public final int getSize() { @Override
public final long getSize() {
return getValueLength() + getClazz().getMinimumObjectSize(); return getValueLength() + getClazz().getMinimumObjectSize();
} }
@ -55,8 +56,16 @@ public abstract class JavaLazyReadObject extends JavaHeapObject {
return offset; return offset;
} }
protected ReadBuffer buf() {
return getClazz().getReadBuffer();
}
protected int idSize() {
return getClazz().getIdentifierSize();
}
// return the length of the data for this object // return the length of the data for this object
protected final int getValueLength() { protected final long getValueLength() {
try { try {
return readValueLength(); return readValueLength();
} catch (IOException exp) { } catch (IOException exp) {
@ -67,25 +76,23 @@ public abstract class JavaLazyReadObject extends JavaHeapObject {
} }
// get this object's content as byte array // get this object's content as byte array
protected final byte[] getValue() { protected final JavaThing[] getValue() {
try { try {
return readValue(); return readValue();
} catch (IOException exp) { } catch (IOException exp) {
System.err.println("lazy read failed at offset " + offset); System.err.println("lazy read failed at offset " + offset);
exp.printStackTrace(); exp.printStackTrace();
return Snapshot.EMPTY_BYTE_ARRAY; return Snapshot.EMPTY_JAVATHING_ARRAY;
} }
} }
// get ID of this object // get ID of this object
public final long getId() { public final long getId() {
try { try {
ReadBuffer buf = getClazz().getReadBuffer(); if (idSize() == 4) {
int idSize = getClazz().getIdentifierSize(); return ((long)buf().getInt(offset)) & Snapshot.SMALL_ID_MASK;
if (idSize == 4) {
return ((long)buf.getInt(offset)) & Snapshot.SMALL_ID_MASK;
} else { } else {
return buf.getLong(offset); return buf().getLong(offset);
} }
} catch (IOException exp) { } catch (IOException exp) {
System.err.println("lazy read failed at offset " + offset); System.err.println("lazy read failed at offset " + offset);
@ -94,8 +101,8 @@ public abstract class JavaLazyReadObject extends JavaHeapObject {
} }
} }
protected abstract int readValueLength() throws IOException; protected abstract long readValueLength() throws IOException;
protected abstract byte[] readValue() throws IOException; protected abstract JavaThing[] readValue() throws IOException;
// make Integer or Long for given object ID // make Integer or Long for given object ID
protected static Number makeId(long id) { protected static Number makeId(long id) {
@ -116,61 +123,46 @@ public abstract class JavaLazyReadObject extends JavaHeapObject {
} }
// read object ID from given index from given byte array // read object ID from given index from given byte array
protected final long objectIdAt(int index, byte[] data) { protected final long objectIdAt(long offset) throws IOException {
int idSize = getClazz().getIdentifierSize(); if (idSize() == 4) {
if (idSize == 4) { return ((long)intAt(offset)) & Snapshot.SMALL_ID_MASK;
return ((long)intAt(index, data)) & Snapshot.SMALL_ID_MASK;
} else { } else {
return longAt(index, data); return longAt(offset);
} }
} }
// utility methods to read primitive types from byte array // utility methods to read primitive types from byte array
protected static byte byteAt(int index, byte[] value) { protected byte byteAt(long offset) throws IOException {
return value[index]; return buf().getByte(offset);
} }
protected static boolean booleanAt(int index, byte[] value) { protected boolean booleanAt(long offset) throws IOException {
return (value[index] & 0xff) == 0? false: true; return byteAt(offset) == 0 ? false : true;
} }
protected static char charAt(int index, byte[] value) { protected char charAt(long offset) throws IOException {
int b1 = ((int) value[index++] & 0xff); return buf().getChar(offset);
int b2 = ((int) value[index++] & 0xff);
return (char) ((b1 << 8) + b2);
} }
protected static short shortAt(int index, byte[] value) { protected short shortAt(long offset) throws IOException {
int b1 = ((int) value[index++] & 0xff); return buf().getShort(offset);
int b2 = ((int) value[index++] & 0xff);
return (short) ((b1 << 8) + b2);
} }
protected static int intAt(int index, byte[] value) { protected int intAt(long offset) throws IOException {
int b1 = ((int) value[index++] & 0xff); return buf().getInt(offset);
int b2 = ((int) value[index++] & 0xff);
int b3 = ((int) value[index++] & 0xff);
int b4 = ((int) value[index++] & 0xff);
return ((b1 << 24) + (b2 << 16) + (b3 << 8) + b4);
} }
protected static long longAt(int index, byte[] value) { protected long longAt(long offset) throws IOException {
long val = 0; return buf().getLong(offset);
for (int j = 0; j < 8; j++) {
val = val << 8;
int b = ((int)value[index++]) & 0xff;
val |= b;
}
return val;
} }
protected static float floatAt(int index, byte[] value) { protected float floatAt(long offset) throws IOException {
int val = intAt(index, value); int val = intAt(offset);
return Float.intBitsToFloat(val); return Float.intBitsToFloat(val);
} }
protected static double doubleAt(int index, byte[] value) { protected double doubleAt(long offset) throws IOException {
long val = longAt(index, value); long val = longAt(offset);
return Double.longBitsToDouble(val); return Double.longBitsToDouble(val);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -86,7 +86,7 @@ public class JavaObject extends JavaLazyReadObject {
// while resolving, parse fields in verbose mode. // while resolving, parse fields in verbose mode.
// but, getFields calls parseFields in non-verbose mode // but, getFields calls parseFields in non-verbose mode
// to avoid printing warnings repeatedly. // to avoid printing warnings repeatedly.
parseFields(getValue(), true); parseFields(true);
cl.addInstance(this); cl.addInstance(this);
super.resolve(snapshot); super.resolve(snapshot);
@ -114,7 +114,7 @@ public class JavaObject extends JavaLazyReadObject {
public JavaThing[] getFields() { public JavaThing[] getFields() {
// pass false to verbose mode so that dereference // pass false to verbose mode so that dereference
// warnings are not printed. // warnings are not printed.
return parseFields(getValue(), false); return parseFields(false);
} }
// returns the value of field of given name // returns the value of field of given name
@ -212,35 +212,27 @@ public class JavaObject extends JavaLazyReadObject {
* data length (int) * data length (int)
* byte[length] * byte[length]
*/ */
protected final int readValueLength() throws IOException { @Override
JavaClass cl = getClazz(); protected final long readValueLength() throws IOException {
int idSize = cl.getIdentifierSize(); long lengthOffset = getOffset() + 2 * idSize() + 4;
long lengthOffset = getOffset() + 2*idSize + 4; return buf().getInt(lengthOffset);
return cl.getReadBuffer().getInt(lengthOffset);
} }
protected final byte[] readValue() throws IOException { @Override
JavaClass cl = getClazz(); protected final JavaThing[] readValue() throws IOException {
int idSize = cl.getIdentifierSize(); return parseFields(false);
ReadBuffer buf = cl.getReadBuffer();
long offset = getOffset() + 2*idSize + 4;
int length = buf.getInt(offset);
if (length == 0) {
return Snapshot.EMPTY_BYTE_ARRAY;
} else {
byte[] res = new byte[length];
buf.get(offset + 4, res);
return res;
}
} }
private JavaThing[] parseFields(byte[] data, boolean verbose) { private long dataStartOffset() {
return getOffset() + idSize() + 4 + idSize() + 4;
}
private JavaThing[] parseFields(boolean verbose) {
JavaClass cl = getClazz(); JavaClass cl = getClazz();
int target = cl.getNumFieldsForInstance(); int target = cl.getNumFieldsForInstance();
JavaField[] fields = cl.getFields(); JavaField[] fields = cl.getFields();
JavaThing[] fieldValues = new JavaThing[target]; JavaThing[] fieldValues = new JavaThing[target];
Snapshot snapshot = cl.getSnapshot(); Snapshot snapshot = cl.getSnapshot();
int idSize = snapshot.getIdentifierSize();
int fieldNo = 0; int fieldNo = 0;
// In the dump file, the fields are stored in this order: // In the dump file, the fields are stored in this order:
// fields of most derived class (immediate class) are stored // fields of most derived class (immediate class) are stored
@ -254,7 +246,7 @@ public class JavaObject extends JavaLazyReadObject {
// starts with the top of the inheritance hierarchy and works down. // starts with the top of the inheritance hierarchy and works down.
target -= fields.length; target -= fields.length;
JavaClass currClass = cl; JavaClass currClass = cl;
int index = 0; long offset = dataStartOffset();
for (int i = 0; i < fieldValues.length; i++, fieldNo++) { for (int i = 0; i < fieldValues.length; i++, fieldNo++) {
while (fieldNo >= fields.length) { while (fieldNo >= fields.length) {
currClass = currClass.getSuperclass(); currClass = currClass.getSuperclass();
@ -264,65 +256,72 @@ public class JavaObject extends JavaLazyReadObject {
} }
JavaField f = fields[fieldNo]; JavaField f = fields[fieldNo];
char sig = f.getSignature().charAt(0); char sig = f.getSignature().charAt(0);
switch (sig) { try {
case 'L': switch (sig) {
case '[': { case 'L':
long id = objectIdAt(index, data); case '[': {
index += idSize; long id = objectIdAt(offset);
JavaObjectRef ref = new JavaObjectRef(id); offset += idSize();
fieldValues[target+fieldNo] = ref.dereference(snapshot, f, verbose); JavaObjectRef ref = new JavaObjectRef(id);
break; fieldValues[target+fieldNo] = ref.dereference(snapshot, f, verbose);
break;
}
case 'Z': {
byte value = byteAt(offset);
offset++;
fieldValues[target+fieldNo] = new JavaBoolean(value != 0);
break;
}
case 'B': {
byte value = byteAt(offset);
offset++;
fieldValues[target+fieldNo] = new JavaByte(value);
break;
}
case 'S': {
short value = shortAt(offset);
offset += 2;
fieldValues[target+fieldNo] = new JavaShort(value);
break;
}
case 'C': {
char value = charAt(offset);
offset += 2;
fieldValues[target+fieldNo] = new JavaChar(value);
break;
}
case 'I': {
int value = intAt(offset);
offset += 4;
fieldValues[target+fieldNo] = new JavaInt(value);
break;
}
case 'J': {
long value = longAt(offset);
offset += 8;
fieldValues[target+fieldNo] = new JavaLong(value);
break;
}
case 'F': {
float value = floatAt(offset);
offset += 4;
fieldValues[target+fieldNo] = new JavaFloat(value);
break;
}
case 'D': {
double value = doubleAt(offset);
offset += 8;
fieldValues[target+fieldNo] = new JavaDouble(value);
break;
}
default:
throw new RuntimeException("invalid signature: " + sig);
} }
case 'Z': { } catch (IOException exp) {
byte value = byteAt(index, data); System.err.println("lazy read failed at offset " + offset);
index++; exp.printStackTrace();
fieldValues[target+fieldNo] = new JavaBoolean(value != 0); return Snapshot.EMPTY_JAVATHING_ARRAY;
break;
}
case 'B': {
byte value = byteAt(index, data);
index++;
fieldValues[target+fieldNo] = new JavaByte(value);
break;
}
case 'S': {
short value = shortAt(index, data);
index += 2;
fieldValues[target+fieldNo] = new JavaShort(value);
break;
}
case 'C': {
char value = charAt(index, data);
index += 2;
fieldValues[target+fieldNo] = new JavaChar(value);
break;
}
case 'I': {
int value = intAt(index, data);
index += 4;
fieldValues[target+fieldNo] = new JavaInt(value);
break;
}
case 'J': {
long value = longAt(index, data);
index += 8;
fieldValues[target+fieldNo] = new JavaLong(value);
break;
}
case 'F': {
float value = floatAt(index, data);
index += 4;
fieldValues[target+fieldNo] = new JavaFloat(value);
break;
}
case 'D': {
double value = doubleAt(index, data);
index += 8;
fieldValues[target+fieldNo] = new JavaDouble(value);
break;
}
default:
throw new RuntimeException("invalid signature: " + sig);
} }
} }
return fieldValues; return fieldValues;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -87,18 +87,7 @@ public class JavaObjectArray extends JavaLazyReadObject {
} }
public JavaThing[] getElements() { public JavaThing[] getElements() {
Snapshot snapshot = getClazz().getSnapshot(); return getValue();
byte[] data = getValue();
final int idSize = snapshot.getIdentifierSize();
final int numElements = data.length / idSize;
JavaThing[] elements = new JavaThing[numElements];
int index = 0;
for (int i = 0; i < elements.length; i++) {
long id = objectIdAt(index, data);
index += idSize;
elements[i] = snapshot.findThing(id);
}
return elements;
} }
public int compareTo(JavaThing other) { public int compareTo(JavaThing other) {
@ -109,7 +98,7 @@ public class JavaObjectArray extends JavaLazyReadObject {
} }
public int getLength() { public int getLength() {
return getValueLength() / getClazz().getIdentifierSize(); return (int)(getValueLength() / idSize());
} }
public void visitReferencedObjects(JavaHeapObjectVisitor v) { public void visitReferencedObjects(JavaHeapObjectVisitor v) {
@ -146,27 +135,31 @@ public class JavaObjectArray extends JavaLazyReadObject {
* array class ID * array class ID
* array element IDs * array element IDs
*/ */
protected final int readValueLength() throws IOException { @Override
JavaClass cl = getClazz(); protected final long readValueLength() throws IOException {
ReadBuffer buf = cl.getReadBuffer(); long offset = getOffset() + idSize() + 4;
int idSize = cl.getIdentifierSize(); // length of the array in elements
long offset = getOffset() + idSize + 4; long len = buf().getInt(offset);
int len = buf.getInt(offset); // byte length of array
return len * cl.getIdentifierSize(); return len * idSize();
}
private long dataStartOffset() {
return getOffset() + idSize() + 4 + 4 + idSize();
} }
protected final byte[] readValue() throws IOException { @Override
JavaClass cl = getClazz(); protected final JavaThing[] readValue() throws IOException {
ReadBuffer buf = cl.getReadBuffer(); Snapshot snapshot = getClazz().getSnapshot();
int idSize = cl.getIdentifierSize(); int len = getLength();
long offset = getOffset() + idSize + 4; long offset = dataStartOffset();
int len = buf.getInt(offset);
if (len == 0) { JavaThing[] res = new JavaThing[len];
return Snapshot.EMPTY_BYTE_ARRAY; for (int i = 0; i < len; i++) {
} else { long id = objectIdAt(offset);
byte[] res = new byte[len * idSize]; res[i] = snapshot.findThing(id);
buf.get(offset + 4 + idSize, res); offset += idSize();
return res; }
} return res;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -87,7 +87,8 @@ public class JavaObjectRef extends JavaThing {
return result; return result;
} }
public int getSize() { @Override
public long getSize() {
return 0; return 0;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -81,7 +81,7 @@ public abstract class JavaThing {
/** /**
* @return the size of this object, in bytes, including VM overhead * @return the size of this object, in bytes, including VM overhead
*/ */
abstract public int getSize(); abstract public long getSize();
/** /**
* @return a human-readable string representation of this thing * @return a human-readable string representation of this thing

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,8 @@ public abstract class JavaValue extends JavaThing {
abstract public String toString(); abstract public String toString();
public int getSize() { @Override
public long getSize() {
// The size of a value is already accounted for in the class // The size of a value is already accounted for in the class
// that has the data member. // that has the data member.
return 0; return 0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -91,38 +91,92 @@ public class JavaValueArray extends JavaLazyReadObject
* *
* object ID * object ID
* stack trace serial number (int) * stack trace serial number (int)
* length of the instance data (int) * number of elements (int)
* element type (byte) * element type (byte)
* array data * array data
*/ */
protected final int readValueLength() throws IOException { @Override
JavaClass cl = getClazz(); protected final long readValueLength() throws IOException {
ReadBuffer buf = cl.getReadBuffer(); long offset = getOffset() + idSize() + 4;
int idSize = cl.getIdentifierSize(); // length of the array in elements
long offset = getOffset() + idSize + 4; long len = buf().getInt(offset);
// length of the array // byte length of array
int len = buf.getInt(offset); return len * elementSize(getElementType());
// typecode of array element type
byte type = buf.getByte(offset + 4);
return len * elementSize(type);
} }
protected final byte[] readValue() throws IOException { private long dataStartOffset() {
JavaClass cl = getClazz(); return getOffset() + idSize() + 4 + 4 + 1;
ReadBuffer buf = cl.getReadBuffer(); }
int idSize = cl.getIdentifierSize();
long offset = getOffset() + idSize + 4;
// length of the array @Override
int length = buf.getInt(offset); protected final JavaThing[] readValue() throws IOException {
// typecode of array element type int len = getLength();
byte type = buf.getByte(offset + 4); long offset = dataStartOffset();
if (length == 0) {
return Snapshot.EMPTY_BYTE_ARRAY; JavaThing[] res = new JavaThing[len];
} else { synchronized (buf()) {
length *= elementSize(type); switch (getElementType()) {
byte[] res = new byte[length]; case 'Z': {
buf.get(offset + 5, res); for (int i = 0; i < len; i++) {
return res; res[i] = new JavaBoolean(booleanAt(offset));
offset += 1;
}
return res;
}
case 'B': {
for (int i = 0; i < len; i++) {
res[i] = new JavaByte(byteAt(offset));
offset += 1;
}
return res;
}
case 'C': {
for (int i = 0; i < len; i++) {
res[i] = new JavaChar(charAt(offset));
offset += 2;
}
return res;
}
case 'S': {
for (int i = 0; i < len; i++) {
res[i] = new JavaShort(shortAt(offset));
offset += 2;
}
return res;
}
case 'I': {
for (int i = 0; i < len; i++) {
res[i] = new JavaInt(intAt(offset));
offset += 4;
}
return res;
}
case 'J': {
for (int i = 0; i < len; i++) {
res[i] = new JavaLong(longAt(offset));
offset += 8;
}
return res;
}
case 'F': {
for (int i = 0; i < len; i++) {
res[i] = new JavaFloat(floatAt(offset));
offset += 4;
}
return res;
}
case 'D': {
for (int i = 0; i < len; i++) {
res[i] = new JavaDouble(doubleAt(offset));
offset += 8;
}
return res;
}
default: {
throw new RuntimeException("unknown primitive type?");
}
}
} }
} }
@ -197,83 +251,11 @@ public class JavaValueArray extends JavaLazyReadObject
} }
data |= (divider << LENGTH_DIVIDER_SHIFT); data |= (divider << LENGTH_DIVIDER_SHIFT);
} }
return (getValueLength() / divider); return (int)(getValueLength() / divider);
} }
public Object getElements() { public JavaThing[] getElements() {
final int len = getLength(); return getValue();
final byte et = getElementType();
byte[] data = getValue();
int index = 0;
switch (et) {
case 'Z': {
boolean[] res = new boolean[len];
for (int i = 0; i < len; i++) {
res[i] = booleanAt(index, data);
index++;
}
return res;
}
case 'B': {
byte[] res = new byte[len];
for (int i = 0; i < len; i++) {
res[i] = byteAt(index, data);
index++;
}
return res;
}
case 'C': {
char[] res = new char[len];
for (int i = 0; i < len; i++) {
res[i] = charAt(index, data);
index += 2;
}
return res;
}
case 'S': {
short[] res = new short[len];
for (int i = 0; i < len; i++) {
res[i] = shortAt(index, data);
index += 2;
}
return res;
}
case 'I': {
int[] res = new int[len];
for (int i = 0; i < len; i++) {
res[i] = intAt(index, data);
index += 4;
}
return res;
}
case 'J': {
long[] res = new long[len];
for (int i = 0; i < len; i++) {
res[i] = longAt(index, data);
index += 8;
}
return res;
}
case 'F': {
float[] res = new float[len];
for (int i = 0; i < len; i++) {
res[i] = floatAt(index, data);
index += 4;
}
return res;
}
case 'D': {
double[] res = new double[len];
for (int i = 0; i < len; i++) {
res[i] = doubleAt(index, data);
index += 8;
}
return res;
}
default: {
throw new RuntimeException("unknown primitive type?");
}
}
} }
public byte getElementType() { public byte getElementType() {
@ -292,54 +274,6 @@ public class JavaValueArray extends JavaLazyReadObject
} }
} }
public boolean getBooleanAt(int index) {
checkIndex(index);
requireType('Z');
return booleanAt(index, getValue());
}
public byte getByteAt(int index) {
checkIndex(index);
requireType('B');
return byteAt(index, getValue());
}
public char getCharAt(int index) {
checkIndex(index);
requireType('C');
return charAt(index << 1, getValue());
}
public short getShortAt(int index) {
checkIndex(index);
requireType('S');
return shortAt(index << 1, getValue());
}
public int getIntAt(int index) {
checkIndex(index);
requireType('I');
return intAt(index << 2, getValue());
}
public long getLongAt(int index) {
checkIndex(index);
requireType('J');
return longAt(index << 3, getValue());
}
public float getFloatAt(int index) {
checkIndex(index);
requireType('F');
return floatAt(index << 2, getValue());
}
public double getDoubleAt(int index) {
checkIndex(index);
requireType('D');
return doubleAt(index << 3, getValue());
}
public String valueString() { public String valueString() {
return valueString(true); return valueString(true);
} }
@ -347,15 +281,12 @@ public class JavaValueArray extends JavaLazyReadObject
public String valueString(boolean bigLimit) { public String valueString(boolean bigLimit) {
// Char arrays deserve special treatment // Char arrays deserve special treatment
StringBuilder result; StringBuilder result;
byte[] value = getValue(); JavaThing[] things = getValue();
int max = value.length;
byte elementSignature = getElementType(); byte elementSignature = getElementType();
if (elementSignature == 'C') { if (elementSignature == 'C') {
result = new StringBuilder(); result = new StringBuilder();
for (int i = 0; i < value.length; ) { for (int i = 0; i < things.length; i++) {
char val = charAt(i, value); result.append(things[i]);
result.append(val);
i += 2;
} }
} else { } else {
int limit = 8; int limit = 8;
@ -363,61 +294,52 @@ public class JavaValueArray extends JavaLazyReadObject
limit = 1000; limit = 1000;
} }
result = new StringBuilder("{"); result = new StringBuilder("{");
int num = 0; for (int i = 0; i < things.length; i++) {
for (int i = 0; i < value.length; ) { if (i > 0) {
if (num > 0) {
result.append(", "); result.append(", ");
} }
if (num >= limit) { if (i >= limit) {
result.append("... "); result.append("... ");
break; break;
} }
num++;
switch (elementSignature) { switch (elementSignature) {
case 'Z': { case 'Z': {
boolean val = booleanAt(i, value); boolean val = ((JavaBoolean)things[i]).value;
if (val) { if (val) {
result.append("true"); result.append("true");
} else { } else {
result.append("false"); result.append("false");
} }
i++;
break; break;
} }
case 'B': { case 'B': {
int val = 0xFF & byteAt(i, value); byte val = ((JavaByte)things[i]).value;
result.append("0x").append(Integer.toString(val, 16)); result.append("0x").append(Integer.toString(val, 16));
i++;
break; break;
} }
case 'S': { case 'S': {
short val = shortAt(i, value); short val = ((JavaShort)things[i]).value;
i += 2;
result.append(val); result.append(val);
break; break;
} }
case 'I': { case 'I': {
int val = intAt(i, value); int val = ((JavaInt)things[i]).value;
i += 4;
result.append(val); result.append(val);
break; break;
} }
case 'J': { // long case 'J': { // long
long val = longAt(i, value); long val = ((JavaLong)things[i]).value;
result.append(val); result.append(val);
i += 8;
break; break;
} }
case 'F': { case 'F': {
float val = floatAt(i, value); float val = ((JavaFloat)things[i]).value;
result.append(val); result.append(val);
i += 4;
break; break;
} }
case 'D': { // double case 'D': { // double
double val = doubleAt(i, value); double val = ((JavaDouble)things[i]).value;
result.append(val); result.append(val);
i += 8;
break; break;
} }
default: { default: {
@ -429,5 +351,4 @@ public class JavaValueArray extends JavaLazyReadObject
} }
return result.toString(); return result.toString();
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -93,9 +93,9 @@ public class ReachableObjects {
public int compare(Object lhs, Object rhs) { public int compare(Object lhs, Object rhs) {
JavaThing left = (JavaThing) lhs; JavaThing left = (JavaThing) lhs;
JavaThing right = (JavaThing) rhs; JavaThing right = (JavaThing) rhs;
int diff = right.getSize() - left.getSize(); long diff = right.getSize() - left.getSize();
if (diff != 0) { if (diff != 0) {
return diff; return Long.signum(diff);
} }
return left.compareTo(right); return left.compareTo(right);
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -52,7 +52,7 @@ import jdk.test.lib.hprof.util.Misc;
public class Snapshot implements AutoCloseable { public class Snapshot implements AutoCloseable {
public static final long SMALL_ID_MASK = 0x0FFFFFFFFL; public static final long SMALL_ID_MASK = 0x0FFFFFFFFL;
public static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; public static final JavaThing[] EMPTY_JAVATHING_ARRAY = new JavaThing[0];
private static final JavaField[] EMPTY_FIELD_ARRAY = new JavaField[0]; private static final JavaField[] EMPTY_FIELD_ARRAY = new JavaField[0];
private static final JavaStatic[] EMPTY_STATIC_ARRAY = new JavaStatic[0]; private static final JavaStatic[] EMPTY_STATIC_ARRAY = new JavaStatic[0];

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -57,26 +57,31 @@ class FileReadBuffer implements ReadBuffer {
file.read(buf); file.read(buf);
} }
@Override
public synchronized char getChar(long pos) throws IOException { public synchronized char getChar(long pos) throws IOException {
seek(pos); seek(pos);
return file.readChar(); return file.readChar();
} }
@Override
public synchronized byte getByte(long pos) throws IOException { public synchronized byte getByte(long pos) throws IOException {
seek(pos); seek(pos);
return (byte) file.read(); return (byte) file.read();
} }
@Override
public synchronized short getShort(long pos) throws IOException { public synchronized short getShort(long pos) throws IOException {
seek(pos); seek(pos);
return file.readShort(); return file.readShort();
} }
@Override
public synchronized int getInt(long pos) throws IOException { public synchronized int getInt(long pos) throws IOException {
seek(pos); seek(pos);
return file.readInt(); return file.readInt();
} }
@Override
public synchronized long getLong(long pos) throws IOException { public synchronized long getLong(long pos) throws IOException {
seek(pos); seek(pos);
return file.readLong(); return file.readLong();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -98,31 +98,31 @@ class MappedReadBuffer implements ReadBuffer {
buf.position((int)pos); buf.position((int)pos);
} }
public synchronized void get(long pos, byte[] res) throws IOException { @Override
seek(pos);
buf.get(res);
}
public synchronized char getChar(long pos) throws IOException { public synchronized char getChar(long pos) throws IOException {
seek(pos); seek(pos);
return buf.getChar(); return buf.getChar();
} }
@Override
public synchronized byte getByte(long pos) throws IOException { public synchronized byte getByte(long pos) throws IOException {
seek(pos); seek(pos);
return buf.get(); return buf.get();
} }
@Override
public synchronized short getShort(long pos) throws IOException { public synchronized short getShort(long pos) throws IOException {
seek(pos); seek(pos);
return buf.getShort(); return buf.getShort();
} }
@Override
public synchronized int getInt(long pos) throws IOException { public synchronized int getInt(long pos) throws IOException {
seek(pos); seek(pos);
return buf.getInt(); return buf.getInt();
} }
@Override
public synchronized long getLong(long pos) throws IOException { public synchronized long getLong(long pos) throws IOException {
seek(pos); seek(pos);
return buf.getLong(); return buf.getLong();

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -40,9 +40,6 @@ import java.io.IOException;
* @author A. Sundararajan * @author A. Sundararajan
*/ */
public interface ReadBuffer extends AutoCloseable { public interface ReadBuffer extends AutoCloseable {
// read methods - only byte array and int primitive types.
// read position has to be specified always.
public void get(long pos, byte[] buf) throws IOException;
public char getChar(long pos) throws IOException; public char getChar(long pos) throws IOException;
public byte getByte(long pos) throws IOException; public byte getByte(long pos) throws IOException;
public short getShort(long pos) throws IOException; public short getShort(long pos) throws IOException;