jdk.internal.dynalink.support.NameCodec Java Examples
The following examples show how to use
jdk.internal.dynalink.support.NameCodec.
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: Parser.java From hottub with GNU General Public License v2.0 | 6 votes |
private PropertyFunction propertySetterFunction(final long getSetToken, final int functionLine) { final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = createIdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); // be sloppy and allow missing setter parameter even though // spec does not permit it! final IdentNode argIdent; if (type == IDENT || isNonStrictModeIdent()) { argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); } else { argIdent = null; } expect(RPAREN); final List<IdentNode> parameters = new ArrayList<>(); if (argIdent != null) { parameters.add(argIdent); } final FunctionNode functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER, functionLine); return new PropertyFunction(setIdent, functionNode); }
Example #2
Source File: Compiler.java From nashorn with GNU General Public License v2.0 | 6 votes |
private String safeSourceName(final Source src) { String baseName = new File(src.getName()).getName(); final int index = baseName.lastIndexOf(".js"); if (index != -1) { baseName = baseName.substring(0, index); } baseName = baseName.replace('.', '_').replace('-', '_'); if (! env._loader_per_compile) { baseName = baseName + installer.getUniqueScriptId(); } final String mangled = NameCodec.encode(baseName); return mangled != null ? mangled : baseName; }
Example #3
Source File: MethodEmitter.java From nashorn with GNU General Public License v2.0 | 6 votes |
/** * Generate dynamic getter. Pop scope from stack. Push result * * @param valueType type of the value to set * @param name name of property * @param flags call site flags * @param isMethod should it prefer retrieving methods * * @return the method emitter */ MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod) { debug("dynamic_get", name, valueType); Type type = valueType; if (type.isObject() || type.isBoolean()) { type = Type.OBJECT; //promote e.g strings to object generic setter } popType(Type.SCOPE); method.visitInvokeDynamicInsn((isMethod ? "dyn:getMethod|getProp|getElem:" : "dyn:getProp|getElem|getMethod:") + NameCodec.encode(name), Type.getMethodDescriptor(type, Type.OBJECT), LINKERBOOTSTRAP, flags); pushType(type); convert(valueType); //most probably a nop return this; }
Example #4
Source File: Compiler.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
private String safeSourceName() { String baseName = new File(source.getName()).getName(); final int index = baseName.lastIndexOf(".js"); if (index != -1) { baseName = baseName.substring(0, index); } baseName = baseName.replace('.', '_').replace('-', '_'); if (!env._loader_per_compile) { baseName = baseName + installer.getUniqueScriptId(); } // ASM's bytecode verifier does not allow JVM allowed safe escapes using '\' as escape char. // While ASM accepts such escapes for method names, field names, it enforces Java identifier // for class names. Workaround that ASM bug here by replacing JVM 'dangerous' chars with '_' // rather than safe encoding using '\'. final String mangled = env._verify_code? replaceDangerChars(baseName) : NameCodec.encode(baseName); return mangled != null ? mangled : baseName; }
Example #5
Source File: MethodEmitter.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
/** * Generate dynamic getter. Pop scope from stack. Push result * * @param valueType type of the value to set * @param name name of property * @param flags call site flags * @param isMethod should it prefer retrieving methods * @param isIndex is this an index operation? * @return the method emitter */ MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod, final boolean isIndex) { if (name.length() > LARGE_STRING_THRESHOLD) { // use getIndex for extremely long names return load(name).dynamicGetIndex(valueType, flags, isMethod); } debug("dynamic_get", name, valueType, getProgramPoint(flags)); Type type = valueType; if (type.isObject() || type.isBoolean()) { type = Type.OBJECT; //promote e.g strings to object generic setter } popType(Type.SCOPE); method.visitInvokeDynamicInsn(dynGetOperation(isMethod, isIndex) + ':' + NameCodec.encode(name), Type.getMethodDescriptor(type, Type.OBJECT), LINKERBOOTSTRAP, flags); pushType(type); convert(valueType); //most probably a nop return this; }
Example #6
Source File: Parser.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
private PropertyFunction propertySetterFunction(final long getSetToken, final int functionLine) { final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = createIdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); // be sloppy and allow missing setter parameter even though // spec does not permit it! final IdentNode argIdent; if (type == IDENT || isNonStrictModeIdent()) { argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); } else { argIdent = null; } expect(RPAREN); final List<IdentNode> parameters = new ArrayList<>(); if (argIdent != null) { parameters.add(argIdent); } final FunctionNode functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER, functionLine); return new PropertyFunction(setIdent, functionNode); }
Example #7
Source File: Compiler.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private String safeSourceName(final Source src) { String baseName = new File(src.getName()).getName(); final int index = baseName.lastIndexOf(".js"); if (index != -1) { baseName = baseName.substring(0, index); } baseName = baseName.replace('.', '_').replace('-', '_'); if (! env._loader_per_compile) { baseName = baseName + installer.getUniqueScriptId(); } final String mangled = NameCodec.encode(baseName); return mangled != null ? mangled : baseName; }
Example #8
Source File: MethodEmitter.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * Generate dynamic getter. Pop scope from stack. Push result * * @param valueType type of the value to set * @param name name of property * @param flags call site flags * @param isMethod should it prefer retrieving methods * * @return the method emitter */ MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod) { debug("dynamic_get", name, valueType); Type type = valueType; if (type.isObject() || type.isBoolean()) { type = Type.OBJECT; //promote e.g strings to object generic setter } popType(Type.SCOPE); method.visitInvokeDynamicInsn((isMethod ? "dyn:getMethod|getProp|getElem:" : "dyn:getProp|getElem|getMethod:") + NameCodec.encode(name), Type.getMethodDescriptor(type, Type.OBJECT), LINKERBOOTSTRAP, flags); pushType(type); convert(valueType); //most probably a nop return this; }
Example #9
Source File: Compiler.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private String safeSourceName(final Source src) { String baseName = new File(src.getName()).getName(); final int index = baseName.lastIndexOf(".js"); if (index != -1) { baseName = baseName.substring(0, index); } baseName = baseName.replace('.', '_').replace('-', '_'); if (! env._loader_per_compile) { baseName = baseName + installer.getUniqueScriptId(); } final String mangled = NameCodec.encode(baseName); return mangled != null ? mangled : baseName; }
Example #10
Source File: MethodEmitter.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
/** * Generate dynamic getter. Pop scope from stack. Push result * * @param valueType type of the value to set * @param name name of property * @param flags call site flags * @param isMethod should it prefer retrieving methods * * @return the method emitter */ MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod) { debug("dynamic_get", name, valueType); Type type = valueType; if (type.isObject() || type.isBoolean()) { type = Type.OBJECT; //promote e.g strings to object generic setter } popType(Type.SCOPE); method.visitInvokeDynamicInsn((isMethod ? "dyn:getMethod|getProp|getElem:" : "dyn:getProp|getElem|getMethod:") + NameCodec.encode(name), Type.getMethodDescriptor(type, Type.OBJECT), LINKERBOOTSTRAP, flags); pushType(type); convert(valueType); //most probably a nop return this; }
Example #11
Source File: Compiler.java From hottub with GNU General Public License v2.0 | 6 votes |
private String safeSourceName() { String baseName = new File(source.getName()).getName(); final int index = baseName.lastIndexOf(".js"); if (index != -1) { baseName = baseName.substring(0, index); } baseName = baseName.replace('.', '_').replace('-', '_'); if (!env._loader_per_compile) { baseName = baseName + installer.getUniqueScriptId(); } // ASM's bytecode verifier does not allow JVM allowed safe escapes using '\' as escape char. // While ASM accepts such escapes for method names, field names, it enforces Java identifier // for class names. Workaround that ASM bug here by replacing JVM 'dangerous' chars with '_' // rather than safe encoding using '\'. final String mangled = env._verify_code? replaceDangerChars(baseName) : NameCodec.encode(baseName); return mangled != null ? mangled : baseName; }
Example #12
Source File: MethodEmitter.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Generate dynamic getter. Pop scope from stack. Push result * * @param valueType type of the value to set * @param name name of property * @param flags call site flags * @param isMethod should it prefer retrieving methods * @param isIndex is this an index operation? * @return the method emitter */ MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod, final boolean isIndex) { if (name.length() > LARGE_STRING_THRESHOLD) { // use getIndex for extremely long names return load(name).dynamicGetIndex(valueType, flags, isMethod); } debug("dynamic_get", name, valueType, getProgramPoint(flags)); Type type = valueType; if (type.isObject() || type.isBoolean()) { type = Type.OBJECT; //promote e.g strings to object generic setter } popType(Type.SCOPE); method.visitInvokeDynamicInsn(dynGetOperation(isMethod, isIndex) + ':' + NameCodec.encode(name), Type.getMethodDescriptor(type, Type.OBJECT), LINKERBOOTSTRAP, flags); pushType(type); convert(valueType); //most probably a nop return this; }
Example #13
Source File: Compiler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private String safeSourceName() { String baseName = new File(source.getName()).getName(); final int index = baseName.lastIndexOf(".js"); if (index != -1) { baseName = baseName.substring(0, index); } baseName = baseName.replace('.', '_').replace('-', '_'); if (!env._loader_per_compile) { baseName = baseName + installer.getUniqueScriptId(); } // ASM's bytecode verifier does not allow JVM allowed safe escapes using '\' as escape char. // While ASM accepts such escapes for method names, field names, it enforces Java identifier // for class names. Workaround that ASM bug here by replacing JVM 'dangerous' chars with '_' // rather than safe encoding using '\'. final String mangled = env._verify_code? replaceDangerChars(baseName) : NameCodec.encode(baseName); return mangled != null ? mangled : baseName; }
Example #14
Source File: MethodEmitter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Generate dynamic getter. Pop scope from stack. Push result * * @param valueType type of the value to set * @param name name of property * @param flags call site flags * @param isMethod should it prefer retrieving methods * @param isIndex is this an index operation? * @return the method emitter */ MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod, final boolean isIndex) { if (name.length() > LARGE_STRING_THRESHOLD) { // use getIndex for extremely long names return load(name).dynamicGetIndex(valueType, flags, isMethod); } debug("dynamic_get", name, valueType, getProgramPoint(flags)); Type type = valueType; if (type.isObject() || type.isBoolean()) { type = Type.OBJECT; //promote e.g strings to object generic setter } popType(Type.SCOPE); method.visitInvokeDynamicInsn(dynGetOperation(isMethod, isIndex) + ':' + NameCodec.encode(name), Type.getMethodDescriptor(type, Type.OBJECT), LINKERBOOTSTRAP, flags); pushType(type); convert(valueType); //most probably a nop return this; }
Example #15
Source File: Parser.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private PropertyFunction propertySetterFunction(final long getSetToken, final int functionLine) { final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = createIdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); // be sloppy and allow missing setter parameter even though // spec does not permit it! final IdentNode argIdent; if (type == IDENT || isNonStrictModeIdent()) { argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); } else { argIdent = null; } expect(RPAREN); final List<IdentNode> parameters = new ArrayList<>(); if (argIdent != null) { parameters.add(argIdent); } final FunctionNode functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER, functionLine); return new PropertyFunction(setIdent, functionNode); }
Example #16
Source File: Compiler.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private String safeSourceName() { String baseName = new File(source.getName()).getName(); final int index = baseName.lastIndexOf(".js"); if (index != -1) { baseName = baseName.substring(0, index); } baseName = baseName.replace('.', '_').replace('-', '_'); if (!env._loader_per_compile) { baseName = baseName + installer.getUniqueScriptId(); } // ASM's bytecode verifier does not allow JVM allowed safe escapes using '\' as escape char. // While ASM accepts such escapes for method names, field names, it enforces Java identifier // for class names. Workaround that ASM bug here by replacing JVM 'dangerous' chars with '_' // rather than safe encoding using '\'. final String mangled = env._verify_code? replaceDangerChars(baseName) : NameCodec.encode(baseName); return mangled != null ? mangled : baseName; }
Example #17
Source File: Parser.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private PropertyFunction propertySetterFunction(final long getSetToken, final int functionLine) { final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = createIdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); // be sloppy and allow missing setter parameter even though // spec does not permit it! final IdentNode argIdent; if (type == IDENT || isNonStrictModeIdent()) { argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); } else { argIdent = null; } expect(RPAREN); final List<IdentNode> parameters = new ArrayList<>(); if (argIdent != null) { parameters.add(argIdent); } final FunctionNode functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER, functionLine); return new PropertyFunction(setIdent, functionNode); }
Example #18
Source File: MethodEmitter.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Generate dynamic getter. Pop scope from stack. Push result * * @param valueType type of the value to set * @param name name of property * @param flags call site flags * @param isMethod should it prefer retrieving methods * @param isIndex is this an index operation? * @return the method emitter */ MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod, final boolean isIndex) { if (name.length() > LARGE_STRING_THRESHOLD) { // use getIndex for extremely long names return load(name).dynamicGetIndex(valueType, flags, isMethod); } debug("dynamic_get", name, valueType, getProgramPoint(flags)); Type type = valueType; if (type.isObject() || type.isBoolean()) { type = Type.OBJECT; //promote e.g strings to object generic setter } popType(Type.SCOPE); method.visitInvokeDynamicInsn(dynGetOperation(isMethod, isIndex) + ':' + NameCodec.encode(name), Type.getMethodDescriptor(type, Type.OBJECT), LINKERBOOTSTRAP, flags); pushType(type); convert(valueType); //most probably a nop return this; }
Example #19
Source File: MethodEmitter.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Generate dynamic getter. Pop scope from stack. Push result * * @param valueType type of the value to set * @param name name of property * @param flags call site flags * @param isMethod should it prefer retrieving methods * @param isIndex is this an index operation? * @return the method emitter */ MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod, final boolean isIndex) { if (name.length() > LARGE_STRING_THRESHOLD) { // use getIndex for extremely long names return load(name).dynamicGetIndex(valueType, flags, isMethod); } debug("dynamic_get", name, valueType, getProgramPoint(flags)); Type type = valueType; if (type.isObject() || type.isBoolean()) { type = Type.OBJECT; //promote e.g strings to object generic setter } popType(Type.SCOPE); method.visitInvokeDynamicInsn(dynGetOperation(isMethod, isIndex) + ':' + NameCodec.encode(name), Type.getMethodDescriptor(type, Type.OBJECT), LINKERBOOTSTRAP, flags); pushType(type); convert(valueType); //most probably a nop return this; }
Example #20
Source File: Parser.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private PropertyFunction propertySetterFunction(final long getSetToken, final int functionLine) { final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = createIdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); // be sloppy and allow missing setter parameter even though // spec does not permit it! final IdentNode argIdent; if (type == IDENT || isNonStrictModeIdent()) { argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); } else { argIdent = null; } expect(RPAREN); final List<IdentNode> parameters = new ArrayList<>(); if (argIdent != null) { parameters.add(argIdent); } final FunctionNode functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER, functionLine); return new PropertyFunction(setIdent, functionNode); }
Example #21
Source File: Compiler.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static String safeSourceName(final ScriptEnvironment env, final CodeInstaller<ScriptEnvironment> installer, final Source source) { String baseName = new File(source.getName()).getName(); final int index = baseName.lastIndexOf(".js"); if (index != -1) { baseName = baseName.substring(0, index); } baseName = baseName.replace('.', '_').replace('-', '_'); if (!env._loader_per_compile) { baseName = baseName + installer.getUniqueScriptId(); } // ASM's bytecode verifier does not allow JVM allowed safe escapes using '\' as escape char. // While ASM accepts such escapes for method names, field names, it enforces Java identifier // for class names. Workaround that ASM bug here by replacing JVM 'dangerous' chars with '_' // rather than safe encoding using '\'. final String mangled = env._verify_code? replaceDangerChars(baseName) : NameCodec.encode(baseName); return mangled != null ? mangled : baseName; }
Example #22
Source File: Compiler.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private String safeSourceName() { String baseName = new File(source.getName()).getName(); final int index = baseName.lastIndexOf(".js"); if (index != -1) { baseName = baseName.substring(0, index); } baseName = baseName.replace('.', '_').replace('-', '_'); if (!env._loader_per_compile) { baseName = baseName + installer.getUniqueScriptId(); } // ASM's bytecode verifier does not allow JVM allowed safe escapes using '\' as escape char. // While ASM accepts such escapes for method names, field names, it enforces Java identifier // for class names. Workaround that ASM bug here by replacing JVM 'dangerous' chars with '_' // rather than safe encoding using '\'. final String mangled = env._verify_code? replaceDangerChars(baseName) : NameCodec.encode(baseName); return mangled != null ? mangled : baseName; }
Example #23
Source File: Parser.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private PropertyFunction propertySetterFunction(final long getSetToken, final int functionLine) { final PropertyKey setIdent = propertyName(); final String setterName = setIdent.getPropertyName(); final IdentNode setNameNode = createIdentNode(((Node)setIdent).getToken(), finish, NameCodec.encode("set " + setterName)); expect(LPAREN); // be sloppy and allow missing setter parameter even though // spec does not permit it! final IdentNode argIdent; if (type == IDENT || isNonStrictModeIdent()) { argIdent = getIdent(); verifyStrictIdent(argIdent, "setter argument"); } else { argIdent = null; } expect(RPAREN); final List<IdentNode> parameters = new ArrayList<>(); if (argIdent != null) { parameters.add(argIdent); } final FunctionNode functionNode = functionBody(getSetToken, setNameNode, parameters, FunctionNode.Kind.SETTER, functionLine); return new PropertyFunction(setIdent, functionNode); }
Example #24
Source File: MethodEmitter.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
/** * Generate dynamic getter. Pop scope from stack. Push result * * @param valueType type of the value to set * @param name name of property * @param flags call site flags * @param isMethod should it prefer retrieving methods * @param isIndex is this an index operation? * @return the method emitter */ MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod, final boolean isIndex) { if (name.length() > LARGE_STRING_THRESHOLD) { // use getIndex for extremely long names return load(name).dynamicGetIndex(valueType, flags, isMethod); } debug("dynamic_get", name, valueType, getProgramPoint(flags)); Type type = valueType; if (type.isObject() || type.isBoolean()) { type = Type.OBJECT; //promote e.g strings to object generic setter } popType(Type.SCOPE); method.visitInvokeDynamicInsn(dynGetOperation(isMethod, isIndex) + ':' + NameCodec.encode(name), Type.getMethodDescriptor(type, Type.OBJECT), LINKERBOOTSTRAP, flags); pushType(type); convert(valueType); //most probably a nop return this; }
Example #25
Source File: MethodEmitter.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
/** * Generate a dynamic call * * @param returnType return type * @param argCount number of arguments * @param flags callsite flags * @param msg additional message to be used when reporting error * * @return the method emitter */ MethodEmitter dynamicCall(final Type returnType, final int argCount, final int flags, final String msg) { debug("dynamic_call", "args=", argCount, "returnType=", returnType); final String signature = getDynamicSignature(returnType, argCount); // +1 because the function itself is the 1st parameter for dynamic calls (what you call - call target) debug(" signature", signature); method.visitInvokeDynamicInsn( msg != null && msg.length() < LARGE_STRING_THRESHOLD? "dyn:call:" + NameCodec.encode(msg) : "dyn:call", signature, LINKERBOOTSTRAP, flags); pushType(returnType); return this; }
Example #26
Source File: RecompilableScriptFunctionData.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
private static String functionName(final FunctionNode fn) { if (fn.isAnonymous()) { return ""; } final FunctionNode.Kind kind = fn.getKind(); if (kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { final String name = NameCodec.decode(fn.getIdent().getName()); return name.substring(GET_SET_PREFIX_LENGTH); } return fn.getIdent().getName(); }
Example #27
Source File: Parser.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
private PropertyFunction propertyGetterFunction(final long getSetToken, final int functionLine) { final PropertyKey getIdent = propertyName(); final String getterName = getIdent.getPropertyName(); final IdentNode getNameNode = createIdentNode(((Node)getIdent).getToken(), finish, NameCodec.encode("get " + getterName)); expect(LPAREN); expect(RPAREN); final FunctionNode functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER, functionLine); return new PropertyFunction(getIdent, functionNode); }
Example #28
Source File: Parser.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private PropertyFunction propertyGetterFunction(final long getSetToken, final int functionLine) { final PropertyKey getIdent = propertyName(); final String getterName = getIdent.getPropertyName(); final IdentNode getNameNode = createIdentNode(((Node)getIdent).getToken(), finish, NameCodec.encode("get " + getterName)); expect(LPAREN); expect(RPAREN); final FunctionNode functionNode = functionBody(getSetToken, getNameNode, new ArrayList<IdentNode>(), FunctionNode.Kind.GETTER, functionLine); return new PropertyFunction(getIdent, functionNode); }
Example #29
Source File: MethodEmitter.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Generate a dynamic call * * @param returnType return type * @param argCount number of arguments * @param flags callsite flags * @param msg additional message to be used when reporting error * * @return the method emitter */ MethodEmitter dynamicCall(final Type returnType, final int argCount, final int flags, final String msg) { debug("dynamic_call", "args=", argCount, "returnType=", returnType); final String signature = getDynamicSignature(returnType, argCount); // +1 because the function itself is the 1st parameter for dynamic calls (what you call - call target) debug(" signature", signature); method.visitInvokeDynamicInsn( msg != null && msg.length() < LARGE_STRING_THRESHOLD? "dyn:call:" + NameCodec.encode(msg) : "dyn:call", signature, LINKERBOOTSTRAP, flags); pushType(returnType); return this; }
Example #30
Source File: MethodEmitter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Generate dynamic setter. Pop receiver and property from stack. * * @param valueType the type of the value to set * @param name name of property * @param flags call site flags */ void dynamicSet(final String name, final int flags) { debug("dynamic_set", name, peekType()); Type type = peekType(); if (type.isObject() || type.isBoolean()) { //promote strings to objects etc type = Type.OBJECT; convert(Type.OBJECT); //TODO bad- until we specialize boolean setters, } popType(type); popType(Type.SCOPE); method.visitInvokeDynamicInsn("dyn:setProp|setElem:" + NameCodec.encode(name), methodDescriptor(void.class, Object.class, type.getTypeClass()), LINKERBOOTSTRAP, flags); }