<commit_before>package com.ninty.cmd;

import com.ninty.classfile.AttributeInfo;
import com.ninty.classfile.constantpool.ConstantInfo;
import com.ninty.cmd.base.ICmdBase;
import com.ninty.cmd.base.Index16Cmd;
import com.ninty.cmd.base.Index8Cmd;
import com.ninty.cmd.base.NoOperandCmd;
import com.ninty.nativee.INativeMethod;
import com.ninty.nativee.NaMethodManager;
import com.ninty.nativee.lang.NaThrowable;
import com.ninty.runtime.*;
import com.ninty.runtime.heap.*;
import com.ninty.runtime.heap.constantpool.*;
import com.ninty.utils.VMUtils;
import com.sun.jdi.NativeMethodException;

/**
 * Created by ninty on 2017/7/27.
 */
public class CmdReferences {

    public static void invokeMethod(NiFrame frame, NiMethod method) {
        frame.getThread().invokeMethod(method);
    }

    private static void print(NiFrame frame, String desc) {
        OperandStack stack = frame.getOperandStack();
        switch (desc) {
            case "(Z)V":
                System.out.println(stack.popInt() != 0);
                break;
            case "(C)V":
                System.out.println((char) stack.popInt());
                break;
            case "(B)V":
                System.out.println((byte) stack.popInt());
                break;
            case "(S)V":
                System.out.println((short) stack.popInt());
                break;
            case "(I)V":
                System.out.println(stack.popInt());
                break;
            case "(J)V":
                System.out.println(stack.popLong());
                break;
            case "(F)V":
                System.out.println(stack.popFloat());
                break;
            case "(D)V":
                System.out.println(stack.popDouble());
                break;
            case "(Ljava/lang/String;)V":
                System.out.println(NiString.getString(stack.popRef()));
                break;
            default:
                NiObject ref = stack.getRefFromTop();
                if (!NiString.isString(ref)) {
                    frame.restorePostion();
                    NiMethod method = ref.getClz().getToStringMethod();
                    invokeMethod(frame, method);
                    return;
                }
                System.out.println(NiString.getString(ref));
        }<commit_msg>fix the crash that calsl System.out.println(Object) repeatedly<commit_after>package com.ninty.cmd;

import com.ninty.classfile.AttributeInfo;
import com.ninty.classfile.constantpool.ConstantInfo;
import com.ninty.cmd.base.ICmdBase;
import com.ninty.cmd.base.Index16Cmd;
import com.ninty.cmd.base.Index8Cmd;
import com.ninty.cmd.base.NoOperandCmd;
import com.ninty.nativee.INativeMethod;
import com.ninty.nativee.NaMethodManager;
import com.ninty.nativee.lang.NaThrowable;
import com.ninty.runtime.*;
import com.ninty.runtime.heap.*;
import com.ninty.runtime.heap.constantpool.*;
import com.ninty.utils.VMUtils;
import com.sun.jdi.NativeMethodException;

/**
 * Created by ninty on 2017/7/27.
 */
public class CmdReferences {

    public static void invokeMethod(NiFrame frame, NiMethod method) {
        frame.getThread().invokeMethod(method);
    }

    private static void print(NiFrame frame, String desc) {
        OperandStack stack = frame.getOperandStack();
        switch (desc) {
            case "(Z)V":
                System.out.println(stack.popInt() != 0);
                break;
            case "(C)V":
                System.out.println((char) stack.popInt());
                break;
            case "(B)V":
                System.out.println((byte) stack.popInt());
                break;
            case "(S)V":
                System.out.println((short) stack.popInt());
                break;
            case "(I)V":
                System.out.println(stack.popInt());
                break;
            case "(J)V":
                System.out.println(stack.popLong());
                break;
            case "(F)V":
                System.out.println(stack.popFloat());
                break;
            case "(D)V":
                System.out.println(stack.popDouble());
                break;
            case "(Ljava/lang/String;)V":
                System.out.println(NiString.getString(stack.popRef()));
                break;
            default:
                NiObject ref = stack.popRef();
                if (!NiString.isString(ref)) {
                    frame.restorePostion();
                    NiMethod method = ref.getClz().getToStringMethod();
                    stack.pushRef(ref);
                    invokeMethod(frame, method);
                    return;
                }
                System.out.println(NiString.getString(ref));
        }
{'fraction_non_alphanumeric': 0.12404418011894647, 'fraction_numerical': 0.004672897196261682, 'mean_word_length': 1.794658753709199, 'pattern_counts': {'":': 18, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3592', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1323, 'n_words': 231}