Top Description Fields Constructors Methods
jdk.vm.ci.hotspot

pack-priv final Class HotSpotSpeculationEncoding

extends ByteArrayOutputStream
implements SpeculationReasonEncoding
Class Inheritance
All Implemented Interfaces
jdk.vm.ci.meta.SpeculationLog.SpeculationReasonEncoding
Imports
java.io.ByteArrayOutputStream, .DataOutputStream, .IOException, java.security.MessageDigest, .NoSuchAlgorithmException, java.util.Arrays, jdk.vm.ci.common.JVMCIError, jdk.vm.ci.meta.ResolvedJavaMethod, .ResolvedJavaType, .SpeculationLog.SpeculationReasonEncoding

Implements a SpeculationReasonEncoding that produces a byte array. Data is added via a DataOutputStream. When producing the final byte array, if the total length of data exceeds 31, then a SHA-1 digest of the data is produced instead.

Field Summary

Modifier and TypeField and Description
private DataOutputStream
pack-priv static final int
LENGTH_BITS

Number of bits used for the length of an encoded speculation.

pack-priv static final int
pack-priv static final int
MAX_LENGTH

The maximum length of an encoded speculation.

private static final int
private static final int
private static final int
private byte[]
private static final MessageDigest
SHA1

Prototype SHA1 digest.

private static final boolean
SHA1_IS_CLONEABLE

Cloning the prototype is quicker than calling MessageDigest#getInstance(String) every time.

private static final int
Inherited from java.io.ByteArrayOutputStream:
bufcount

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
public void
private boolean
addNull(Object o, int nullValue)

public void
public void
public void
private void
pack-priv byte[]
getByteArray()

Gets the final encoded byte array and closes this encoding such that any further attempts to update it result in an IllegalArgumentException.

Inherited from java.io.ByteArrayOutputStream:
closeresetsizetoByteArraytoStringtoStringtoStringtoStringwritewritewriteByteswriteTo

Field Detail

dosback to summary
private DataOutputStream dos
LENGTH_BITSback to summary
pack-priv static final int LENGTH_BITS

Number of bits used for the length of an encoded speculation. The bit size of 5 is chosen to accommodate specifying // the length of a SHA-1 digest (i.e., 20 bytes).

LENGTH_MASKback to summary
pack-priv static final int LENGTH_MASK
MAX_LENGTHback to summary
pack-priv static final int MAX_LENGTH

The maximum length of an encoded speculation.

NULL_METHODback to summary
private static final int NULL_METHOD
NULL_STRINGback to summary
private static final int NULL_STRING
NULL_TYPEback to summary
private static final int NULL_TYPE
resultback to summary
private byte[] result
SHA1back to summary
private static final MessageDigest SHA1

Prototype SHA1 digest.

SHA1_IS_CLONEABLEback to summary
private static final boolean SHA1_IS_CLONEABLE

Cloning the prototype is quicker than calling MessageDigest#getInstance(String) every time.

SHA1_LENGTHback to summary
private static final int SHA1_LENGTH

Constructor Detail

HotSpotSpeculationEncodingback to summary
pack-priv HotSpotSpeculationEncoding()

Method Detail

addByteback to summary
public void addByte(int value)

Implements jdk.vm.ci.meta.SpeculationLog.SpeculationReasonEncoding.addByte.

Annotations
@Override
addIntback to summary
public void addInt(int value)

Implements jdk.vm.ci.meta.SpeculationLog.SpeculationReasonEncoding.addInt.

Annotations
@Override
addLongback to summary
public void addLong(long value)

Implements jdk.vm.ci.meta.SpeculationLog.SpeculationReasonEncoding.addLong.

Annotations
@Override
addMethodback to summary
public void addMethod(ResolvedJavaMethod method)

Implements jdk.vm.ci.meta.SpeculationLog.SpeculationReasonEncoding.addMethod.

Annotations
@Override
addNullback to summary
private boolean addNull(Object o, int nullValue)
addShortback to summary
public void addShort(int value)

Implements jdk.vm.ci.meta.SpeculationLog.SpeculationReasonEncoding.addShort.

Annotations
@Override
addStringback to summary
public void addString(String value)

Implements jdk.vm.ci.meta.SpeculationLog.SpeculationReasonEncoding.addString.

Annotations
@Override
addTypeback to summary
public void addType(ResolvedJavaType type)

Implements jdk.vm.ci.meta.SpeculationLog.SpeculationReasonEncoding.addType.

Annotations
@Override
checkOpenback to summary
private void checkOpen()
getByteArrayback to summary
pack-priv byte[] getByteArray()

Gets the final encoded byte array and closes this encoding such that any further attempts to update it result in an IllegalArgumentException.