public static MethodDescriptor parseIfPossible(String text) { int parenIndex = text.indexOf('('); if (parenIndex < 1) { return null; } return new MethodDescriptor(text.substring(0, parenIndex), parseSignature(text.substring(parenIndex))); }
private ValueType[] parseSignature(String desc) { ValueType[] signature = MethodDescriptor.parseSignature(desc); for (int i = 0; i < signature.length; ++i) { signature[i] = referenceCache.getCached(signature[i]); } return signature; }
private RuntimeConstant readRuntimeConstant(DataInput input) throws IOException { byte kind = input.readByte(); switch (kind) { case 0: return new RuntimeConstant(input.readInt()); case 1: return new RuntimeConstant(input.readLong()); case 2: return new RuntimeConstant(input.readFloat()); case 3: return new RuntimeConstant(input.readDouble()); case 4: return new RuntimeConstant(input.readUTF()); case 5: return new RuntimeConstant(parseValueType(symbolTable.at(input.readInt()))); case 6: return new RuntimeConstant(MethodDescriptor.parseSignature(symbolTable.at(input.readInt()))); case 7: return new RuntimeConstant(readMethodHandle(input)); default: throw new IllegalArgumentException("Unexpected runtime constant type: " + kind); } }
new MethodDescriptor(name, MethodDescriptor.parseSignature(desc)))); for (Object bsmArg : bsmArgs) { insn.getBootstrapArguments().add(convertConstant(bsmArg));
new MethodDescriptor(name, MethodDescriptor.parseSignature(desc))); int instance = -1; if (opcode != Opcodes.INVOKESTATIC) {
node.accept(adapter); node = nodeWithoutJsr; ValueType[] signature = MethodDescriptor.parseSignature(node.desc); MethodHolder method = new MethodHolder(referenceCache.getCached(new MethodDescriptor(node.name, signature))); parseModifiers(node.access, method, DECL_METHOD);
public static MethodDescriptor parseIfPossible(String text) { int parenIndex = text.indexOf('('); if (parenIndex < 1) { return null; } return new MethodDescriptor(text.substring(0, parenIndex), parseSignature(text.substring(parenIndex))); }
private RuntimeConstant readRuntimeConstant(DataInput input) throws IOException { byte kind = input.readByte(); switch (kind) { case 0: return new RuntimeConstant(input.readInt()); case 1: return new RuntimeConstant(input.readLong()); case 2: return new RuntimeConstant(input.readFloat()); case 3: return new RuntimeConstant(input.readDouble()); case 4: return new RuntimeConstant(input.readUTF()); case 5: return new RuntimeConstant(ValueType.parse(symbolTable.at(input.readInt()))); case 6: return new RuntimeConstant(MethodDescriptor.parseSignature(symbolTable.at(input.readInt()))); case 7: return new RuntimeConstant(readMethodHandle(input)); default: throw new IllegalArgumentException("Unexpected runtime constant type: " + kind); } } }
private RuntimeConstant convertConstant(Object value) { if (value instanceof Integer) { return new RuntimeConstant((Integer) value); } else if (value instanceof Long) { return new RuntimeConstant((Long) value); } else if (value instanceof Float) { return new RuntimeConstant((Float) value); } else if (value instanceof Double) { return new RuntimeConstant((Double) value); } else if (value instanceof String) { return new RuntimeConstant((String) value); } else if (value instanceof Type) { Type type = (Type) value; if (type.getSort() == Type.METHOD) { return new RuntimeConstant(MethodDescriptor.parseSignature(type.getDescriptor())); } else { return new RuntimeConstant(referenceCache.parseValueTypeCached(type.getDescriptor())); } } else if (value instanceof Handle) { return new RuntimeConstant(parseHandle((Handle) value)); } else { throw new IllegalArgumentException("Unknown runtime constant: " + value); } }
case Opcodes.H_INVOKEVIRTUAL: return MethodHandle.virtualCaller(handle.getOwner().replace('/', '.'), handle.getName(), MethodDescriptor.parseSignature(handle.getDesc())); case Opcodes.H_INVOKESTATIC: return MethodHandle.staticCaller(handle.getOwner().replace('/', '.'), handle.getName(), MethodDescriptor.parseSignature(handle.getDesc())); case Opcodes.H_INVOKESPECIAL: return MethodHandle.specialCaller(handle.getOwner().replace('/', '.'), handle.getName(), MethodDescriptor.parseSignature(handle.getDesc())); case Opcodes.H_NEWINVOKESPECIAL: return MethodHandle.constructorCaller(handle.getOwner().replace('/', '.'), handle.getName(), MethodDescriptor.parseSignature(handle.getDesc())); case Opcodes.H_INVOKEINTERFACE: return MethodHandle.interfaceCaller(handle.getOwner().replace('/', '.'), handle.getName(), MethodDescriptor.parseSignature(handle.getDesc())); default: throw new IllegalArgumentException("Unknown handle tag: " + handle.getTag());
new MethodDescriptor(name, MethodDescriptor.parseSignature(desc)))); for (Object bsmArg : bsmArgs) { insn.getBootstrapArguments().add(convertConstant(bsmArg));
new MethodDescriptor(name, MethodDescriptor.parseSignature(desc))); int instance = -1; if (opcode != Opcodes.INVOKESTATIC) {
private void emitFunction(ComponentFunctionBinding function, Value<?> component) { ExprPlanEmitter exprEmitter = new ExprPlanEmitter(context); LambdaPlan plan = function.getPlan(); ValueType[] signature = MethodDescriptor.parseSignature(function.getPlan().getMethodDesc()); exprEmitter.emitLambda(plan, signature[signature.length - 1] == ValueType.VOID); Value<Object> functionInstance = exprEmitter.var; ReflectClass<?> cls = findClass(function.getMethodOwner()); ReflectClass<?> lambdaCls = findClass(function.getLambdaType()); ReflectMethod setter = cls.getMethod(function.getMethodName(), lambdaCls); emit(() -> setter.invoke(component, functionInstance)); }
private void emitFunction(ComponentFunctionBinding function, Value<?> component) { ExprPlanEmitter exprEmitter = new ExprPlanEmitter(context); LambdaPlan plan = function.getPlan(); ValueType[] signature = MethodDescriptor.parseSignature(function.getPlan().getMethodDesc()); exprEmitter.emitLambda(plan, signature[signature.length - 1] == ValueType.VOID); Value<Object> functionInstance = exprEmitter.var; ReflectClass<?> cls = findClass(function.getMethodOwner()); ReflectClass<?> lambdaCls = findClass(function.getLambdaType()); ReflectMethod setter = cls.getMethod(function.getMethodName(), lambdaCls); emit(() -> setter.invoke(component, functionInstance)); }
MethodDescriptor.parseSignature(methodAlias.getDescriptor())); TeaVMEntryPoint entryPoint = vm.entryPoint(methodAlias.getAlias(), ref).async(); if (methodAlias.getTypes() != null) {
node.accept(adapter); node = nodeWithoutJsr; ValueType[] signature = MethodDescriptor.parseSignature(node.desc); MethodHolder method = new MethodHolder(node.name, signature); parseModifiers(node.access, method);