public String toString()

in core/src/main/java/org/adoptopenjdk/jitwatch/model/assembly/AssemblyInstruction.java [238:325]


	public String toString(int annoWidth, int line, boolean useLocalLabels)
	{
		StringBuilder builder = new StringBuilder();

		builder.append(StringUtil.alignLeft(annotation, annoWidth));

		if (useLocalLabels)
		{
			labels.formatAddress(address, builder);
		}
		else
		{
			builder.append(S_HEX_PREFIX).append(StringUtil.pad(Long.toHexString(address), 16, '0', true));
		}

		builder.append(C_COLON).append(C_SPACE);

		if (!prefixes.isEmpty())
		{
			for (String prefix : prefixes)
			{
				builder.append(prefix);
				builder.append(C_SPACE);
			}
		}

		if (hexaCode.isEmpty())
		{
			builder.append(mnemonic);
		}
		else
		{
			builder.append(hexaCode);
		}

		if (useLocalLabels)
		{
			labels.formatOperands(this, builder);
		}
		else
		{
			if (operands.size() > 0)
			{
				builder.append(C_SPACE);

				for (String op : operands)
				{
					builder.append(op).append(S_COMMA);
				}

				builder.deleteCharAt(builder.length() - 1);
			}
		}

		int lineLength = builder.length();

		if (commentLines.size() > 0)
		{
			String comment = commentLines.get(line);

			if (line == 0)
			{
				// first comment on same line as instruction
				builder.append(S_DOUBLE_SPACE).append(comment);
			}
			else
			{
				// later comments on own line
				builder.delete(0, builder.length());
				builder.append(StringUtil.repeat(C_SPACE, lineLength + 2));
				builder.append(comment);
			}

			if (comment.contains(S_SAFEPOINT_POLL) || comment.contains(S_SAFEPOINT_POLL_RETURN))
			{
				builder.append(" *** SAFEPOINT POLL ***");
			}

			builder.append(S_NEWLINE);

		}
		else
		{
			builder.append(S_NEWLINE);
		}

		return StringUtil.rtrim(builder.toString());
	}