Ejemplo n.º 1
0
 protected MacroNode(
     NodeClass<? extends MacroNode> c,
     InvokeKind invokeKind,
     ResolvedJavaMethod targetMethod,
     int bci,
     StampPair returnStamp,
     ValueNode... arguments) {
   super(c, returnStamp.getTrustedStamp());
   assert targetMethod.getSignature().getParameterCount(!targetMethod.isStatic())
       == arguments.length;
   this.arguments = new NodeInputList<>(this, arguments);
   this.bci = bci;
   this.targetMethod = targetMethod;
   this.returnStamp = returnStamp;
   this.invokeKind = invokeKind;
   assert !isPlaceholderBci(bci);
 }
 static ResolvedJavaMethod findMethod(
     ResolvedJavaType type, String name, String descriptor, boolean isStatic) {
   if (isStatic && name.equals("<clinit>")) {
     ResolvedJavaMethod method = type.getClassInitializer();
     if (method != null) {
       return method;
     }
   }
   ResolvedJavaMethod[] methodsToSearch =
       name.equals("<init>") ? type.getDeclaredConstructors() : type.getDeclaredMethods();
   for (ResolvedJavaMethod method : methodsToSearch) {
     if (method.isStatic() == isStatic
         && method.getName().equals(name)
         && method.getSignature().toMethodDescriptor().equals(descriptor)) {
       return method;
     }
   }
   return null;
 }
 @Override
 public Bytecode getBytecode(ResolvedJavaMethod method) {
   Classfile classfile = getClassfile(resolveToClass(method.getDeclaringClass().getName()));
   return classfile.getCode(method.getName(), method.getSignature().toMethodDescriptor());
 }