Java Code Examples for jdk.nashorn.internal.codegen.types.Type#LONG
The following examples show how to use
jdk.nashorn.internal.codegen.types.Type#LONG .
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: 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 2
Source File: CodeGeneratorLexicalContext.java From jdk8u60 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: CodeGeneratorLexicalContext.java From openjdk-jdk8u 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 4
Source File: CodeGeneratorLexicalContext.java From openjdk-jdk8u-backup 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: 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 6
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 7
Source File: CodeGeneratorLexicalContext.java From jdk8u_nashorn 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 8
Source File: LiteralNode.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private boolean presetsMatchElementType() { if (elementType == Type.INT) { return presets instanceof int[]; } else if (elementType == Type.LONG) { return presets instanceof long[]; } else if (elementType == Type.NUMBER) { return presets instanceof double[]; } else { return presets instanceof Object[]; } }
Example 9
Source File: BinaryNode.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Return the widest possible type for this operation. This is used for compile time * static type inference * * @return Type */ @Override public Type getWidestOperationType() { switch (tokenType()) { case SHR: case ASSIGN_SHR: return Type.LONG; case ASSIGN_SAR: case ASSIGN_SHL: case BIT_AND: case BIT_OR: case BIT_XOR: case ASSIGN_BIT_AND: case ASSIGN_BIT_OR: case ASSIGN_BIT_XOR: case SAR: case SHL: return Type.INT; case DIV: case MOD: case MUL: case SUB: case ASSIGN_DIV: case ASSIGN_MOD: case ASSIGN_MUL: case ASSIGN_SUB: return Type.NUMBER; default: return Type.OBJECT; } }
Example 10
Source File: BinaryNode.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Return the widest possible type for this operation. This is used for compile time * static type inference * * @return Type */ @Override public Type getWidestOperationType() { switch (tokenType()) { case SHR: case ASSIGN_SHR: return Type.LONG; case ASSIGN_SAR: case ASSIGN_SHL: case BIT_AND: case BIT_OR: case BIT_XOR: case ASSIGN_BIT_AND: case ASSIGN_BIT_OR: case ASSIGN_BIT_XOR: case SAR: case SHL: return Type.INT; case DIV: case MOD: case MUL: case SUB: case ASSIGN_DIV: case ASSIGN_MOD: case ASSIGN_MUL: case ASSIGN_SUB: return Type.NUMBER; default: return Type.OBJECT; } }
Example 11
Source File: BinaryNode.java From nashorn with GNU General Public License v2.0 | 5 votes |
/** * Return the widest possible type for this operation. This is used for compile time * static type inference * * @return Type */ @Override public Type getWidestOperationType() { switch (tokenType()) { case SHR: case ASSIGN_SHR: return Type.LONG; case ASSIGN_SAR: case ASSIGN_SHL: case ASSIGN_BIT_AND: case ASSIGN_BIT_OR: case ASSIGN_BIT_XOR: case SAR: case SHL: return Type.INT; case DIV: case MOD: case MUL: case SUB: case ASSIGN_DIV: case ASSIGN_MOD: case ASSIGN_MUL: case ASSIGN_SUB: return Type.NUMBER; default: return Type.OBJECT; } }
Example 12
Source File: SharedScopeCall.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Generate the method that implements the scope get or call. */ protected void generateScopeCall() { final ClassEmitter classEmitter = compileUnit.getClassEmitter(); final EnumSet<ClassEmitter.Flag> methodFlags = EnumSet.of(ClassEmitter.Flag.STATIC); // This method expects two fixed parameters in addition to any parameters that may be // passed on to the function: A ScriptObject representing the caller's current scope object, // and an int specifying the distance to the target scope containing the symbol we want to // access, or -1 if this is not known at compile time (e.g. because of a "with" or "eval"). final MethodEmitter method = classEmitter.method(methodFlags, methodName, getStaticSignature()); method.begin(); // Load correct scope by calling getProto() on the scope argument as often as specified // by the second argument. final Label parentLoopStart = new Label("parent_loop_start"); final Label parentLoopDone = new Label("parent_loop_done"); method.load(Type.OBJECT, 0); method.label(parentLoopStart); method.load(Type.INT, 1); method.iinc(1, -1); method.ifle(parentLoopDone); method.invoke(ScriptObject.GET_PROTO); method._goto(parentLoopStart); method.label(parentLoopDone); method.dynamicGet(valueType, symbol.getName(), flags, isCall); // If this is a get we're done, otherwise call the value as function. if (isCall) { method.convert(Type.OBJECT); // ScriptFunction will see CALLSITE_SCOPE and will bind scope accordingly. method.loadNull(); int slot = 2; for (final Type type : paramTypes) { method.load(type, slot++); if (type == Type.NUMBER || type == Type.LONG) { slot++; } } method.dynamicCall(returnType, 2 + paramTypes.length, flags); } method._return(returnType); method.end(); }
Example 13
Source File: SharedScopeCall.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Generate the method that implements the scope get or call. */ protected void generateScopeCall() { final ClassEmitter classEmitter = compileUnit.getClassEmitter(); final EnumSet<ClassEmitter.Flag> methodFlags = EnumSet.of(ClassEmitter.Flag.STATIC); // This method expects two fixed parameters in addition to any parameters that may be // passed on to the function: A ScriptObject representing the caller's current scope object, // and an int specifying the distance to the target scope containing the symbol we want to // access, or -1 if this is not known at compile time (e.g. because of a "with" or "eval"). final MethodEmitter method = classEmitter.method(methodFlags, methodName, getStaticSignature()); method.begin(); // Load correct scope by calling getProto() on the scope argument as often as specified // by the second argument. final Label parentLoopStart = new Label("parent_loop_start"); final Label parentLoopDone = new Label("parent_loop_done"); method.load(Type.OBJECT, 0); method.label(parentLoopStart); method.load(Type.INT, 1); method.iinc(1, -1); method.ifle(parentLoopDone); method.invoke(ScriptObject.GET_PROTO); method._goto(parentLoopStart); method.label(parentLoopDone); method.dynamicGet(valueType, symbol.getName(), flags, isCall); // If this is a get we're done, otherwise call the value as function. if (isCall) { method.convert(Type.OBJECT); // ScriptFunction will see CALLSITE_SCOPE and will bind scope accordingly. method.loadNull(); int slot = 2; for (final Type type : paramTypes) { method.load(type, slot++); if (type == Type.NUMBER || type == Type.LONG) { slot++; } } method.dynamicCall(returnType, 2 + paramTypes.length, flags); } method._return(returnType); method.end(); }
Example 14
Source File: SharedScopeCall.java From nashorn with GNU General Public License v2.0 | 4 votes |
/** * Generate the method that implements the scope get or call. */ protected void generateScopeCall() { final ClassEmitter classEmitter = compileUnit.getClassEmitter(); final EnumSet<ClassEmitter.Flag> methodFlags = EnumSet.of(ClassEmitter.Flag.STATIC); // This method expects two fixed parameters in addition to any parameters that may be // passed on to the function: A ScriptObject representing the caller's current scope object, // and an int specifying the distance to the target scope containing the symbol we want to // access, or -1 if this is not known at compile time (e.g. because of a "with" or "eval"). final MethodEmitter method = classEmitter.method(methodFlags, methodName, getStaticSignature()); method.begin(); // Load correct scope by calling getProto() on the scope argument as often as specified // by the second argument. final Label parentLoopStart = new Label("parent_loop_start"); final Label parentLoopDone = new Label("parent_loop_done"); method.load(Type.OBJECT, 0); method.label(parentLoopStart); method.load(Type.INT, 1); method.iinc(1, -1); method.ifle(parentLoopDone); method.invoke(ScriptObject.GET_PROTO); method._goto(parentLoopStart); method.label(parentLoopDone); method.dynamicGet(valueType, symbol.getName(), flags, isCall); // If this is a get we're done, otherwise call the value as function. if (isCall) { method.convert(Type.OBJECT); // ScriptFunction will see CALLSITE_SCOPE and will bind scope accordingly. method.loadNull(); int slot = 2; for (final Type type : paramTypes) { method.load(type, slot++); if (type == Type.NUMBER || type == Type.LONG) { slot++; } } method.dynamicCall(returnType, 2 + paramTypes.length, flags); } method._return(returnType); method.end(); }