Generate the code to leave on stack the given string even if the string encoding exeeds the
class file limit for single string constant

@param k the constant
161244
public void addPush(String k) {
        int length = k.length();
        int limit = itsConstantPool.getUtfEncodingLimit(k, 0, length);
        if (limit == length) {
            addLoadConstant(k);
            return;
        }
        // Split string into picies fitting the UTF limit and generate code for
        // StringBuilder sb = new StringBuilder(length);
        // sb.append(loadConstant(piece_1));
        // ...
        // sb.append(loadConstant(piece_N));
        // sb.toString();
        final String SB = "java/lang/StringBuilder";
        add(ByteCode.NEW, SB);
        add(ByteCode.DUP);
        addPush(length);
        addInvoke(ByteCode.INVOKESPECIAL, SB, "<init>", "(I)V");
        int cursor = 0;
        for (; ; ) {
            add(ByteCode.DUP);
            String s = k.substring(cursor, limit);
            addLoadConstant(s);
            addInvoke(ByteCode.INVOKEVIRTUAL, SB, "append",
                "(Ljava/lang/String;)Ljava/lang/StringBuilder;");
            add(ByteCode.POP);
            if (limit == length) {
                break;
            }
            cursor = limit;
            limit = itsConstantPool.getUtfEncodingLimit(k, limit, length);
        }
        addInvoke(ByteCode.INVOKEVIRTUAL, SB, "toString",
            "()Ljava/lang/String;");
    }
509943
public synchronized void prepend(String k, String v) {
        grow();
        for (int i = nkeys; i > 0; i--) {
            keys[i] = keys[i-1];
            values[i] = values[i-1];
        }
        keys[0] = k;
        values[0] = v;
        nkeys++;
    }
761625
function(ocap, values, k) {
            var is_ocap = false, str;
            try {
                is_ocap |= ocap.r_attributes['class'] === 'OCref';
                str = ocap[0];
            } catch (e) {};
            if(!is_ocap) {
                try {
                    is_ocap |= ocap.attributes.value[0].value.value[0] === 'OCref';
                    str = ocap.value[0];
                } catch (e) {};
            }
            if (!is_ocap) {
                k(new Error("Expected an ocap, instead got " + ocap), undefined);
                return;
            }
            var params = [str];
            params.push.apply(params, values);
            // determine the proper queue from the OCAP prefix
            var queue = (str.charCodeAt(0) == 64) ? compute_queue : ctrl_queue;
            _cmd(Rserve.Rsrv.CMD_OCcall, _encode_value(params, Rserve.Rsrv.XT_LANG_NOTAG),
                 k, "", queue);
        }
557807
private void _writeString(String text)
        throws IOException, JsonGenerationException
    {
        /* One check first: if String won't fit in the buffer, let's
         * segment writes. No point in extending buffer to huge sizes
         * (like if someone wants to include multi-megabyte base64
         * encoded stuff or such)
         */
        final int len = text.length();
        if (len > _outputEnd) { // Let's reserve space for entity at begin/end
            _writeLongString(text);
            return;
        }

        // Ok: we know String will fit in buffer ok
        // But do we need to flush first?
        if ((_outputTail + len) > _outputEnd) {
            _flushBuffer();
        }
        text.getChars(0, len, _outputBuffer, _outputTail);

        if (_maximumNonEscapedChar != 0) {
            _writeStringASCII(len, _maximumNonEscapedChar);
        } else {
            _writeString2(len);
        }
    }
258154
public void output(K key, V value) throws IOException {
    collector.collect(key, value);
  }
90742
@Override
  public void setHeader(String key, String value)
  {
    int tail;

    if (_headerSize > 0) {
      tail = (_headerValues[_headerSize - 1].offset()
              + _headerValues[_headerSize - 1].length());
    }
    else {
      tail = 0;
    }

    int keyLength = key.length();
    int valueLength = value.length();
    char []headerBuffer = _headerBuffer;
    
    for (int i = keyLength - 1; i >= 0; i--) {
      headerBuffer[tail + i] = key.charAt(i);
    }

    _headerKeys[_headerSize].init(headerBuffer, tail, keyLength);

    tail += keyLength;

    for (int i = valueLength - 1; i >= 0; i--) {
      headerBuffer[tail + i] = value.charAt(i);
    }

    _headerValues[_headerSize].init(headerBuffer, tail, valueLength);
    _headerSize++;
    // XXX: size
  }
899367
public void addLoadConstant(int k) {
        switch (k) {
            case 0:
                add(ByteCode.ICONST_0);
                break;
            case 1:
                add(ByteCode.ICONST_1);
                break;
            case 2:
                add(ByteCode.ICONST_2);
                break;
            case 3:
                add(ByteCode.ICONST_3);
                break;
            case 4:
                add(ByteCode.ICONST_4);
                break;
            case 5:
                add(ByteCode.ICONST_5);
                break;
            default:
                add(ByteCode.LDC, itsConstantPool.addConstant(k));
                break;
        }
    }
854972
public void addNextString(String string)
    {
        int iLength = string.length();
        char charLength = (char)iLength;
        String strNew = m_string + charLength + string;
        m_string = strNew;
    }
29543
@Override
    public void sawOpcode(int seen) {
        if (DEBUG) {
            System.out.println(getPC() + " " + Const.getOpcodeName(seen));
        }
        switch (seen) {
        case Const.IFNE:
        case Const.IFEQ: {
            OpcodeStack.Item top = stack.getStackItem(0);
            if (DEBUG) {
                System.out.println("Stack top: " + top);
            }
            XMethod m = top.getReturnValueOf();
            if (m != null && "java.util.concurrent.ConcurrentHashMap".equals(m.getClassName())
                    && "containsKey".equals(m.getName())) {
                lastQuestionableCheckTarget = getBranchTarget();
                if (seen == Const.IFEQ) {
                    priority = LOW_PRIORITY;
                } else if (seen == Const.IFNE) {
                    priority = NORMAL_PRIORITY;
                }
            }
            break;
        }
        case Const.IFNULL:
        case Const.IFNONNULL: {
            OpcodeStack.Item top = stack.getStackItem(0);
            if (DEBUG) {
                System.out.println("Stack top: " + top);
            }
            XMethod m = top.getReturnValueOf();
            if (DEBUG) {
                System.out.println("Found null check");
            }
            if (m != null && "java.util.concurrent.ConcurrentHashMap".equals(m.getClassName()) && "get".equals(m.getName())) {
                lastQuestionableCheckTarget = getBranchTarget();
                if (seen == Const.IFNULL) {
                    priority = LOW_PRIORITY;
                } else if (seen == Const.IFNONNULL) {
                    priority = NORMAL_PRIORITY;
                }
            }
            break;
        }
        case Const.INVOKEVIRTUAL:
        case Const.INVOKEINTERFACE: {
            if ("java.util.concurrent.ConcurrentHashMap".equals(getDottedClassConstantOperand())) {
                String methodName = getNameConstantOperand();
                XClass xClass = getXClassOperand();
                if (xClass != null && "put".equals(methodName)) {
                    if ((getPC() < lastQuestionableCheckTarget) && (lastQuestionableCheckTarget != -1)) {
                        bugReporter.reportBug(new BugInstance(this, "AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION", priority)
                        .addClassAndMethod(this).addType(xClass.getClassDescriptor()).addCalledMethod(this)
                        .addSourceLine(this));
                    }
                }
            }
            break;
        }
        default:
            break;
        }
    }
13519
protected final void writekv(String key, Object value) throws IOException {
    String valStr = value == null ? "null" : value.toString();
    if (valStr.contains("\n"))
      throw new IOException("The `value` must not contain newline characters, got: " + valStr);
    if (lkv.containsKey(key))
      throw new IOException("Key " + key + " was already written");
    lkv.put(key, valStr);
  }
716228
void generateClassCode(Definition def, String className, String subDir)
   {
      if (className == null || className.equals(""))
         return;

      try
      {
         String clazzName = this.getClass().getPackage().getName() + ".code." + className + "CodeGen";
         String javaFile =
               Definition.class.getMethod("get" + className + "Class").invoke(def, (Object[]) null) + ".java";
         FileWriter fw;
         if (subDir == null)
            fw = Utils.createSrcFile(javaFile, def.getRaPackage(), def.getOutputDir());
         else
            fw = Utils.createSrcFile(javaFile, def.getRaPackage() + "." + subDir, def.getOutputDir());

         Class<?> clazz = Class.forName(clazzName, true, Thread.currentThread().getContextClassLoader());
         AbstractCodeGen codeGen = (AbstractCodeGen) clazz.newInstance();

         codeGen.generate(def, fw);

         fw.flush();
         fw.close();
      }
      catch (Exception e)
      {
         e.printStackTrace();
      }
   }
978869
function(k) {
                if (typeof k !== "string"){ k = _.stringify(k); }
                return this._ns ? this._ns + k : k;
            }
983270
void generateEisCode(Definition def)
   {
      try
      {
         String clazzName = this.getClass().getPackage().getName() + ".code.TestEisCodeGen";
         String javaFile = def.getDefaultValue() + "Handler.java";
         FileWriter fw = Utils.createTestFile(javaFile, def.getRaPackage(), def.getOutputDir());

         Class<?> clazz = Class.forName(clazzName, true, Thread.currentThread().getContextClassLoader());
         AbstractCodeGen codeGen = (AbstractCodeGen) clazz.newInstance();

         codeGen.generate(def, fw);

         fw.flush();
         fw.close();
      }
      catch (Exception e)
      {
         e.printStackTrace();
      }
   }
976672
public void encodeString(final String s) throws IOException {
		final int lenChars = s.length();
		final int lenCharacters = s.codePointCount(0, lenChars);
		encodeUnsignedInteger(lenCharacters);
		encodeStringOnly(s);
	}
1103999
void write(ByteCodeWriter out)
    throws IOException
  {
    out.write(ConstantPool.CP_STRING);
    out.writeShort(_stringIndex);
  }
958838
@Override
    public void sawOpcode(int seen) {
        try {
            if ((seen == Const.ATHROW) && (stack.getStackDepth() > 0)) {
                OpcodeStack.Item item = stack.getStackItem(0);
                if ("Ljava/lang/CloneNotSupportedException;".equals(item.getSignature())) {
                    throwsCNFE = true;
                }
            }
        } finally {
            stack.sawOpcode(this, seen);
        }
    }
458922
protected final void putString(String s) {
        ensureCapacity(position + (s.length() * 2) + 1);

        System.arraycopy(s.getBytes(), 0, buffer, position, s.length());
        position += s.length();
        buffer[position++] = 0;
    }