Beispiel #1
0
char* sendDesc::sendMessage( frame* lookupFrame,
                             oop receiver,
                             oop perform_selector,
                             oop perform_delegatee,
                             oop arg1 ) {
  ShowLookupInMonitor sl;

  LookupType type= lookupType();

  oop sel = static_or_dynamic_selector(  perform_selector,  type);
  oop del = static_or_dynamic_delegatee( perform_delegatee, type);

  sendMessagePrologue( receiver, lookupFrame );

  if ( !Trace) {
    // try codeTable first (order of magnitude faster)
  
    char* r = fastCacheLookupAndBackpatch(type,
                                          receiver->map()->enclosing_mapOop(),
                                          sel,
                                          del);
    if (r) {
      if (SilentTrace) LOG_EVENT1("SendMessage: fast-found %#lx", r);
      return r;
    }
  }

  // have to do it the slow way
  ResourceMark m;
  FlushRegisterWindows(); // for vframe conversion below
  cacheProbingLookup L( receiver,
                        sel,
                        del,
                        MH_TBD,  // method holder
                        new_vframe(lookupFrame),
                        this,
                        NULL,    // DIDesc
                        false ); // don't want a debug version

  // should we have switched stacks sooner? (dmu) also in SendDIMessage
  
  nmethod* nm = switchToVMStack( SendMessage_cont, &L );
  if (SilentTrace) LOG_EVENT1("sendDesc::sendMessage: found %#lx", nm);

  return
    Interpret
    ? L.interpretResultForCompiledSender(arg1)
    : nm->verifiedEntryPoint();
}
Beispiel #2
0
oop Profiler::copy_call_graph(oop method_pt, oop block_pt, oop access_pt,
                              oop prim_pt,   oop leaf_pt,  oop fold_pt,
                              oop unknown_oop,
                              smi cutoff_pct) {
  ResourceMark rm;

  if ( ProfilerIgnoreCallGraph  ||  !root->edges ) {
    // If the call graph is ignored the root contains the
    // accumulated timing and allocation information
    
    if (!this->root->edges)
      warning("Profiler::copy_call_graph: root edges are NULL, profiled program probably was too brief");
    
    oop node = leaf_pt->clone(CANFAIL);
    if (node == failedAllocationOop) return failedAllocationOop;
    leaf_node_info* leaf_pt_info = new leaf_node_info(leaf_pt);
    leaf_pt_info->fill(node, root);
    return node;
  }
  
  if ( PrintProfiling ) {
    // Old debugging code; checking for multiple roots -- dmu 2/04
    int c; float t;
    graph_totaller::compute_totals(root_edge, c, t);
    lprintf("in copy_call_graph: count = %d, time = %g\n", c, t);
    lprintf(" and root and rootedge are ");
    {
      for (call_graph_edge* e = root_edge;  e; e = e->next) {
        e->callee->print_node(), lprintf("\n");
          for (call_graph_edge* ee = e->callee->edges;  ee; ee = ee->next)
            lprintf("     "),  ee->callee->print_node(), lprintf("\n");
      }
    }
    lprintf("\n\n");
  }

  // Prepare for the enumeration by collecting all referred maps in the graph.
  MapTable graph_maps; 
  { 
    ResourceMark rm2;
    map_collector collector(this->root->edges, &graph_maps);
    _collector = &collector;
    switchToVMStack(cont_collect);
  }

  // Enumerate the maps
  {
    ResourceMark rm2;
    map_enumeration enumeration(&graph_maps);
    enumeration.enumerate();
  }
  
  graph_creator creator(this->root->edges, &graph_maps,
                        method_pt, block_pt, access_pt,
                        prim_pt,   leaf_pt,  fold_pt, unknown_oop, cutoff_pct);

  // Do the recursive graph traversal on the VM stack.
  _creator = &creator;
  switchToVMStack(cont_copy);

  graph_maps.deallocate();
  
  return creator.ran_out_of_memory() ? failedAllocationOop : creator.root();
}