int instanceKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
  assert(obj->is_klass(),"must be a klass");
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(),
         "must be instance klass");

  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
  ik->vtable()->oop_update_pointers(cm);
  ik->itable()->oop_update_pointers(cm);

  oop* const beg_oop = ik->oop_block_beg();
  oop* const end_oop = ik->oop_block_end();
  for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) {
    PSParallelCompact::adjust_pointer(cur_oop);
  }
  // embedded oops
  if (ik->adr_implementor() != NULL) {
    PSParallelCompact::adjust_pointer(ik->adr_implementor());
  }
  if (ik->adr_host_klass() != NULL) {
    PSParallelCompact::adjust_pointer(ik->adr_host_klass());
  }

  OopClosure* closure = PSParallelCompact::adjust_root_pointer_closure();
  iterate_c_heap_oops(ik, closure);

  klassKlass::oop_update_pointers(cm, obj);
  return ik->object_size();
}
int instanceKlassKlass::oop_adjust_pointers(oop obj) {
  assert(obj->is_klass(),"must be a klass");
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");

  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
  ik->vtable()->oop_adjust_pointers();
  ik->itable()->oop_adjust_pointers();

  MarkSweep::adjust_pointer(ik->adr_array_klasses());
  MarkSweep::adjust_pointer(ik->adr_methods());
  MarkSweep::adjust_pointer(ik->adr_method_ordering());
  MarkSweep::adjust_pointer(ik->adr_local_interfaces());
  MarkSweep::adjust_pointer(ik->adr_transitive_interfaces());
  MarkSweep::adjust_pointer(ik->adr_fields());
  MarkSweep::adjust_pointer(ik->adr_constants());
  MarkSweep::adjust_pointer(ik->adr_class_loader());
  MarkSweep::adjust_pointer(ik->adr_protection_domain());
  if (ik->adr_host_klass() != NULL) {
    MarkSweep::adjust_pointer(ik->adr_host_klass());
  }
  MarkSweep::adjust_pointer(ik->adr_signers());
  MarkSweep::adjust_pointer(ik->adr_inner_classes());
  if (ik->adr_implementor() != NULL) {
    MarkSweep::adjust_pointer(ik->adr_implementor());
  }
  MarkSweep::adjust_pointer(ik->adr_class_annotations());
  MarkSweep::adjust_pointer(ik->adr_fields_annotations());
  MarkSweep::adjust_pointer(ik->adr_methods_annotations());
  MarkSweep::adjust_pointer(ik->adr_methods_parameter_annotations());
  MarkSweep::adjust_pointer(ik->adr_methods_default_annotations());

  iterate_c_heap_oops(ik, &MarkSweep::adjust_root_pointer_closure);

  return klassKlass::oop_adjust_pointers(obj);
}
Esempio n. 3
0
PRIM_DECL_1(behaviorPrimitives::can_be_subclassed, oop behavior) {
  PROLOGUE_1("can_be_subclassed", behavior);
  if (!behavior->is_klass())
    return markSymbol(vmSymbols::first_argument_has_wrong_type());

  return klassOop(behavior)->klass_part()->can_be_subclassed() ? trueObj : falseObj;
}
int instanceKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
                                            HeapWord* beg_addr,
                                            HeapWord* end_addr) {
  assert(obj->is_klass(),"must be a klass");
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(),
         "must be instance klass");

  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
  ik->update_static_fields(beg_addr, end_addr);
  ik->vtable()->oop_update_pointers(cm, beg_addr, end_addr);
  ik->itable()->oop_update_pointers(cm, beg_addr, end_addr);

  oop* const beg_oop = MAX2((oop*)beg_addr, ik->oop_block_beg());
  oop* const end_oop = MIN2((oop*)end_addr, ik->oop_block_end());
  for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) {
    PSParallelCompact::adjust_pointer(cur_oop);
  }

  // The oop_map_cache, jni_ids and jni_id_map are allocated from the C heap,
  // and so don't lie within any 'Chunk' boundaries.  Update them when the
  // lowest addressed oop in the instanceKlass 'oop_block' is updated.
  if (beg_oop == ik->oop_block_beg()) {
    OopClosure* closure = PSParallelCompact::adjust_root_pointer_closure();
    iterate_c_heap_oops(ik, closure);
  }

  klassKlass::oop_update_pointers(cm, obj, beg_addr, end_addr);
  return ik->object_size();
}
Esempio n. 5
0
PRIM_DECL_1(behaviorPrimitives::vm_type, oop behavior) {
  PROLOGUE_1("format", behavior);
  if (!behavior->is_klass())
    return markSymbol(vmSymbols::first_argument_has_wrong_type());

  Klass::Format f = klassOop(behavior)->klass_part()->format();

  switch (f) {
   case Klass::mem_klass:              return vmSymbols::mem_klass();
   case Klass::association_klass:      return vmSymbols::association_klass();
   case Klass::blockClosure_klass:     return vmSymbols::blockClosure_klass();
   case Klass::byteArray_klass:        return vmSymbols::byteArray_klass();
   case Klass::symbol_klass:           return vmSymbols::symbol_klass();
   case Klass::context_klass:          return vmSymbols::context_klass();
   case Klass::doubleByteArray_klass:  return vmSymbols::doubleByteArray_klass();
   case Klass::doubleValueArray_klass: return vmSymbols::doubleValueArray_klass();
   case Klass::double_klass:           return vmSymbols::double_klass();
   case Klass::klass_klass:            return vmSymbols::klass_klass();
   case Klass::method_klass:           return vmSymbols::method_klass();
   case Klass::mixin_klass:            return vmSymbols::mixin_klass();
   case Klass::objArray_klass:         return vmSymbols::objArray_klass();
   case Klass::weakArray_klass:        return vmSymbols::weakArray_klass();
   case Klass::process_klass:          return vmSymbols::process_klass();
   case Klass::vframe_klass:           return vmSymbols::vframe_klass();
   case Klass::proxy_klass:            return vmSymbols::proxy_klass();
   case Klass::smi_klass:              return vmSymbols::smi_klass();
   default: 
     fatal("wrong format for klass");
  }
  return markSymbol(vmSymbols::first_argument_has_wrong_type());
}
Esempio n. 6
0
PRIM_DECL_1(behaviorPrimitives::mixinOf, oop behavior) {
  PROLOGUE_1("mixinOf", behavior);
  if (!behavior->is_klass())
    return markSymbol(vmSymbols::first_argument_has_wrong_type());

  return klassOop(behavior)->klass_part()->mixin();
}
Esempio n. 7
0
PRIM_DECL_1(behaviorPrimitives::nonIndexableSize, oop behavior) {
  PROLOGUE_1("nonIndexableSize", behavior);
  if (!behavior->is_klass())
    return markSymbol(vmSymbols::first_argument_has_wrong_type());

  return as_smiOop(klassOop(behavior)->klass_part()->non_indexable_size());
}
PRIM_DECL_2(doubleValueArrayPrimitives::allocateSize, oop receiver, oop argument) {
  PROLOGUE_2("allocateSize", receiver, argument)
  assert(receiver->is_klass() && klassOop(receiver)->klass_part()->oop_is_doubleValueArray(),
         "receiver must double byte array class");
  if (!argument->is_smi())
    markSymbol(vmSymbols::first_argument_has_wrong_type());

  if (smiOop(argument)->value() < 0)
    return markSymbol(vmSymbols::negative_size());

  int length = smiOop(argument)->value();

  klassOop k        = klassOop(receiver);
  int      ni_size  = k->klass_part()->non_indexable_size();
  int      obj_size = ni_size + 1 + roundTo(length * sizeof(double), oopSize) / oopSize;
  // allocate
  doubleValueArrayOop obj = as_doubleValueArrayOop(Universe::allocate(obj_size, (memOop*)&k));
  // header
  memOop(obj)->initialize_header(true, k);
  // instance variables
  memOop(obj)->initialize_body(memOopDesc::header_size(), ni_size);
  obj->set_length(length);
  for (int index = 1; index <= length; index++) {
    obj->double_at_put(index, 0.0);
  }
  return obj;
}
Esempio n. 9
0
PRIM_DECL_1(behaviorPrimitives::is_specialized_class, oop behavior) {
  PROLOGUE_1("is_specialized_class", behavior);
  if (!behavior->is_klass())
    return markSymbol(vmSymbols::first_argument_has_wrong_type());

  return klassOop(behavior)->klass_part()->is_specialized_class() ? trueObj : falseObj;
}
Esempio n. 10
0
PRIM_DECL_1(behaviorPrimitives::can_have_instance_variables, oop behavior) {
  PROLOGUE_1("can_have_instance_variables", behavior);
  if (!behavior->is_klass())
    return markSymbol(vmSymbols::first_argument_has_wrong_type());

  return klassOop(behavior)->klass_part()->can_have_instance_variables() ? trueObj : falseObj;
}
// The transitive_interfaces is the last field set when loading an object.
void instanceKlassKlass::oop_set_partially_loaded(oop obj) {
  assert(obj->is_klass(), "object must be klass");
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
  assert(ik-oop_is_instance(), "object must be instanceKlass");
  assert(ik->transitive_interfaces() == NULL, "just checking");
  ik->set_transitive_interfaces((objArrayOop) obj);   // Temporarily set transitive_interfaces to point to self
}
int instanceKlassKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
  assert(obj->is_klass(),"must be a klass");
  assert(klassOop(obj)->klass_part()->oop_is_instance(), "must be instance klass");
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
  // Get size before changing pointers.
  // Don't call size() or oop_size() since that is a virtual call.
  int size = ik->object_size();

  ik->iterate_static_fields(blk);
  ik->vtable()->oop_oop_iterate(blk);
  ik->itable()->oop_oop_iterate(blk);

  blk->do_oop(ik->adr_array_klasses());
  blk->do_oop(ik->adr_methods());
  blk->do_oop(ik->adr_method_ordering());
  blk->do_oop(ik->adr_local_interfaces());
  blk->do_oop(ik->adr_transitive_interfaces());
  blk->do_oop(ik->adr_fields());
  blk->do_oop(ik->adr_constants());
  blk->do_oop(ik->adr_class_loader());
  blk->do_oop(ik->adr_protection_domain());
  blk->do_oop(ik->adr_signers());
  blk->do_oop(ik->adr_source_file_name());
  blk->do_oop(ik->adr_source_debug_extension());
  blk->do_oop(ik->adr_inner_classes());
  blk->do_oop(ik->adr_implementor());
  blk->do_oop(ik->adr_previous_version());

  klassKlass::oop_oop_iterate(obj, blk);

  if(ik->oop_map_cache() != NULL) ik->oop_map_cache()->oop_iterate(blk);
  return size;
}
int instanceKlassKlass::oop_adjust_pointers(oop obj) {
  assert(obj->is_klass(),"must be a klass");
  assert(klassOop(obj)->klass_part()->oop_is_instance(), "must be instance klass");

  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
  ik->adjust_static_fields();
  ik->vtable()->oop_adjust_pointers();
  ik->itable()->oop_adjust_pointers();

  MarkSweep::adjust_pointer(ik->adr_array_klasses());
  MarkSweep::adjust_pointer(ik->adr_methods());
  MarkSweep::adjust_pointer(ik->adr_method_ordering());
  MarkSweep::adjust_pointer(ik->adr_local_interfaces());
  MarkSweep::adjust_pointer(ik->adr_transitive_interfaces());
  MarkSweep::adjust_pointer(ik->adr_fields());
  MarkSweep::adjust_pointer(ik->adr_constants());
  MarkSweep::adjust_pointer(ik->adr_class_loader());
  MarkSweep::adjust_pointer(ik->adr_protection_domain());
  MarkSweep::adjust_pointer(ik->adr_signers());
  MarkSweep::adjust_pointer(ik->adr_source_file_name());
  MarkSweep::adjust_pointer(ik->adr_source_debug_extension());
  MarkSweep::adjust_pointer(ik->adr_inner_classes());
  MarkSweep::adjust_pointer(ik->adr_implementor());
  MarkSweep::adjust_pointer(ik->adr_previous_version());

  if (ik->oop_map_cache() != NULL) {
    ik->oop_map_cache()->oop_iterate(&MarkSweep::adjust_root_pointer_closure);
  }

  if (ik->jni_ids() != NULL) {
    ik->jni_ids()->oops_do(&MarkSweep::adjust_root_pointer_closure);
  }

  return klassKlass::oop_adjust_pointers(obj);
}
Esempio n. 14
0
void klassKlass::oop_verify_on(oop obj, outputStream* st) {
  Klass::oop_verify_on(obj, st);
  guarantee(obj->is_perm(),                      "should be in permspace");
  guarantee(obj->is_klass(),                     "should be klass");

  Klass* k = Klass::cast(klassOop(obj));
  if (k->super() != NULL) {
    guarantee(k->super()->is_perm(),             "should be in permspace");
    guarantee(k->super()->is_klass(),            "should be klass");
  }
  klassOop ko = k->secondary_super_cache();
  if( ko != NULL ) {
    guarantee(ko->is_perm(),                     "should be in permspace");
    guarantee(ko->is_klass(),                    "should be klass");
  }
  for( uint i = 0; i < primary_super_limit(); i++ ) {
    oop ko = k->adr_primary_supers()[i]; // Cannot use normal accessor because it asserts
    if( ko != NULL ) {
      guarantee(ko->is_perm(),                   "should be in permspace");
      guarantee(ko->is_klass(),                  "should be klass");
    }
  }

  if (k->java_mirror() != NULL || (k->oop_is_instance() && instanceKlass::cast(klassOop(obj))->is_loaded())) {
    guarantee(k->java_mirror() != NULL,          "should be allocated");
    guarantee(k->java_mirror()->is_perm(),       "should be in permspace");
    guarantee(k->java_mirror()->is_instance(),   "should be instance");
  }
  if (k->name() != NULL) {
    guarantee(Universe::heap()->is_in_permanent(k->name()),
              "should be in permspace");
    guarantee(k->name()->is_symbol(), "should be symbol");
  }
}
Esempio n. 15
0
PRIM_DECL_2(doubleByteArrayPrimitives::allocateSize, oop receiver, oop argument) {
  PROLOGUE_2("allocateSize", receiver, argument)
  assert(receiver->is_klass() && klassOop(receiver)->klass_part()->oop_is_doubleByteArray(),
         "receiver must double byte array class");
  if (!argument->is_smi())
    markSymbol(vmSymbols::first_argument_has_wrong_type());

  if (smiOop(argument)->value() < 0)
    return markSymbol(vmSymbols::negative_size());

  klassOop k        = klassOop(receiver);
  int      ni_size  = k->klass_part()->non_indexable_size();
  int      obj_size = ni_size + 1 + roundTo(smiOop(argument)->value() * 2, oopSize) / oopSize;
  // allocate
  doubleByteArrayOop obj = as_doubleByteArrayOop(Universe::allocate(obj_size, (memOop*)&k));
  // header
  memOop(obj)->initialize_header(true, k);
  // instance variables
  memOop(obj)->initialize_body(memOopDesc::header_size(), ni_size);
  // indexables
  oop* base = (oop*) obj->addr();
  oop* end  = base + obj_size;
  // %optimized 'obj->set_length(size)'
  base[ni_size] = argument;
  // %optimized 'for (int index = 1; index <= size; index++)
  //               obj->doubleByte_at_put(index, 0)'
  base = &base[ni_size+1];
  while (base < end) *base++ = (oop) 0;
  return obj;
}
Esempio n. 16
0
PRIM_DECL_1(behaviorPrimitives::headerSize, oop behavior) {
  PROLOGUE_1("headerSize", behavior);
  if (!behavior->is_klass())
    return markSymbol(vmSymbols::first_argument_has_wrong_type());

  return as_smiOop(klassOop(behavior)->klass_part()->oop_header_size());
}
Esempio n. 17
0
PRIM_DECL_1(behaviorPrimitives::format, oop behavior) {
  PROLOGUE_1("format", behavior);
  if (!behavior->is_klass())
    return markSymbol(vmSymbols::first_argument_has_wrong_type());

  char* format_name =  Klass::name_from_format(klassOop(behavior)->klass_part()->format());
  return oopFactory::new_symbol(format_name);
}
int arrayKlassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk, MemRegion mr) {
  assert (obj->is_klass(), "must be klass");
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
  blk->do_oop(ak->adr_lower_dimension());
  blk->do_oop(ak->adr_higher_dimension());
  ak->vtable()->oop_oop_iterate_m(blk, mr);
  return klassKlass::oop_oop_iterate_m(obj, blk, mr);
}
Esempio n. 19
0
int arrayKlassKlass::oop_oop_iterate(oop obj, OopClosure* blk) {
  assert(obj->is_klass(), "must be klass");
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
  blk->do_oop(ak->adr_component_mirror());
  blk->do_oop(ak->adr_lower_dimension());
  blk->do_oop(ak->adr_higher_dimension());
  ak->vtable()->oop_oop_iterate(blk);
  return klassKlass::oop_oop_iterate(obj, blk);
}
// The transitive_interfaces is the last field set when loading an object.
void instanceKlassKlass::oop_set_partially_loaded(oop obj) {
  assert(obj->is_klass(), "object must be klass");
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
  // Set the layout helper to a place-holder value, until fuller initialization.
  // (This allows asserts in oop_is_instance to succeed.)
  ik->set_layout_helper(Klass::instance_layout_helper(0, true));
  assert(ik->oop_is_instance(), "object must be instanceKlass");
  assert(ik->transitive_interfaces() == NULL, "just checking");
  ik->set_transitive_interfaces((objArrayOop) obj);   // Temporarily set transitive_interfaces to point to self
}
int instanceKlassKlass::oop_oop_iterate_m(oop obj, OopClosure* blk,
                                           MemRegion mr) {
  assert(obj->is_klass(),"must be a klass");
  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(), "must be instance klass");
  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
  // Get size before changing pointers.
  // Don't call size() or oop_size() since that is a virtual call.
  int size = ik->object_size();

  ik->vtable()->oop_oop_iterate_m(blk, mr);
  ik->itable()->oop_oop_iterate_m(blk, mr);

  oop* adr;
  adr = ik->adr_array_klasses();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_methods();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_method_ordering();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_local_interfaces();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_transitive_interfaces();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_fields();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_constants();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_class_loader();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_protection_domain();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_host_klass();
  if (adr != NULL && mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_signers();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_inner_classes();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_implementor();
  if (adr != NULL && mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_class_annotations();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_fields_annotations();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_methods_annotations();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_methods_parameter_annotations();
  if (mr.contains(adr)) blk->do_oop(adr);
  adr = ik->adr_methods_default_annotations();
  if (mr.contains(adr)) blk->do_oop(adr);

  klassKlass::oop_oop_iterate_m(obj, blk, mr);

  if(ik->oop_map_cache() != NULL) ik->oop_map_cache()->oop_iterate(blk, mr);
  return size;
}
void arrayKlassKlass::oop_follow_contents(oop obj) {
  assert (obj->is_klass(), "must be klass");
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
  MarkSweep::mark_and_push(ak->adr_lower_dimension() );
  MarkSweep::mark_and_push(ak->adr_higher_dimension() );
  {
    HandleMark hm;
    ak->vtable()->oop_follow_contents();
  }
  klassKlass::oop_follow_contents(obj);
}
int arrayKlassKlass::oop_adjust_pointers(oop obj) {
  assert (obj->is_klass(), "must be klass");
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
  MarkSweep::adjust_pointer(ak->adr_lower_dimension() );
  MarkSweep::adjust_pointer(ak->adr_higher_dimension() );
  {
    HandleMark hm;
    ak->vtable()->oop_adjust_pointers();
  }
  return klassKlass::oop_adjust_pointers(obj);
}
Esempio n. 24
0
PRIM_DECL_2(behaviorPrimitives::classVariableAt, oop behavior, oop index) {
  PROLOGUE_2("classVariableAt", behavior, index);
  if (!behavior->is_klass())
    return markSymbol(vmSymbols::first_argument_has_wrong_type());
  if (!index->is_smi())
    return markSymbol(vmSymbols::second_argument_has_wrong_type());

  int i = smiOop(index)->value();
  if (i > 0 && i <= klassOop(behavior)->klass_part()->number_of_classVars())
    return klassOop(behavior)->klass_part()->classVar_at(i);
  return markSymbol(vmSymbols::out_of_bounds());
}
Esempio n. 25
0
int arrayKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj) {
  assert(obj->is_klass(), "must be klass");
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
  PSParallelCompact::adjust_pointer(ak->adr_component_mirror());
  PSParallelCompact::adjust_pointer(ak->adr_lower_dimension());
  PSParallelCompact::adjust_pointer(ak->adr_higher_dimension());
  {
    HandleMark hm;
    ak->vtable()->oop_update_pointers(cm);
  }
  return klassKlass::oop_update_pointers(cm, obj);
}
Esempio n. 26
0
 virtual void do_object(oop obj) {
   if (obj->is_klass()) {
     Klass* k = klassOop(obj)->klass_part();
     if (k->name() != NULL) {
       ResourceMark rm;
       const char* ext = k->external_name();
       if ( strcmp(_target, ext) == 0 ) {
         tty->print_cr("Found " INTPTR_FORMAT, obj);
         obj->print();
       }
     }
   }
 }
Esempio n. 27
0
void arrayKlassKlass::oop_follow_contents(ParCompactionManager* cm,
                                          oop obj) {
  assert(obj->is_klass(), "must be klass");
  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
  PSParallelCompact::mark_and_push(cm, ak->adr_component_mirror());
  PSParallelCompact::mark_and_push(cm, ak->adr_lower_dimension());
  PSParallelCompact::mark_and_push(cm, ak->adr_higher_dimension());
  {
    HandleMark hm;
    ak->vtable()->oop_follow_contents(cm);
  }
  klassKlass::oop_follow_contents(cm, obj);
}
Esempio n. 28
0
object_type ClassifyObjectClosure::classify_object(oop obj, bool count) {
  object_type type = unknown_type;

  Klass* k = obj->blueprint();

  if (k->as_klassOop() == SystemDictionary::Object_klass()) {
    tty->print_cr("Found the class!");
  }

  if (count) {
    k->set_alloc_count(k->alloc_count() + 1);
  }

  if (obj->is_instance()) {
    if (k->oop_is_instanceRef()) {
      type = instanceRef_type;
    } else {
      type = instance_type;
    }
  } else if (obj->is_typeArray()) {
    type = typeArray_type;
  } else if (obj->is_objArray()) {
    type = objArray_type;
  } else if (obj->is_symbol()) {
    type = symbol_type;
  } else if (obj->is_klass()) {
    Klass* k = ((klassOop)obj)->klass_part();
    if (k->oop_is_instance()) {
      type = instanceKlass_type;
    } else {
      type = klass_type;
    }
  } else if (obj->is_method()) {
    type = method_type;
  } else if (obj->is_constMethod()) {
    type = constMethod_type;
  } else if (obj->is_methodData()) {
    ShouldNotReachHere();
  } else if (obj->is_constantPool()) {
    type = constantPool_type;
  } else if (obj->is_constantPoolCache()) {
    type = constantPoolCache_type;
  } else if (obj->is_compiledICHolder()) {
    type = compiledICHolder_type;
  } else {
    ShouldNotReachHere();
  }

  assert(type != unknown_type, "found object of unknown type.");
  return type;
}
Esempio n. 29
0
PRIM_DECL_2(behaviorPrimitives::setSuperclass, oop receiver, oop newSuper) {
  PROLOGUE_2("setSuperclass", receiver, newSuper);
  if (!receiver->is_klass())
    return markSymbol(vmSymbols::receiver_has_wrong_type());
  if (!(newSuper->is_klass() || newSuper == nilObj))
    return markSymbol(vmSymbols::first_argument_has_wrong_type());

  Klass* receiverClass = klassOop(receiver)->klass_part();
  klassOop newSuperclass;
  if (receiverClass->superKlass() == newSuper) return receiver; // no change
  if (receiverClass->superKlass() == nilObj) {
    newSuperclass = klassOop(newSuper);
    if (newSuperclass->klass_part()->number_of_instance_variables() > 0)
      return markSymbol(vmSymbols::argument_is_invalid());
  } else {
    Klass* oldSuperclass = receiverClass->superKlass()->klass_part();
    if (newSuper == nilObj) {
      newSuperclass = klassOop(nilObj);
      if (oldSuperclass->number_of_instance_variables() > 0)
        return markSymbol(vmSymbols::argument_is_invalid());
    } else {
      newSuperclass = klassOop(newSuper);

      if (!oldSuperclass->has_same_inst_vars_as(newSuperclass))
        return markSymbol(vmSymbols::invalid_klass());
    }
  }
  receiverClass->set_superKlass(newSuperclass);
  
  Universe::flush_inline_caches_in_methods();
  Universe::code->clear_inline_caches();

  lookupCache::flush();
  DeltaCallCache::clearAll();

  return receiver;
}
Esempio n. 30
0
  void do_object(oop obj) {
    if (obj->is_klass() && obj->blueprint()->oop_is_instanceKlass()) {
      instanceKlass* ik = instanceKlass::cast((klassOop)obj);
      int i;

      mark_and_move_for_policy(OP_favor_startup, ik->name(), _move_ro);

      if (ik->super() != NULL) {
        do_object(ik->super());
      }

      objArrayOop interfaces = ik->local_interfaces();
      mark_and_move_for_policy(OP_favor_startup, interfaces, _move_ro);
      for(i = 0; i < interfaces->length(); i++) {
        klassOop k = klassOop(interfaces->obj_at(i));
        mark_and_move_for_policy(OP_favor_startup, k->klass_part()->name(), _move_ro);
        do_object(k);
      }

      objArrayOop methods = ik->methods();
      for(i = 0; i < methods->length(); i++) {
        methodOop m = methodOop(methods->obj_at(i));
        mark_and_move_for_policy(OP_favor_startup, m->constMethod(), _move_ro);
        mark_and_move_for_policy(OP_favor_runtime, m->constMethod()->exception_table(), _move_ro);
        mark_and_move_for_policy(OP_favor_runtime, m->constMethod()->stackmap_data(), _move_ro);

        // We don't move the name symbolOop here because it may invalidate
        // method ordering, which is dependent on the address of the name
        // symbolOop.  It will get promoted later with the other symbols.
        // Method name is rarely accessed during classloading anyway.
        // mark_and_move_for_policy(OP_balanced, m->name(), _move_ro);

        mark_and_move_for_policy(OP_favor_startup, m->signature(), _move_ro);
      }

      mark_and_move_for_policy(OP_favor_startup, ik->transitive_interfaces(), _move_ro);
      mark_and_move_for_policy(OP_favor_startup, ik->fields(), _move_ro);

      mark_and_move_for_policy(OP_favor_runtime, ik->secondary_supers(),  _move_ro);
      mark_and_move_for_policy(OP_favor_runtime, ik->method_ordering(),   _move_ro);
      mark_and_move_for_policy(OP_favor_runtime, ik->class_annotations(), _move_ro);
      mark_and_move_for_policy(OP_favor_runtime, ik->fields_annotations(), _move_ro);
      mark_and_move_for_policy(OP_favor_runtime, ik->methods_annotations(), _move_ro);
      mark_and_move_for_policy(OP_favor_runtime, ik->methods_parameter_annotations(), _move_ro);
      mark_and_move_for_policy(OP_favor_runtime, ik->methods_default_annotations(), _move_ro);
      mark_and_move_for_policy(OP_favor_runtime, ik->inner_classes(), _move_ro);
      mark_and_move_for_policy(OP_favor_runtime, ik->secondary_supers(), _move_ro);
    }
  }