public void addConstString(ArrayList<Instruction> instructions, short reg, String string) { short register = getRegister(instructions, reg, false, true); StringIdItem stringIdItem = ic.prepareStringIdItem(string); if (stringIdItem.getIndex() > 0xFFFF) { instructions.add( new Instruction31c(Opcode.CONST_STRING_JUMBO, register, stringIdItem).setInject()); // 256 } else { instructions.add( new Instruction21c(Opcode.CONST_STRING, register, stringIdItem).setInject()); // 256 } restoreRegister(instructions, reg, false, true); }
protected static void writeStartLocal( IndentingWriter writer, CodeItem codeItem, int register, StringIdItem name, TypeIdItem type, StringIdItem signature) throws IOException { writer.write(".local "); RegisterFormatter.writeTo(writer, codeItem, register); writer.write(", "); writer.write(name.getStringValue()); writer.write(':'); writer.write(type.getTypeDescriptor()); if (signature != null) { writer.write(",\""); writer.write(signature.getStringValue()); writer.write('"'); } }
public void caseStringConstant(StringConstant s) { StringIdItem referencedString = StringIdItem.internStringIdItem(stmtV.getBelongingFile(), s.value); stmtV.addInsn(new Insn21c(Opcode.CONST_STRING, destinationReg, referencedString)); }