Java Code Examples for jdk.nashorn.internal.codegen.types.Type#THIS

The following examples show how to use jdk.nashorn.internal.codegen.types.Type#THIS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MethodEmitter.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void debug(final int padConstant, final Object... args) {
    if (debug) {
        final StringBuilder sb = new StringBuilder();
        int pad;

        sb.append('#');
        sb.append(++linePrefix);

        pad = 5 - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        if (isReachable() && !stack.isEmpty()) {
            sb.append("{");
            sb.append(stack.size());
            sb.append(":");
            for (int pos = 0; pos < stack.size(); pos++) {
                final Type t = stack.peek(pos);

                if (t == Type.SCOPE) {
                    sb.append("scope");
                } else if (t == Type.THIS) {
                    sb.append("this");
                } else if (t.isObject()) {
                    String desc = t.getDescriptor();
                    int i;
                    for (i = 0; desc.charAt(i) == '[' && i < desc.length(); i++) {
                        sb.append('[');
                    }
                    desc = desc.substring(i);
                    final int slash = desc.lastIndexOf('/');
                    if (slash != -1) {
                        desc = desc.substring(slash + 1, desc.length() - 1);
                    }
                    if ("Object".equals(desc)) {
                        sb.append('O');
                    } else {
                        sb.append(desc);
                    }
                } else {
                    sb.append(t.getDescriptor());
                }
                final int loadIndex = stack.localLoads[stack.sp - 1 - pos];
                if(loadIndex != Label.Stack.NON_LOAD) {
                    sb.append('(').append(loadIndex).append(')');
                }
                if (pos + 1 < stack.size()) {
                    sb.append(' ');
                }
            }
            sb.append('}');
            sb.append(' ');
        }

        pad = padConstant - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        for (final Object arg : args) {
            sb.append(arg);
            sb.append(' ');
        }

        if (context.getEnv() != null) { //early bootstrap code doesn't have inited context yet
            log.info(sb);
            if (DEBUG_TRACE_LINE == linePrefix) {
                new Throwable().printStackTrace(log.getOutputStream());
            }
        }
    }
}
 
Example 2
Source File: MethodEmitter.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private void debug(final int padConstant, final Object... args) {
    if (debug) {
        final StringBuilder sb = new StringBuilder();
        int pad;

        sb.append('#');
        sb.append(++linePrefix);

        pad = 5 - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        if (isReachable() && !stack.isEmpty()) {
            sb.append("{");
            sb.append(stack.size());
            sb.append(":");
            for (int pos = 0; pos < stack.size(); pos++) {
                final Type t = stack.peek(pos);

                if (t == Type.SCOPE) {
                    sb.append("scope");
                } else if (t == Type.THIS) {
                    sb.append("this");
                } else if (t.isObject()) {
                    String desc = t.getDescriptor();
                    int i;
                    for (i = 0; desc.charAt(i) == '[' && i < desc.length(); i++) {
                        sb.append('[');
                    }
                    desc = desc.substring(i);
                    final int slash = desc.lastIndexOf('/');
                    if (slash != -1) {
                        desc = desc.substring(slash + 1, desc.length() - 1);
                    }
                    if ("Object".equals(desc)) {
                        sb.append('O');
                    } else {
                        sb.append(desc);
                    }
                } else {
                    sb.append(t.getDescriptor());
                }
                final int loadIndex = stack.localLoads[stack.sp - 1 - pos];
                if(loadIndex != Label.Stack.NON_LOAD) {
                    sb.append('(').append(loadIndex).append(')');
                }
                if (pos + 1 < stack.size()) {
                    sb.append(' ');
                }
            }
            sb.append('}');
            sb.append(' ');
        }

        pad = padConstant - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        for (final Object arg : args) {
            sb.append(arg);
            sb.append(' ');
        }

        if (context.getEnv() != null) { //early bootstrap code doesn't have inited context yet
            log.info(sb);
            if (DEBUG_TRACE_LINE == linePrefix) {
                new Throwable().printStackTrace(log.getOutputStream());
            }
        }
    }
}
 
Example 3
Source File: MethodEmitter.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void debug(final int padConstant, final Object... args) {
    if (debug) {
        final StringBuilder sb = new StringBuilder();
        int pad;

        sb.append('#');
        sb.append(++linePrefix);

        pad = 5 - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        if (isReachable() && !stack.isEmpty()) {
            sb.append("{");
            sb.append(stack.size());
            sb.append(":");
            for (int pos = 0; pos < stack.size(); pos++) {
                final Type t = stack.peek(pos);

                if (t == Type.SCOPE) {
                    sb.append("scope");
                } else if (t == Type.THIS) {
                    sb.append("this");
                } else if (t.isObject()) {
                    String desc = t.getDescriptor();
                    int i;
                    for (i = 0; desc.charAt(i) == '[' && i < desc.length(); i++) {
                        sb.append('[');
                    }
                    desc = desc.substring(i);
                    final int slash = desc.lastIndexOf('/');
                    if (slash != -1) {
                        desc = desc.substring(slash + 1, desc.length() - 1);
                    }
                    if ("Object".equals(desc)) {
                        sb.append('O');
                    } else {
                        sb.append(desc);
                    }
                } else {
                    sb.append(t.getDescriptor());
                }
                final int loadIndex = stack.localLoads[stack.sp - 1 - pos];
                if(loadIndex != Label.Stack.NON_LOAD) {
                    sb.append('(').append(loadIndex).append(')');
                }
                if (pos + 1 < stack.size()) {
                    sb.append(' ');
                }
            }
            sb.append('}');
            sb.append(' ');
        }

        pad = padConstant - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        for (final Object arg : args) {
            sb.append(arg);
            sb.append(' ');
        }

        if (context.getEnv() != null) { //early bootstrap code doesn't have inited context yet
            log.info(sb);
            if (DEBUG_TRACE_LINE == linePrefix) {
                new Throwable().printStackTrace(log.getOutputStream());
            }
        }
    }
}
 
Example 4
Source File: MethodEmitter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private void debug(final int padConstant, final Object... args) {
    if (debug) {
        final StringBuilder sb = new StringBuilder();
        int pad;

        sb.append('#');
        sb.append(++linePrefix);

        pad = 5 - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        if (isReachable() && !stack.isEmpty()) {
            sb.append("{");
            sb.append(stack.size());
            sb.append(":");
            for (int pos = 0; pos < stack.size(); pos++) {
                final Type t = stack.peek(pos);

                if (t == Type.SCOPE) {
                    sb.append("scope");
                } else if (t == Type.THIS) {
                    sb.append("this");
                } else if (t.isObject()) {
                    String desc = t.getDescriptor();
                    int i;
                    for (i = 0; desc.charAt(i) == '[' && i < desc.length(); i++) {
                        sb.append('[');
                    }
                    desc = desc.substring(i);
                    final int slash = desc.lastIndexOf('/');
                    if (slash != -1) {
                        desc = desc.substring(slash + 1, desc.length() - 1);
                    }
                    if ("Object".equals(desc)) {
                        sb.append('O');
                    } else {
                        sb.append(desc);
                    }
                } else {
                    sb.append(t.getDescriptor());
                }
                final int loadIndex = stack.localLoads[stack.sp - 1 - pos];
                if(loadIndex != Label.Stack.NON_LOAD) {
                    sb.append('(').append(loadIndex).append(')');
                }
                if (pos + 1 < stack.size()) {
                    sb.append(' ');
                }
            }
            sb.append('}');
            sb.append(' ');
        }

        pad = padConstant - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        for (final Object arg : args) {
            sb.append(arg);
            sb.append(' ');
        }

        if (context.getEnv() != null) { //early bootstrap code doesn't have inited context yet
            log.info(sb);
            if (DEBUG_TRACE_LINE == linePrefix) {
                new Throwable().printStackTrace(log.getOutputStream());
            }
        }
    }
}
 
Example 5
Source File: MethodEmitter.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void debug(final int padConstant, final Object... args) {
    if (debug) {
        final StringBuilder sb = new StringBuilder();
        int pad;

        sb.append('#');
        sb.append(++linePrefix);

        pad = 5 - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        if (isReachable() && !stack.isEmpty()) {
            sb.append("{");
            sb.append(stack.size());
            sb.append(":");
            for (int pos = 0; pos < stack.size(); pos++) {
                final Type t = stack.peek(pos);

                if (t == Type.SCOPE) {
                    sb.append("scope");
                } else if (t == Type.THIS) {
                    sb.append("this");
                } else if (t.isObject()) {
                    String desc = t.getDescriptor();
                    int i;
                    for (i = 0; desc.charAt(i) == '[' && i < desc.length(); i++) {
                        sb.append('[');
                    }
                    desc = desc.substring(i);
                    final int slash = desc.lastIndexOf('/');
                    if (slash != -1) {
                        desc = desc.substring(slash + 1, desc.length() - 1);
                    }
                    if ("Object".equals(desc)) {
                        sb.append('O');
                    } else {
                        sb.append(desc);
                    }
                } else {
                    sb.append(t.getDescriptor());
                }
                final int loadIndex = stack.localLoads[stack.sp - 1 - pos];
                if(loadIndex != Label.Stack.NON_LOAD) {
                    sb.append('(').append(loadIndex).append(')');
                }
                if (pos + 1 < stack.size()) {
                    sb.append(' ');
                }
            }
            sb.append('}');
            sb.append(' ');
        }

        pad = padConstant - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        for (final Object arg : args) {
            sb.append(arg);
            sb.append(' ');
        }

        if (context.getEnv() != null) { //early bootstrap code doesn't have inited context yet
            log.info(sb);
            if (DEBUG_TRACE_LINE == linePrefix) {
                new Throwable().printStackTrace(log.getOutputStream());
            }
        }
    }
}
 
Example 6
Source File: MethodEmitter.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void debug(final int padConstant, final Object... args) {
    if (debug) {
        final StringBuilder sb = new StringBuilder();
        int pad;

        sb.append('#');
        sb.append(++linePrefix);

        pad = 5 - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        if (isReachable() && !stack.isEmpty()) {
            sb.append("{");
            sb.append(stack.size());
            sb.append(":");
            for (int pos = 0; pos < stack.size(); pos++) {
                final Type t = stack.peek(pos);

                if (t == Type.SCOPE) {
                    sb.append("scope");
                } else if (t == Type.THIS) {
                    sb.append("this");
                } else if (t.isObject()) {
                    String desc = t.getDescriptor();
                    int i;
                    for (i = 0; desc.charAt(i) == '[' && i < desc.length(); i++) {
                        sb.append('[');
                    }
                    desc = desc.substring(i);
                    final int slash = desc.lastIndexOf('/');
                    if (slash != -1) {
                        desc = desc.substring(slash + 1, desc.length() - 1);
                    }
                    if ("Object".equals(desc)) {
                        sb.append('O');
                    } else {
                        sb.append(desc);
                    }
                } else {
                    sb.append(t.getDescriptor());
                }
                final int loadIndex = stack.localLoads[stack.sp - 1 - pos];
                if(loadIndex != Label.Stack.NON_LOAD) {
                    sb.append('(').append(loadIndex).append(')');
                }
                if (pos + 1 < stack.size()) {
                    sb.append(' ');
                }
            }
            sb.append('}');
            sb.append(' ');
        }

        pad = padConstant - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        for (final Object arg : args) {
            sb.append(arg);
            sb.append(' ');
        }

        if (context.getEnv() != null) { //early bootstrap code doesn't have inited context yet
            log.info(sb);
            if (DEBUG_TRACE_LINE == linePrefix) {
                new Throwable().printStackTrace(log.getOutputStream());
            }
        }
    }
}
 
Example 7
Source File: MethodEmitter.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void debug(final int padConstant, final Object... args) {
    if (DEBUG) {
        final StringBuilder sb = new StringBuilder();
        int pad;

        sb.append('#');
        sb.append(++linePrefix);

        pad = 5 - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        if (stack != null && !stack.isEmpty()) {
            sb.append("{");
            sb.append(stack.size());
            sb.append(":");
            for (int pos = 0; pos < stack.size(); pos++) {
                final Type t = stack.peek(pos);

                if (t == Type.SCOPE) {
                    sb.append("scope");
                } else if (t == Type.THIS) {
                    sb.append("this");
                } else if (t.isObject()) {
                    String desc = t.getDescriptor();
                    int i;
                    for (i = 0; desc.charAt(i) == '[' && i < desc.length(); i++) {
                        sb.append('[');
                    }
                    desc = desc.substring(i);
                    final int slash = desc.lastIndexOf('/');
                    if (slash != -1) {
                        desc = desc.substring(slash + 1, desc.length() - 1);
                    }
                    if ("Object".equals(desc)) {
                        sb.append('O');
                    } else {
                        sb.append(desc);
                    }
                } else {
                    sb.append(t.getDescriptor());
                }

                if (pos + 1 < stack.size()) {
                    sb.append(' ');
                }
            }
            sb.append('}');
            sb.append(' ');
        }

        pad = padConstant - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        for (final Object arg : args) {
            sb.append(arg);
            sb.append(' ');
        }

        if (env != null) { //early bootstrap code doesn't have inited context yet
            LOG.info(sb);
            if (DEBUG_TRACE_LINE == linePrefix) {
                new Throwable().printStackTrace(LOG.getOutputStream());
            }
        }
    }
}
 
Example 8
Source File: MethodEmitter.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void debug(final int padConstant, final Object... args) {
    if (DEBUG) {
        final StringBuilder sb = new StringBuilder();
        int pad;

        sb.append('#');
        sb.append(++linePrefix);

        pad = 5 - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        if (stack != null && !stack.isEmpty()) {
            sb.append("{");
            sb.append(stack.size());
            sb.append(":");
            for (int pos = 0; pos < stack.size(); pos++) {
                final Type t = stack.peek(pos);

                if (t == Type.SCOPE) {
                    sb.append("scope");
                } else if (t == Type.THIS) {
                    sb.append("this");
                } else if (t.isObject()) {
                    String desc = t.getDescriptor();
                    int i;
                    for (i = 0; desc.charAt(i) == '[' && i < desc.length(); i++) {
                        sb.append('[');
                    }
                    desc = desc.substring(i);
                    final int slash = desc.lastIndexOf('/');
                    if (slash != -1) {
                        desc = desc.substring(slash + 1, desc.length() - 1);
                    }
                    if ("Object".equals(desc)) {
                        sb.append('O');
                    } else {
                        sb.append(desc);
                    }
                } else {
                    sb.append(t.getDescriptor());
                }

                if (pos + 1 < stack.size()) {
                    sb.append(' ');
                }
            }
            sb.append('}');
            sb.append(' ');
        }

        pad = padConstant - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        for (final Object arg : args) {
            sb.append(arg);
            sb.append(' ');
        }

        if (env != null) { //early bootstrap code doesn't have inited context yet
            LOG.info(sb);
            if (DEBUG_TRACE_LINE == linePrefix) {
                new Throwable().printStackTrace(LOG.getOutputStream());
            }
        }
    }
}
 
Example 9
Source File: MethodEmitter.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
private void debug(final int padConstant, final Object... args) {
    if (debug) {
        final StringBuilder sb = new StringBuilder();
        int pad;

        sb.append('#');
        sb.append(++linePrefix);

        pad = 5 - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        if (isReachable() && !stack.isEmpty()) {
            sb.append("{");
            sb.append(stack.size());
            sb.append(":");
            for (int pos = 0; pos < stack.size(); pos++) {
                final Type t = stack.peek(pos);

                if (t == Type.SCOPE) {
                    sb.append("scope");
                } else if (t == Type.THIS) {
                    sb.append("this");
                } else if (t.isObject()) {
                    String desc = t.getDescriptor();
                    int i;
                    for (i = 0; desc.charAt(i) == '[' && i < desc.length(); i++) {
                        sb.append('[');
                    }
                    desc = desc.substring(i);
                    final int slash = desc.lastIndexOf('/');
                    if (slash != -1) {
                        desc = desc.substring(slash + 1, desc.length() - 1);
                    }
                    if ("Object".equals(desc)) {
                        sb.append('O');
                    } else {
                        sb.append(desc);
                    }
                } else {
                    sb.append(t.getDescriptor());
                }
                final int loadIndex = stack.localLoads[stack.sp - 1 - pos];
                if(loadIndex != Label.Stack.NON_LOAD) {
                    sb.append('(').append(loadIndex).append(')');
                }
                if (pos + 1 < stack.size()) {
                    sb.append(' ');
                }
            }
            sb.append('}');
            sb.append(' ');
        }

        pad = padConstant - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        for (final Object arg : args) {
            sb.append(arg);
            sb.append(' ');
        }

        if (context.getEnv() != null) { //early bootstrap code doesn't have inited context yet
            log.info(sb);
            if (DEBUG_TRACE_LINE == linePrefix) {
                new Throwable().printStackTrace(log.getOutputStream());
            }
        }
    }
}
 
Example 10
Source File: MethodEmitter.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
private void debug(final int padConstant, final Object... args) {
    if (DEBUG) {
        final StringBuilder sb = new StringBuilder();
        int pad;

        sb.append('#');
        sb.append(++linePrefix);

        pad = 5 - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        if (stack != null && !stack.isEmpty()) {
            sb.append("{");
            sb.append(stack.size());
            sb.append(":");
            for (int pos = 0; pos < stack.size(); pos++) {
                final Type t = stack.peek(pos);

                if (t == Type.SCOPE) {
                    sb.append("scope");
                } else if (t == Type.THIS) {
                    sb.append("this");
                } else if (t.isObject()) {
                    String desc = t.getDescriptor();
                    int i;
                    for (i = 0; desc.charAt(i) == '[' && i < desc.length(); i++) {
                        sb.append('[');
                    }
                    desc = desc.substring(i);
                    final int slash = desc.lastIndexOf('/');
                    if (slash != -1) {
                        desc = desc.substring(slash + 1, desc.length() - 1);
                    }
                    if ("Object".equals(desc)) {
                        sb.append('O');
                    } else {
                        sb.append(desc);
                    }
                } else {
                    sb.append(t.getDescriptor());
                }

                if (pos + 1 < stack.size()) {
                    sb.append(' ');
                }
            }
            sb.append('}');
            sb.append(' ');
        }

        pad = padConstant - sb.length();
        while (pad > 0) {
            sb.append(' ');
            pad--;
        }

        for (final Object arg : args) {
            sb.append(arg);
            sb.append(' ');
        }

        if (env != null) { //early bootstrap code doesn't have inited context yet
            LOG.info(sb);
            if (DEBUG_TRACE_LINE == linePrefix) {
                new Throwable().printStackTrace(LOG.getOutputStream());
            }
        }
    }
}