40 final HotSpotVMConfig config;
41
42 protected HotSpotMethodDataAccessor(HotSpotMethodData.VMState state, int tag, int staticSize) {
43 this.state = state;
44 this.config = state.config;
45 this.tag = tag;
46 this.staticSize = staticSize;
47 }
48
49 /**
50 * Returns the tag stored in the LayoutData header.
51 *
52 * @return tag stored in the LayoutData header
53 */
54 int getTag() {
55 return tag;
56 }
57
58 static int readTag(HotSpotVMConfig config, HotSpotMethodData data, int position) {
59 final int tag = data.readUnsignedByte(position, config.dataLayoutTagOffset);
60 assert tag >= config.dataLayoutNoTag && tag <= config.dataLayoutSpeculativeTrapDataTag : "profile data tag out of bounds: " + tag;
61 return tag;
62 }
63
64 /**
65 * Returns the BCI stored in the LayoutData header.
66 *
67 * @return an integer between 0 and {@link Short#MAX_VALUE} inclusive, or -1 if not supported
68 */
69 int getBCI(HotSpotMethodData data, int position) {
70 return data.readUnsignedShort(position, config.dataLayoutBCIOffset);
71 }
72
73 /**
74 * Computes the size for the specific data at the given position.
75 *
76 * @return a value greater than 0
77 */
78 final int getSize(HotSpotMethodData data, int position) {
79 int size = staticSize + getDynamicSize(data, position);
80 // Sanity check against VM
|
40 final HotSpotVMConfig config;
41
42 protected HotSpotMethodDataAccessor(HotSpotMethodData.VMState state, int tag, int staticSize) {
43 this.state = state;
44 this.config = state.config;
45 this.tag = tag;
46 this.staticSize = staticSize;
47 }
48
49 /**
50 * Returns the tag stored in the LayoutData header.
51 *
52 * @return tag stored in the LayoutData header
53 */
54 int getTag() {
55 return tag;
56 }
57
58 static int readTag(HotSpotVMConfig config, HotSpotMethodData data, int position) {
59 final int tag = data.readUnsignedByte(position, config.dataLayoutTagOffset);
60 assert tag >= config.dataLayoutNoTag && tag <= config.dataLayoutACmpDataTag : "profile data tag out of bounds: " + tag;
61 return tag;
62 }
63
64 /**
65 * Returns the BCI stored in the LayoutData header.
66 *
67 * @return an integer between 0 and {@link Short#MAX_VALUE} inclusive, or -1 if not supported
68 */
69 int getBCI(HotSpotMethodData data, int position) {
70 return data.readUnsignedShort(position, config.dataLayoutBCIOffset);
71 }
72
73 /**
74 * Computes the size for the specific data at the given position.
75 *
76 * @return a value greater than 0
77 */
78 final int getSize(HotSpotMethodData data, int position) {
79 int size = staticSize + getDynamicSize(data, position);
80 // Sanity check against VM
|