这篇教程C++ watched_p函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中watched_p函数的典型用法代码示例。如果您正苦于以下问题:C++ watched_p函数的具体用法?C++ watched_p怎么用?C++ watched_p使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了watched_p函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: allocate_object_mature Object* ObjectMemory::allocate_object_mature(size_t bytes) { Object* obj; if(bytes > large_object_threshold) { obj = mark_sweep_->allocate(bytes, &collect_mature_now); if(unlikely(!obj)) return NULL; } else { obj = immix_->allocate(bytes); if(unlikely(!obj)) { obj = mark_sweep_->allocate(bytes, &collect_mature_now); } gc_stats.mature_object_allocated(bytes); } if(collect_mature_now) shared_.gc_soon();#ifdef ENABLE_OBJECT_WATCH if(watched_p(obj)) { std::cout << "detected " << obj << " during mature allocation/n"; }#endif return obj; }
开发者ID:beatrichartz,项目名称:rubinius,代码行数:27,
示例2: call Object* call(Object* obj) { if(watched_p(obj)) { std::cout << "detected " << obj << " during unmarking./n"; } if(obj->reference_p() && obj->marked_p(object_memory_->mark())) { obj->clear_mark(); stack_.push_back(obj); } return obj; }
开发者ID:AndreMeira,项目名称:rubinius,代码行数:12,
示例3: allocate_object Object* ObjectMemory::allocate_object(size_t bytes) { objects_allocated++; bytes_allocated += bytes; Object* obj; if(unlikely(bytes > large_object_threshold)) { obj = mark_sweep_->allocate(bytes, &collect_mature_now); if(unlikely(!obj)) return NULL; if(collect_mature_now) { state->interrupts.set_perform_gc(); }#ifdef RBX_GC_STATS stats::GCStats::get()->large_objects++;#endif } else { obj = young_->allocate(bytes, &collect_young_now); if(unlikely(obj == NULL)) { collect_young_now = true; state->interrupts.set_perform_gc(); obj = immix_->allocate(bytes); if(unlikely(!obj)) { obj = mark_sweep_->allocate(bytes, &collect_mature_now); } if(collect_mature_now) { state->interrupts.set_perform_gc(); } } }#ifdef ENABLE_OBJECT_WATCH if(watched_p(obj)) { std::cout << "detected " << obj << " during allocation/n"; }#endif obj->clear_fields(bytes); return obj; }
开发者ID:angelim,项目名称:rubinius,代码行数:45,
示例4: state Object* ObjectMemory::allocate_object(size_t bytes) { Object* obj; if(unlikely(bytes > large_object_threshold)) { obj = mark_sweep_->allocate(bytes, &collect_mature_now); if(unlikely(!obj)) return NULL; state()->metrics().m.ruby_metrics.memory_immix_objects_total++; state()->metrics().m.ruby_metrics.memory_immix_bytes_total += bytes; if(collect_mature_now) shared_.gc_soon(); } else { obj = young_->allocate(bytes, &collect_young_now); if(unlikely(obj == NULL)) { collect_young_now = true; shared_.gc_soon(); obj = immix_->allocate(bytes); if(unlikely(!obj)) { obj = mark_sweep_->allocate(bytes, &collect_mature_now); } state()->metrics().m.ruby_metrics.memory_immix_objects_total++; state()->metrics().m.ruby_metrics.memory_immix_bytes_total += bytes; if(collect_mature_now) shared_.gc_soon(); } else { state()->metrics().m.ruby_metrics.memory_young_objects_total++; state()->metrics().m.ruby_metrics.memory_young_bytes_total += bytes; } }#ifdef ENABLE_OBJECT_WATCH if(watched_p(obj)) { std::cout << "detected " << obj << " during allocation/n"; }#endif return obj; }
开发者ID:azazeal,项目名称:rubinius,代码行数:43,
示例5: scan_object /** * Scans the specified Object +obj+ for references to other Objects, and * marks those Objects as reachable. Understands how to read the inside of * an Object and find all references located within. For each reference * found, it marks the object pointed to as live (which may trigger * movement of the object in a copying garbage collector), but does not * recursively scan into the referenced object (since such recursion could * be arbitrarily deep, depending on the object graph, and this could cause * the stack to blow up). * /param obj The Object to be scanned for references to other Objects. */ void GarbageCollector::scan_object(Object* obj) {#ifdef ENABLE_OBJECT_WATCH if(watched_p(obj)) { std::cout << "detected " << obj << " during scan_object./n"; }#endif // We set scanned here before we finish scanning the object. // This is done so we don't have a race condition while we're // scanning the object and another thread updates a field during // the phase where the object is partially scanned. scanned_object(obj); if(Object* klass = saw_object(obj->klass())) { obj->klass(object_memory_, force_as<Class>(klass)); } if(obj->ivars()->reference_p()) { if(Object* ivars = saw_object(obj->ivars())) { obj->ivars(object_memory_, ivars); } } // Handle Tuple directly, because it's so common if(Tuple* tup = try_as<Tuple>(obj)) { native_int size = tup->num_fields(); for(native_int i = 0; i < size; i++) { Object* slot = tup->field[i]; if(slot->reference_p()) { if(Object* moved = saw_object(slot)) { tup->field[i] = moved; object_memory_->write_barrier(tup, moved); } } } } else { TypeInfo* ti = object_memory_->type_info[obj->type_id()]; ObjectMark mark(this); ti->mark(obj, mark); } }
开发者ID:Azzurrio,项目名称:rubinius,代码行数:53,
示例6: raw_allocate /** * Attempts to allocate an object of the specified size from the Eden heap. * Unlike allocate, the header of the returned object is not initialized. * * If there is insufficient space remaining, NULL is returned and the * limit_hit parameter is set to true. */ Object* raw_allocate(size_t bytes, bool* limit_hit) { Object* obj; if(!eden->enough_space_p(bytes)) { return NULL; } else { obj = eden->allocate(bytes).as<Object>(); if(eden->over_limit_p(obj)) { *limit_hit = true; } }#ifdef ENABLE_OBJECT_WATCH if(watched_p(obj)) { std::cout << "detected " << obj << " during baker allocation./n"; }#endif return obj; }
开发者ID:Locke23rus,项目名称:rubinius,代码行数:28,
示例7: guard Object* ObjectMemory::new_object_typed_enduring_dirty(STATE, Class* cls, size_t bytes, object_type type) { utilities::thread::SpinLock::LockGuard guard(allocation_lock_); Object* obj = mark_sweep_->allocate(bytes, &collect_mature_now); if(unlikely(!obj)) return NULL; state->vm()->metrics().m.ruby_metrics.memory_immix_objects_total++; state->vm()->metrics().m.ruby_metrics.memory_immix_bytes_total += bytes; if(collect_mature_now) shared_.gc_soon();#ifdef ENABLE_OBJECT_WATCH if(watched_p(obj)) { std::cout << "detected " << obj << " during enduring allocation/n"; }#endif obj->set_obj_type(type); obj->klass(this, cls); obj->ivars(this, cNil); return obj; }
开发者ID:azazeal,项目名称:rubinius,代码行数:23,
示例8: saw_object Object* ImmixGC::saw_object(Object* obj) {#ifdef ENABLE_OBJECT_WATCH if(watched_p(obj)) { std::cout << "detected " << obj << " during immix scanning./n"; }#endif if(!obj->reference_p()) return obj; memory::Address fwd = gc_.mark_address(memory::Address(obj), allocator_); Object* copy = fwd.as<Object>(); // Check and update an inflated header if(copy && copy != obj && obj->inflated_header_p()) { InflatedHeader* ih = obj->deflate_header(); ih->reset_object(copy); if(!copy->set_inflated_header(ih)) { rubinius::bug("Massive IMMIX inflated header screwup."); } } return copy; }
开发者ID:ConradIrwin,项目名称:rubinius,代码行数:23,
示例9: promote_object Object* ObjectMemory::promote_object(Object* obj) {#ifdef RBX_GC_STATS stats::GCStats::get()->objects_promoted++;#endif objects_allocated++; size_t sz = obj->size_in_bytes(state); bytes_allocated += sz; Object* copy = immix_->allocate(sz); if(unlikely(!copy)) { copy = mark_sweep_->allocate(sz, &collect_mature_now); } copy->set_obj_type(obj->type_id()); copy->initialize_full_state(state, obj, 0); if(watched_p(obj)) { std::cout << "detected object " << obj << " during promotion./n"; } return copy; }
开发者ID:angelim,项目名称:rubinius,代码行数:24,
注:本文中的watched_p函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ watcher_query函数代码示例 C++ watchdog_unregister_device函数代码示例 |