Example #1
0
  Object* ImmixGC::allocate(int bytes) {
    if(bytes > immix::cMaxObjectSize) return 0;

    Object* obj = allocator_.allocate(bytes).as<Object>();
    obj->init_header(MatureObjectZone, InvalidType);
    obj->set_in_immix();

    return obj;
  }
  Object* ImmixGC::allocate(uint32_t bytes, bool& collect_now) {
    if(bytes > cMaxObjectSize) return 0;

    Object* obj = allocator_.allocate(bytes, collect_now).as<Object>();
    if(likely(obj)) {
      obj->init_header(MatureObjectZone, InvalidType);
      obj->set_in_immix();
    }

    return obj;
  }
Example #3
0
  Object* ImmixGC::move_object(Object* orig, uint32_t bytes) {
    if(bytes > immix::cMaxObjectSize) return 0;

    Object* obj = allocator_.allocate(bytes).as<Object>();

    memcpy(obj, orig, bytes);

    obj->set_zone(MatureObjectZone);
    obj->set_in_immix();

    orig->set_forward(obj);

    return obj;
  }
Example #4
0
  Object* ImmixGC::allocate(int bytes) {
#ifdef RBX_GC_STATS
    stats::GCStats::get()->mature_bytes_allocated += bytes;
    stats::GCStats::get()->allocate_mature.start();
#endif

    Object* obj = allocator_.allocate(bytes).as<Object>();
    obj->init_header(MatureObjectZone, InvalidType);
    obj->set_in_immix();

#ifdef RBX_GC_STATS
    stats::GCStats::get()->allocate_mature.stop();
#endif

    return obj;
  }
Example #5
0
  memory::Address ImmixGC::ObjectDescriber::copy(memory::Address original,
      immix::Allocator& alloc) {
    Object* orig = original.as<Object>();

    memory::Address copy_addr = alloc.allocate(
        orig->size_in_bytes(object_memory_->state()));

    Object* copy = copy_addr.as<Object>();

    copy->initialize_full_state(object_memory_->state(), orig, 0);

    copy->set_zone(MatureObjectZone);
    copy->set_in_immix();

    return copy_addr;
  }
Example #6
0
  immix::Address ImmixGC::ObjectDescriber::copy(immix::Address original,
      immix::Allocator& alloc) {
    Object* orig = original.as<Object>();

    immix::Address copy_addr = alloc.allocate(
        orig->size_in_bytes(object_memory_->state));

    Object* copy = copy_addr.as<Object>();

    copy->initialize_copy(orig, 0);
    copy->copy_body(object_memory_->state, orig);

    copy->zone = MatureObjectZone;
    copy->set_in_immix();

    return copy_addr;
  }
Example #7
0
  Object* ImmixGC::move_object(Object* orig, int bytes) {
    if(bytes > immix::cMaxObjectSize) return 0;

    Object* obj = allocator_.allocate(bytes).as<Object>();

    memcpy(obj, orig, bytes);

    // If the header is inflated, repoint it.
    if(obj->inflated_header_p()) {
      orig->deflate_header();
      obj->inflated_header()->set_object(obj);
    }

    obj->set_zone(MatureObjectZone);
    obj->set_age(0);

    obj->set_in_immix();

    orig->set_forward(obj);

    return obj;
  }
  Address ImmixGC::ObjectDescriber::copy(Address original,
      ImmixAllocator& alloc) {
    Object* orig = original.as<Object>();

    bool collect_flag = false;

    Address copy_addr = alloc.allocate(
        orig->size_in_bytes(memory_->vm()),
        collect_flag);

    if(collect_flag) {
      memory_->schedule_full_collection("Immix region copy object");
    }

    Object* copy = copy_addr.as<Object>();

    copy->initialize_full_state(memory_->vm(), orig, 0);

    copy->set_zone(MatureObjectZone);
    copy->set_in_immix();

    return copy_addr;
  }