Esempio n. 1
0
 private void doVisitMethod(
     ProcessedMethod method, Map<ProcessedMethod, Object> colours, List<CallSite> calls) {
   if (colours.get(method) == GREY) {
     visitMethod(method, Collections.unmodifiableList(calls));
     colours.put(method, BLACK);
   }
 }
Esempio n. 2
0
  private void scan(
      ProcessedMethod caller,
      Map<MethodSymbol, ProcessedMethod> methods,
      Map<ProcessedMethod, Object> colours,
      Stack<CallSite> calls) {
    Object colour = colours.get(caller);
    if (colour == WHITE) {
      colours.put(caller, GREY);

      if (caller.error == null) {
        // do inline first:
        for (CallSite call : caller.calls) {
          ProcessedMethod callee = methods.get(call.callee);
          if (callee != null && isEarlyMethod(callee)) {
            calls.push(new CallSite(callee.sym, caller.sym, call.call));
            scan(callee, methods, colours, calls);
            calls.pop();
          }
        }

        // Emit callees first
        if (isEarlyMethod(caller)) {
          doVisitMethod(caller, colours, calls);
        }

        for (CallSite call : caller.calls) {
          ProcessedMethod callee = methods.get(call.callee);
          if (callee != null && !isEarlyMethod(callee)) {
            calls.push(new CallSite(callee.sym, caller.sym, call.call));
            scan(callee, methods, colours, calls);
            calls.pop();
          }
        }
      }

      doVisitMethod(caller, colours, calls);
    }
  }