Example #1
0
oop Profiler::copy_time_info(oop time_pt) {
  // Make a copy of the prototype
  oop time_node= time_pt->clone(CANFAIL);
  if (time_node == failedAllocationOop) return failedAllocationOop;

  time_info  t(time_pt);

  t.fill(time_node, this);
  return time_node;
}
Example #2
0
void map_enumeration::add_obj(oop obj) {
  assert(graph_maps->member(obj->map()->enclosing_mapOop()), "map should be known");
  if (!graph_maps->find(obj->map()->enclosing_mapOop())) {
    if (obj->is_block()) {
      // TO BE FIXED WHEN THE SIC IS BETTER TO KILL BLOCK OOPS WHEN
      // A SCOPE TREMINATE. 3/31/93 LB.
      // Clone and kill the copy to avoid the problem.
      obj = obj->clone(); 
      blockOop(obj)->kill_block();
    }
    graph_maps->update(obj->map()->enclosing_mapOop(), obj);
  }
}
Example #3
0
oop graph_creator::clone_fold_edge_pt(fold_edge* e) {
  oop oop_node= fold_edge_pt->clone(CANFAIL);
  if (oop_node == failedAllocationOop) return failedAllocationOop;

  // find the fold node
  oop fold_oop = NULL;
  for (int i = node_path->length() - 1; i >= 0 && !fold_oop ; i--) {
    if(node_path->nth(i)->callee == e->callee) fold_oop = oop_path->nth(i);
  }
  assert(fold_oop,"fold node should be on stack");

  fold_pt_info->fill(oop_node, e, fold_oop);
  return oop_node;
}
Example #4
0
oop slotsMap::change_slot(oop obj,
                          slotDesc* slot,
                          slotType type, 
                          oop contents,
                          oop anno,
                          bool mustAllocate) {
  assert(slot != NULL, "cannot change the contents of a non-existent slot");
  assert(!obj->is_string(), "cannot clone strings!");
  assert_slots(obj, "object isn't a slotsOop");

  slotsOop new_obj= slotsOop(obj->clone(mustAllocate));
  if (oop(new_obj) == failedAllocationOop) return failedAllocationOop;
  switch (slot->type->slot_type()) {
   case obj_slot_type:
    assert(NakedMethods || !contents->has_code() || slot->type->is_vm_slot(),
           "adding an assignable slot with code");
    assert_smi(slot->data, "data slot contents isn't an offset");
    new_obj->at_put(smiOop(slot->data)->value(), contents);
    break;
   case map_slot_type:
    break;
   case arg_slot_type:
    assert_smi(contents, "argument index isn't a smiOop");
    break;
   default:
    ShouldNotReachHere(); // unexpected slot type
  }

  if (    slot->data == contents
      &&  slot->type == type
      &&  slot->get_annotation() == anno) {
    // no change (to the map, at least)!
    return new_obj;
  }
  
  // create a new map for this object
  slotsMap* new_map= copy_for_changing(mustAllocate);
  if (new_map == NULL) return failedAllocationOop;
  slot = slot->shift(this, new_map);
  slot->type = type;
  slot->set_annotation(anno);
  if (!slot->is_obj_slot()) {
    Memory->store(&slot->data, contents);
  }

  new_obj->set_canonical_map(new_map);
  
  return new_obj;
}
Example #5
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();
}
Example #6
0
oop graph_creator::clone_leaf_node_pt(leaf_node* n) {
  oop oop_node= leaf_node_pt->clone(CANFAIL);
  if (oop_node == failedAllocationOop) return failedAllocationOop;
  leaf_pt_info->fill(oop_node, n);
  return oop_node;
}
Example #7
0
oop graph_creator::clone_access_node_pt(access_node* n) {
  oop oop_node= access_node_pt->clone(CANFAIL);
  if (oop_node == failedAllocationOop) return failedAllocationOop;
  access_pt_info->fill(this, oop_node, n);
  return oop_node;
}