Java Code Examples for jdk.nashorn.internal.codegen.types.Type#UNKNOWN
The following examples show how to use
jdk.nashorn.internal.codegen.types.Type#UNKNOWN .
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: Label.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Returns a list of local variable slot types, but for those symbols that have multiple values, only the slot * holding the widest type is marked as live. * @return a list of widest local variable slot types. */ List<Type> getWidestLiveLocals(final List<Type> lvarTypes) { final List<Type> widestLiveLocals = new ArrayList<>(lvarTypes); boolean keepNextValue = true; final int size = widestLiveLocals.size(); for(int i = size - 1; i-- > 0;) { if(symbolBoundary.get(i)) { keepNextValue = true; } final Type t = widestLiveLocals.get(i); if(t != Type.UNKNOWN) { if(keepNextValue) { if(t != Type.SLOT_2) { keepNextValue = false; } } else { widestLiveLocals.set(i, Type.UNKNOWN); } } } widestLiveLocals.subList(Math.max(getFirstDeadLocal(widestLiveLocals), firstTemp), widestLiveLocals.size()).clear(); return widestLiveLocals; }
Example 2
Source File: CodeGeneratorLexicalContext.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
static Type getTypeForSlotDescriptor(final char typeDesc) { // Recognizing both lowercase and uppercase as we're using both to signify symbol boundaries; see // MethodEmitter.markSymbolBoundariesInLvarTypesDescriptor(). switch (typeDesc) { case 'I': case 'i': return Type.INT; case 'J': case 'j': return Type.LONG; case 'D': case 'd': return Type.NUMBER; case 'A': case 'a': return Type.OBJECT; case 'U': case 'u': return Type.UNKNOWN; default: throw new AssertionError(); } }
Example 3
Source File: Label.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Returns a list of local variable slot types, but for those symbols that have multiple values, only the slot * holding the widest type is marked as live. * @return a list of widest local variable slot types. */ List<Type> getWidestLiveLocals(final List<Type> lvarTypes) { final List<Type> widestLiveLocals = new ArrayList<>(lvarTypes); boolean keepNextValue = true; final int size = widestLiveLocals.size(); for(int i = size - 1; i-- > 0;) { if(symbolBoundary.get(i)) { keepNextValue = true; } final Type t = widestLiveLocals.get(i); if(t != Type.UNKNOWN) { if(keepNextValue) { if(t != Type.SLOT_2) { keepNextValue = false; } } else { widestLiveLocals.set(i, Type.UNKNOWN); } } } widestLiveLocals.subList(Math.max(getFirstDeadLocal(widestLiveLocals), firstTemp), widestLiveLocals.size()).clear(); return widestLiveLocals; }
Example 4
Source File: CodeGeneratorLexicalContext.java From hottub with GNU General Public License v2.0 | 6 votes |
static Type getTypeForSlotDescriptor(final char typeDesc) { // Recognizing both lowercase and uppercase as we're using both to signify symbol boundaries; see // MethodEmitter.markSymbolBoundariesInLvarTypesDescriptor(). switch (typeDesc) { case 'I': case 'i': return Type.INT; case 'J': case 'j': return Type.LONG; case 'D': case 'd': return Type.NUMBER; case 'A': case 'a': return Type.OBJECT; case 'U': case 'u': return Type.UNKNOWN; default: throw new AssertionError(); } }
Example 5
Source File: Label.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Returns a list of local variable slot types, but for those symbols that have multiple values, only the slot * holding the widest type is marked as live. * @return a list of widest local variable slot types. */ List<Type> getWidestLiveLocals(final List<Type> lvarTypes) { final List<Type> widestLiveLocals = new ArrayList<>(lvarTypes); boolean keepNextValue = true; final int size = widestLiveLocals.size(); for(int i = size - 1; i-- > 0;) { if(symbolBoundary.get(i)) { keepNextValue = true; } final Type t = widestLiveLocals.get(i); if(t != Type.UNKNOWN) { if(keepNextValue) { if(t != Type.SLOT_2) { keepNextValue = false; } } else { widestLiveLocals.set(i, Type.UNKNOWN); } } } widestLiveLocals.subList(Math.max(getFirstDeadLocal(widestLiveLocals), firstTemp), widestLiveLocals.size()).clear(); return widestLiveLocals; }
Example 6
Source File: CodeGeneratorLexicalContext.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
static Type getTypeForSlotDescriptor(final char typeDesc) { // Recognizing both lowercase and uppercase as we're using both to signify symbol boundaries; see // MethodEmitter.markSymbolBoundariesInLvarTypesDescriptor(). switch (typeDesc) { case 'I': case 'i': return Type.INT; case 'J': case 'j': return Type.LONG; case 'D': case 'd': return Type.NUMBER; case 'A': case 'a': return Type.OBJECT; case 'U': case 'u': return Type.UNKNOWN; default: throw new AssertionError(); } }
Example 7
Source File: RuntimeCallSite.java From nashorn with GNU General Public License v2.0 | 5 votes |
/** * The first type to try to use for this genrated runtime node * * @return a type */ public Type firstTypeGuess() { Type widest = Type.UNKNOWN; for (final Type type : parameterTypes) { if (type.isObject()) { continue; } widest = Type.widest(type, widest); } widest = Type.widest(widest, firstTypeGuessForObject(request)); return widest; }
Example 8
Source File: LiteralNode.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Constructor * * @param token token * @param finish finish * @param value array literal value, a Node array */ protected ArrayLiteralNode(final long token, final int finish, final Expression[] value) { super(Token.recast(token, TokenType.ARRAY), finish, value); this.elementType = Type.UNKNOWN; this.presets = null; this.postsets = null; this.units = null; }
Example 9
Source File: Label.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private int getFirstDeadLocal(final List<Type> types) { int i = types.size(); for(final ListIterator<Type> it = types.listIterator(i); it.hasPrevious() && it.previous() == Type.UNKNOWN; --i) { // no body } // Respect symbol boundaries; we never chop off half a symbol's storage while(!symbolBoundary.get(i - 1)) { ++i; } return i; }
Example 10
Source File: LiteralNode.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
/** * Constructor * * @param token token * @param finish finish * @param value array literal value, a Node array */ protected ArrayLiteralNode(final long token, final int finish, final Expression[] value) { super(Token.recast(token, TokenType.ARRAY), finish, value); this.elementType = Type.UNKNOWN; this.presets = null; this.postsets = null; this.splitRanges = null; }
Example 11
Source File: Label.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private int getFirstDeadLocal(final List<Type> types) { int i = types.size(); for(final ListIterator<Type> it = types.listIterator(i); it.hasPrevious() && it.previous() == Type.UNKNOWN; --i) { // no body } // Respect symbol boundaries; we never chop off half a symbol's storage while(!symbolBoundary.get(i - 1)) { ++i; } return i; }
Example 12
Source File: RuntimeCallSite.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * The first type to try to use for this genrated runtime node * * @return a type */ public Type firstTypeGuess() { Type widest = Type.UNKNOWN; for (final Type type : parameterTypes) { if (type.isObject()) { continue; } widest = Type.widest(type, widest); } widest = Type.widest(widest, firstTypeGuessForObject(request)); return widest; }
Example 13
Source File: LiteralNode.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Constructor * * @param token token * @param finish finish * @param value array literal value, a Node array * @param hasSpread true if the array has a spread element * @param hasTrailingComma true if the array literal has a comma after the last element */ protected ArrayLiteralNode(final long token, final int finish, final Expression[] value, final boolean hasSpread, final boolean hasTrailingComma) { super(Token.recast(token, TokenType.ARRAY), finish, value); this.elementType = Type.UNKNOWN; this.presets = null; this.postsets = null; this.splitRanges = null; this.hasSpread = hasSpread; this.hasTrailingComma = hasTrailingComma; }
Example 14
Source File: Label.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
private int getFirstDeadLocal(final List<Type> types) { int i = types.size(); for(final ListIterator<Type> it = types.listIterator(i); it.hasPrevious() && it.previous() == Type.UNKNOWN; --i) { // no body } // Respect symbol boundaries; we never chop off half a symbol's storage while(!symbolBoundary.get(i - 1)) { ++i; } return i; }
Example 15
Source File: LiteralNode.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Constructor * * @param token token * @param finish finish * @param value array literal value, a Node array */ protected ArrayLiteralNode(final long token, final int finish, final Expression[] value) { super(Token.recast(token, TokenType.ARRAY), finish, value); this.elementType = Type.UNKNOWN; this.presets = null; this.postsets = null; this.splitRanges = null; }
Example 16
Source File: Label.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private int getFirstDeadLocal(final List<Type> types) { int i = types.size(); for(final ListIterator<Type> it = types.listIterator(i); it.hasPrevious() && it.previous() == Type.UNKNOWN; --i) { // no body } // Respect symbol boundaries; we never chop off half a symbol's storage while(!symbolBoundary.get(i - 1)) { ++i; } return i; }
Example 17
Source File: Attr.java From nashorn with GNU General Public License v2.0 | 4 votes |
@Override public Node leaveSwitchNode(final SwitchNode switchNode) { Type type = Type.UNKNOWN; final List<CaseNode> newCases = new ArrayList<>(); for (final CaseNode caseNode : switchNode.getCases()) { final Node test = caseNode.getTest(); CaseNode newCaseNode = caseNode; if (test != null) { if (test instanceof LiteralNode) { //go down to integers if we can final LiteralNode<?> lit = (LiteralNode<?>)test; if (lit.isNumeric() && !(lit.getValue() instanceof Integer)) { if (JSType.isRepresentableAsInt(lit.getNumber())) { newCaseNode = caseNode.setTest((Expression)LiteralNode.newInstance(lit, lit.getInt32()).accept(this)); } } } else { // the "all integer" case that CodeGenerator optimizes for currently assumes literals only type = Type.OBJECT; } final Type newCaseType = newCaseNode.getTest().getType(); if (newCaseType.isBoolean()) { type = Type.OBJECT; //booleans and integers aren't assignment compatible } else { type = Type.widest(type, newCaseType); } } newCases.add(newCaseNode); } //only optimize for all integers if (!type.isInteger()) { type = Type.OBJECT; } switchNode.setTag(newInternal(lc.getCurrentFunction().uniqueName(SWITCH_TAG_PREFIX.symbolName()), type)); end(switchNode); return switchNode.setCases(lc, newCases); }
Example 18
Source File: LiteralNode.java From openjdk-8 with GNU General Public License v2.0 | 2 votes |
/** * Constructor * * @param token token * @param finish finish * @param value array literal value, a Node array */ protected ArrayLiteralNode(final long token, final int finish, final Expression[] value) { super(Token.recast(token, TokenType.ARRAY), finish, value); this.elementType = Type.UNKNOWN; }
Example 19
Source File: Symbol.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * Constructor * * @param name name of symbol * @param flags symbol flags */ public Symbol(final String name, final int flags) { this(name, flags, Type.UNKNOWN, -1); }
Example 20
Source File: Symbol.java From openjdk-8 with GNU General Public License v2.0 | 2 votes |
/** * Constructor * * @param name name of symbol * @param flags symbol flags */ public Symbol(final String name, final int flags) { this(name, flags, Type.UNKNOWN, -1); }