@Override public boolean isApplicable(MethodReference methodReference) { if (!methodReference.getClassName().equals(ExceptionHandling.class.getName())) { return false; } switch (methodReference.getName()) { case "findCallSiteById": return true; } return false; }
@Override public void generate(GeneratorContext context, SourceWriter writer, MethodReference methodRef) throws IOException { switch (methodRef.getName()) { case "createMetadata": generateCreateMetadata(context, writer); break; } }
@Override public boolean canHandle(MethodReference method) { if (!method.getClassName().equals(ExceptionHandling.class.getName())) { return false; } switch (method.getName()) { case "findCallSiteById": return true; default: return false; } }
@Override public boolean isApplicable(MethodReference methodReference) { if (!methodReference.getClassName().equals(Mutator.class.getName())) { return false; } switch (methodReference.getName()) { case "getStaticGCRoots": return true; default: return false; } }
@Override public boolean isApplicable(MethodReference methodReference) { if (!methodReference.getClassName().equals(DateTimeZoneProvider.class.getName())) { return false; } switch (methodReference.getName()) { case "timeZoneDetectionEnabled": return true; default: return false; } }
@Override public boolean canHandle(MethodReference method) { if (!method.getClassName().equals(Array.class.getName())) { return false; } switch (method.getName()) { case "getImpl": return true; default: return false; } }
@Override public void generate(InjectorContext context, MethodReference methodRef) throws IOException { switch (methodRef.getName()) { case "supplyResources": generateSupplyResources(context); break; } }
public String forVirtualMethod(MethodReference method) { return virtualMethodNames.computeIfAbsent(method, k -> { Set<String> occupied = occupiedVtableNames.computeIfAbsent(k.getClassName(), c -> new HashSet<>(Arrays.asList("parent"))); return pickUnoccupied("virt_" + k.getName(), occupied); }); }
private boolean isSpecialCallInstruction(Instruction insn) { if (!(insn instanceof InvokeInstruction)) { return false; } MethodReference method = ((InvokeInstruction) insn).getMethod(); return method.getClassName().equals(ExceptionHandling.class.getName()) && method.getName().startsWith("throw"); }
@Override public WasmExpression apply(InvocationExpr invocation, WasmIntrinsicManager manager) { switch (invocation.getMethod().getName()) { case "timeZoneDetectionEnabled": { boolean enabled = properties.getProperty("java.util.TimeZone.autodetect", "false").equals("true"); return new WasmInt32Constant(enabled ? 1 : 0); } default: throw new AssertionError(); } } }
private String suggestForMethod(MethodReference method) { StringBuilder sb = new StringBuilder(); suggestForClass(method.getClassName(), sb); sb.append('_'); sb.append(sanitize(method.getName())); return sb.toString(); }
@Override public void methodReached(DependencyAgent agent, MethodDependency method) { switch (method.getReference().getName()) { case "doArrayCopy": reachArrayCopy(method); break; } }
@Override public boolean isVirtual(VirtualMethodContributorContext context, MethodReference methodRef) { ClassReader cls = context.getClassSource().get(methodRef.getClassName()); if (cls == null || !cls.getInterfaces().contains(PlatformAnnotationProvider.class.getName())) { return false; } return methodRef.getName().equals("getAnnotations"); } }
@Override public void methodReached(final DependencyAgent agent, MethodDependency method) { if (!method.getReference().getClassName().equals(Platform.class.getName())) { return; } switch (method.getReference().getName()) { case "objectFromResource": allClasses.connect(method.getResult()); break; } } }
@Override public void apply(IntrinsicContext context, InvocationExpr invocation) { switch (invocation.getMethod().getName()) { case "divideUnsigned": writeBinary(context, invocation, "/"); break; case "remainderUnsigned": writeBinary(context, invocation, "%"); break; } }
@Override public void apply(IntrinsicContext context, InvocationExpr invocation) { switch (invocation.getMethod().getName()) { case "getStaticGCRoots": context.writer().print("gc_staticRoots"); break; } } }
@Override public void methodReached(DependencyAgent agent, MethodDependency method) { if (!method.getReference().getClassName().equals(ResourceAccessor.class.getName())) { return; } switch (method.getReference().getName()) { case "castToString": method.getResult().propagate(agent.getType("java.lang.String")); break; } } }
@Override public void apply(IntrinsicContext context, InvocationExpr invocation) { context.writer().print("gc_").print(invocation.getMethod().getName()); } }
@Override public void apply(IntrinsicContext context, InvocationExpr invocation) { switch (invocation.getMethod().getName()) { case "getPlatformClass": context.writer().print("CLASS_OF("); context.emit(invocation.getArguments().get(0)); context.writer().print(")"); break; } } }
@Override public void apply(IntrinsicContext context, InvocationExpr invocation) { switch (invocation.getMethod().getName()) { case "findCallSiteById": context.writer().print("(callSites + "); context.emit(invocation.getArguments().get(0)); context.writer().print(")"); break; } } }