예제 #1
0
/**
 * 为某一类型对应的java.lang.Class实例分配存储空间
 */
instanceOop instanceMirrorKlass::allocate_instance(KlassHandle k, TRAPS) {
  // Query before forming handle.
  int size = instance_size(k);
  KlassHandle h_k(THREAD, as_klassOop());
  instanceOop i = (instanceOop) CollectedHeap::Class_obj_allocate(h_k, size, k, CHECK_NULL);
  return i;
}
예제 #2
0
파일: NearClass.cpp 프로젝트: sfsy1989/j2me
void NearClass::print_value_on(Stream* st) {
#if USE_DEBUG_PRINTING
  // This is called for both Java Near classes and for generic near classes
  const char *super_type;
  switch(instance_size().value()) {
    case InstanceSize::size_java_near: {
      FarClass parent = klass();
      if (parent.equals(Universe::type_array_class_class())) {
          super_type = "TypeArray";
      } else if (parent.equals(Universe::obj_array_class_class())) {
          super_type = "ObjArray";
      } else if (parent.equals(Universe::instance_class_class())) {
          super_type = "Instance";
      } else {
          super_type = "??Java??";
      }
      break;
    }

    case InstanceSize::size_generic_near:
      super_type = "Generic";
      break;

    case InstanceSize::size_obj_near: // for methods
      super_type = "Object";
      break;

    default:
      super_type = "??";
      break;
  }
  st->print("The %s NearClass ", super_type);
#endif
}
예제 #3
0
instanceOop InstanceMirrorKlass::allocate_instance(KlassHandle k, TRAPS) {
  // Query before forming handle.
  int size = instance_size(k);
  KlassHandle h_k(THREAD, this);
  instanceOop i = (instanceOop)CollectedHeap::obj_allocate(h_k, size, CHECK_NULL);

  // Since mirrors can be variable sized because of the static fields, store
  // the size in the mirror itself.
  java_lang_Class::set_oop_size(i, size);

  return i;
}
예제 #4
0
 jubyte* extern_oop_map() const {
   GUARANTEE(instance_size().value() < 0, 
             "Instances don't have external oop map");
   return _oop_map._extern; 
 }
예제 #5
0
 jubyte* embedded_oop_map() const { 
   GUARANTEE(instance_size().value() > 0, "Not an instance");
   return (jubyte*) this + _oop_map._embedded_start;
 }