8275075: Remove unnecessary conversion to String in jdk.hotspot.agent

Reviewed-by: sspitsyn, cjplummer
This commit is contained in:
Andrey Turbanov 2021-10-13 09:07:07 +00:00 committed by Serguei Spitsyn
parent c3b75c6cdf
commit dcf428c7a7
4 changed files with 13 additions and 14 deletions

View File

@ -951,8 +951,8 @@ public class HSDB implements ObjectHistogramPanel.Listener, SAListener {
SignalInfo sigInfo = (SignalInfo) interruptedFrameMap.get(curFrame);
if (sigInfo != null) {
// This frame took a signal and we need to report it.
anno = (anno + "\n*** INTERRUPTED BY SIGNAL " + Integer.toString(sigInfo.sigNum) +
" (" + sigInfo.sigName + ")");
anno = anno + "\n*** INTERRUPTED BY SIGNAL " + sigInfo.sigNum +
" (" + sigInfo.sigName + ")";
}
JavaVFrame nextVFrame = curVFrame;

View File

@ -147,13 +147,13 @@ public class BytecodeLoadConstant extends Bytecode {
int cpIndex = poolIndex();
ConstantTag ctag = cpool.getTagAt(cpIndex);
if (ctag.isInt()) {
return "<int " + Integer.toString(cpool.getIntAt(cpIndex)) +">";
return "<int " + cpool.getIntAt(cpIndex) +">";
} else if (ctag.isLong()) {
return "<long " + Long.toString(cpool.getLongAt(cpIndex)) + "L>";
return "<long " + cpool.getLongAt(cpIndex) + "L>";
} else if (ctag.isFloat()) {
return "<float " + Float.toString(cpool.getFloatAt(cpIndex)) + "F>";
return "<float " + cpool.getFloatAt(cpIndex) + "F>";
} else if (ctag.isDouble()) {
return "<double " + Double.toString(cpool.getDoubleAt(cpIndex)) + "D>";
return "<double " + cpool.getDoubleAt(cpIndex) + "D>";
} else if (ctag.isString()) {
// tag change from 'unresolved' to 'string' does not happen atomically.
// We just look at the object at the corresponding index and
@ -178,8 +178,8 @@ public class BytecodeLoadConstant extends Bytecode {
Oop x = getCachedConstant();
int refidx = cpool.getMethodHandleIndexAt(cpIndex);
int refkind = cpool.getMethodHandleRefKindAt(cpIndex);
return "<MethodHandle kind=" + Integer.toString(refkind) +
" ref=" + Integer.toString(refidx)
return "<MethodHandle kind=" + refkind +
" ref=" + refidx
+ (x == null ? "" : " @" + x.getHandle()) + ">";
} else if (ctag.isMethodType()) {
Oop x = getCachedConstant();

View File

@ -25,7 +25,6 @@
package sun.jvm.hotspot.runtime;
import java.nio.charset.StandardCharsets;
import java.util.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.types.*;
@ -333,7 +332,7 @@ public class PerfDataEntry extends VMObject {
if (dataType == BasicType.getTBoolean()) {
str = Boolean.toString(booleanValue());
} else if (dataType == BasicType.getTChar()) {
str = "'" + Character.toString(charValue()) + "'";
str = "'" + charValue() + "'";
} else if (dataType == BasicType.getTByte()) {
str = Byte.toString(byteValue());
} else if (dataType == BasicType.getTShort()) {

View File

@ -675,9 +675,9 @@ public class HTMLGenerator implements /* imports */ ClassConstants {
buf.beginTag("tr");
if (hasLineNumbers) {
int lineNumber = method.getLineNumberFromBCI(curBci);
buf.cell(Integer.toString(lineNumber) + spaces);
buf.cell(lineNumber + spaces);
}
buf.cell(Integer.toString(curBci) + spaces);
buf.cell(curBci + spaces);
buf.beginTag("td");
String instrStr = null;
@ -983,7 +983,7 @@ public class HTMLGenerator implements /* imports */ ClassConstants {
public void epilogue() {
}
};
}
protected String genHTMLForRawDisassembly(sun.jvm.hotspot.debugger.Address addr,
int size,
@ -1007,7 +1007,7 @@ public class HTMLGenerator implements /* imports */ ClassConstants {
Formatter tmpBuf = new Formatter(genHTML);
long startPc = addressToLong(addr);
tmpBuf.append("0x");
tmpBuf.append(Long.toHexString(startPc + visitor.getInstructionSize()).toString());
tmpBuf.append(Long.toHexString(startPc + visitor.getInstructionSize()));
tmpBuf.append(",0x");
tmpBuf.append(Long.toHexString(startPc));
if (prevPCs != null) {