当前位置: 首页>>代码示例>>C++>>正文


C++ oop::klass方法代码示例

本文整理汇总了C++中oop::klass方法的典型用法代码示例。如果您正苦于以下问题:C++ oop::klass方法的具体用法?C++ oop::klass怎么用?C++ oop::klass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在oop的用法示例。


在下文中一共展示了oop::klass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: prototype_for_object

inline markOop markOopDesc::prototype_for_object(oop obj) {
#ifdef ASSERT
  markOop prototype_header = obj->klass()->prototype_header();
  assert(prototype_header == prototype() || prototype_header->has_bias_pattern(), "corrupt prototype header");
#endif
  return obj->klass()->prototype_header();
}
开发者ID:campolake,项目名称:openjdk9,代码行数:7,代码来源:markOop.inline.hpp

示例2: promotion_trace_event

inline void PSPromotionManager::promotion_trace_event(oop new_obj, oop old_obj,
        size_t obj_size,
        uint age, bool tenured,
        const PSPromotionLAB* lab) {
    // Skip if memory allocation failed
    if (new_obj != NULL) {
        const ParallelScavengeTracer* gc_tracer = PSScavenge::gc_tracer();

        if (lab != NULL) {
            // Promotion of object through newly allocated PLAB
            if (gc_tracer->should_report_promotion_in_new_plab_event()) {
                size_t obj_bytes = obj_size * HeapWordSize;
                size_t lab_size = lab->capacity();
                gc_tracer->report_promotion_in_new_plab_event(old_obj->klass(), obj_bytes,
                        age, tenured, lab_size);
            }
        } else {
            // Promotion of object directly to heap
            if (gc_tracer->should_report_promotion_outside_plab_event()) {
                size_t obj_bytes = obj_size * HeapWordSize;
                gc_tracer->report_promotion_outside_plab_event(old_obj->klass(), obj_bytes,
                        age, tenured);
            }
        }
    }
}
开发者ID:gaoxiaojun,项目名称:dync,代码行数:26,代码来源:psPromotionManager.inline.hpp

示例3:

void G1ParScanThreadState::report_promotion_event(InCSetState const dest_state,
        oop const old, size_t word_sz, uint age,
        HeapWord * const obj_ptr,
        const AllocationContext_t context) const {
    G1PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state, context);
    if (alloc_buf->contains(obj_ptr)) {
        _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz, age,
                dest_state.value() == InCSetState::Old,
                alloc_buf->word_sz());
    } else {
        _g1h->_gc_tracer_stw->report_promotion_outside_plab_event(old->klass(), word_sz, age,
                dest_state.value() == InCSetState::Old);
    }
}
开发者ID:netroby,项目名称:jdk9-dev,代码行数:14,代码来源:g1ParScanThreadState.cpp

示例4: print_object

  void print_object(outputStream* out, oop obj) {
#ifdef PRODUCT
    klassOop k = obj->klass();
    const char* class_name = instanceKlass::cast(k)->external_name();
    out->print_cr("class name %s", class_name);
#else // PRODUCT
    obj->print_on(out);
#endif // PRODUCT
  }
开发者ID:BaHbKaTX,项目名称:openjdk,代码行数:9,代码来源:heapRegion.cpp

示例5: validate_lookup

bool validate_lookup(oop receiver, symbolOop selector) {
 LookupKey key(receiver->klass(), selector);
 if (lookupCache::lookup(&key).is_empty()) {
   std->print_cr("Lookup error");
   key.print_on(std);
   std->cr();
   return false;
 }
 return true;
}
开发者ID:sebkirche,项目名称:strongtalk,代码行数:10,代码来源:evaluator.cpp

示例6: oop_oop_iterate

void ObjArrayKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
  assert (obj->is_array(), "obj must be array");
  objArrayOop a = objArrayOop(obj);

  if (Devirtualizer<nv>::do_metadata(closure)) {
    Devirtualizer<nv>::do_klass(closure, obj->klass());
  }

  oop_oop_iterate_elements<nv>(a, closure);
}
开发者ID:campolake,项目名称:openjdk9,代码行数:10,代码来源:objArrayKlass.inline.hpp

示例7: is_java_lang_ref_Reference_access

static bool is_java_lang_ref_Reference_access(oop o, jlong offset) {
  if (offset == java_lang_ref_Reference::referent_offset && o != NULL) {
    Klass* k = o->klass();
    if (InstanceKlass::cast(k)->reference_type() != REF_NONE) {
      assert(InstanceKlass::cast(k)->is_subclass_of(SystemDictionary::Reference_klass()), "sanity");
      return true;
    }
  }
  return false;
}
开发者ID:netroby,项目名称:jdk9-dev,代码行数:10,代码来源:unsafe.cpp

示例8: fatal

extern "C" void bad_compiled_vtable_index(JavaThread* thread, oop receiver, int index) {
  ResourceMark rm;
  HandleMark hm;
  klassOop klass = receiver->klass();
  instanceKlass* ik = instanceKlass::cast(klass);
  klassVtable* vt = ik->vtable();
  klass->print();
  fatal(err_msg("bad compiled vtable dispatch: receiver " INTPTR_FORMAT ", "
                "index %d (vtable length %d)",
                (address)receiver, index, vt->length()));
}
开发者ID:BaHbKaTX,项目名称:openjdk,代码行数:11,代码来源:vtableStubs.cpp

示例9: record_instance

// Return false if the entry could not be recorded on account
// of running out of space required to create a new entry.
bool KlassInfoTable::record_instance(const oop obj) {
  klassOop      k = obj->klass();
  KlassInfoEntry* elt = lookup(k);
  // elt may be NULL if it's a new klass for which we
  // could not allocate space for a new entry in the hashtable.
  if (elt != NULL) {
    elt->set_count(elt->count() + 1);
    elt->set_words(elt->words() + obj->size());
    return true;
  } else {
    return false;
  }
}
开发者ID:sxhao,项目名称:codenameone-avian,代码行数:15,代码来源:heapInspection.cpp

示例10: update_heuristics

static HeuristicsResult update_heuristics(oop o, bool allow_rebias) {
  markOop mark = o->mark();
  if (!mark->has_bias_pattern()) {
    return HR_NOT_BIASED;
  }

  // Heuristics to attempt to throttle the number of revocations.
  // Stages:
  // 1. Revoke the biases of all objects in the heap of this type,
  //    but allow rebiasing of those objects if unlocked.
  // 2. Revoke the biases of all objects in the heap of this type
  //    and don't allow rebiasing of these objects. Disable
  //    allocation of objects of that type with the bias bit set.
  Klass* k = o->klass();
  jlong cur_time = os::javaTimeMillis();
  jlong last_bulk_revocation_time = k->last_biased_lock_bulk_revocation_time();
  int revocation_count = k->biased_lock_revocation_count();
  if ((revocation_count >= BiasedLockingBulkRebiasThreshold) &&
      (revocation_count <  BiasedLockingBulkRevokeThreshold) &&
      (last_bulk_revocation_time != 0) &&
      (cur_time - last_bulk_revocation_time >= BiasedLockingDecayTime)) {
    // This is the first revocation we've seen in a while of an
    // object of this type since the last time we performed a bulk
    // rebiasing operation. The application is allocating objects in
    // bulk which are biased toward a thread and then handing them
    // off to another thread. We can cope with this allocation
    // pattern via the bulk rebiasing mechanism so we reset the
    // klass's revocation count rather than allow it to increase
    // monotonically. If we see the need to perform another bulk
    // rebias operation later, we will, and if subsequently we see
    // many more revocation operations in a short period of time we
    // will completely disable biasing for this type.
    k->set_biased_lock_revocation_count(0);
    revocation_count = 0;
  }

  // Make revocation count saturate just beyond BiasedLockingBulkRevokeThreshold
  if (revocation_count <= BiasedLockingBulkRevokeThreshold) {
    revocation_count = k->atomic_incr_biased_lock_revocation_count();
  }

  if (revocation_count == BiasedLockingBulkRevokeThreshold) {
    return HR_BULK_REVOKE;
  }

  if (revocation_count == BiasedLockingBulkRebiasThreshold) {
    return HR_BULK_REBIAS;
  }

  return HR_SINGLE_REVOKE;
}
开发者ID:gaoxiaojun,项目名称:dync,代码行数:51,代码来源:biasedLocking.cpp

示例11: does_not_understand

oop InterpretedIC::does_not_understand(oop receiver, InterpretedIC* ic, frame* f) {
  memOop msg;
  symbolOop sel;
  {
    // message not understood...
    BlockScavenge bs; // make sure that no scavenge happens
    klassOop msgKlass = klassOop(Universe::find_global("Message"));
    oop obj = msgKlass->klass_part()->allocateObject();
    assert(obj->is_mem(), "just checkin'...");
    msg = memOop(obj);
    int nofArgs = ic->selector()->number_of_arguments();
    objArrayOop args = oopFactory::new_objArray(nofArgs);
    for (int i = 1; i <= nofArgs; i++) {
      args->obj_at_put(i, f->expr(nofArgs - i));
    }
    // for now: assume instance variables are there...
    // later: should check this or use a VM interface:
    // msg->set_receiver(recv);
    // msg->set_selector(ic->selector());
    // msg->set_arguments(args);
    msg->raw_at_put(2, receiver);
    msg->raw_at_put(3, ic->selector());
    msg->raw_at_put(4, args);
    sel = oopFactory::new_symbol("doesNotUnderstand:");
    if (interpreter_normal_lookup(receiver->klass(), sel).is_empty()) {
      // doesNotUnderstand: not found ==> process error
      { ResourceMark rm;
      std->print("LOOKUP ERROR\n");
      sel->print_value(); std->print(" not found\n");
      }
      if (DeltaProcess::active()->is_scheduler()) {
        DeltaProcess::active()->trace_stack();
        fatal("lookup error in scheduler");
      } else {
        DeltaProcess::active()->suspend(::lookup_error);
      }
      ShouldNotReachHere();
    }
  }
  // return marked result of doesNotUnderstand: message
  return Delta::call(receiver, sel, msg);

  // Solution: use an nmethod-like stub-routine called from
  // within a (possibly one-element) PIC (in order to keep
  // the method selector in the IC. That stub does the
  // Delta:call and pops the right number of arguments
  // taken from the selector (the no. of arguments from
  // the selector can be optimized).
}
开发者ID:jirkadanek,项目名称:Strongtalk,代码行数:49,代码来源:interpretedIC.cpp

示例12: oop_oop_iterate

int ObjArrayKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
  assert (obj->is_array(), "obj must be array");
  objArrayOop a = objArrayOop(obj);

  // Get size before changing pointers.
  // Don't call size() or oop_size() since that is a virtual call.
  int size = a->object_size();
  if (Devirtualizer<nv>::do_metadata(closure)) {
    Devirtualizer<nv>::do_klass(closure, obj->klass());
  }

  oop_oop_iterate_elements<nv>(a, closure);

  return size;
}
开发者ID:shelan,项目名称:jdk9-mirror,代码行数:15,代码来源:objArrayKlass.inline.hpp

示例13:

  // Return true if oop represents an object that is "visible"
  // to the java world.
  static inline bool visible_oop(oop o) {
    // the sentinel for deleted handles isn't visible
    if (o == JNIHandles::deleted_handle()) {
      return false;
    }

    // instance
    if (o->is_instance()) {
      // instance objects are visible
      if (o->klass() != SystemDictionary::Class_klass()) {
        return true;
      }
      if (java_lang_Class::is_primitive(o)) {
        return true;
      }
      // java.lang.Classes are visible
      Klass* k = java_lang_Class::as_Klass(o);
      if (k->is_klass()) {
        // if it's a class for an object, an object array, or
        // primitive (type) array then it's visible.
        if (k->is_instance_klass()) {
          return true;
        }
        if (k->is_objArray_klass()) {
          return true;
        }
        if (k->is_typeArray_klass()) {
          return true;
        }
      }
      return false;
    }
    // object arrays are visible if they aren't system object arrays
    if (o->is_objArray()) {
        return true;
    }
    // type arrays are visible
    if (o->is_typeArray()) {
      return true;
    }
    // everything else (Method*s, ...) aren't visible
    return false;
  };   // end of visible_oop()
开发者ID:gaoxiaojun,项目名称:dync,代码行数:45,代码来源:serviceUtil.hpp

示例14: do_object

  void do_object(oop obj) {
    obj->oop_iterate_header(&resolve);
    obj->oop_iterate(&resolve);

    assert(obj->klass()->is_shared(), "Klass not pointing into shared space.");

    // If the object is a Java object or class which might (in the
    // future) contain a reference to a young gen object, add it to the
    // list.

    if (obj->is_klass() || obj->is_instance()) {
      if (obj->is_klass() ||
          obj->is_a(SystemDictionary::Class_klass()) ||
          obj->is_a(SystemDictionary::Throwable_klass())) {
        // Do nothing
      }
      else if (obj->is_a(SystemDictionary::String_klass())) {
        // immutable objects.
      } else {
        // someone added an object we hadn't accounted for.
        ShouldNotReachHere();
      }
    }
  }
开发者ID:ericbbcc,项目名称:hotspot,代码行数:24,代码来源:dump.cpp

示例15: is_instance

 // Testing
 static bool is_instance(oop obj) {
   return obj != NULL && obj->klass() == SystemDictionary::Class_klass();
 }
开发者ID:stkaushal,项目名称:jdk8_tl,代码行数:4,代码来源:javaClasses.hpp


注:本文中的oop::klass方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。