Example #1
0
 Object* ObjectMemory::new_object_fast(Class* cls, size_t bytes, object_type type) {
   if(Object* obj = young_->raw_allocate(bytes, &collect_young_now)) {
     if(collect_young_now) state->interrupts.set_perform_gc();
     obj->init_header(cls, YoungObjectZone, type);
     obj->clear_fields(bytes);
     return obj;
   } else {
     return new_object_typed(cls, bytes, type);
   }
 }
Example #2
0
 T* new_object_variable(STATE, Class* cls, size_t fields, size_t& bytes) {
   bytes = sizeof(T) + (fields * sizeof(Object*));
   return static_cast<T*>(new_object_typed(state, cls, bytes, T::type));
 }
Example #3
0
      T* new_object_bytes(STATE, Class* cls, size_t& bytes) {
        bytes = ObjectHeader::align(sizeof(T) + bytes);
        T* obj = static_cast<T*>(new_object_typed(state, cls, bytes, T::type));

        return obj;
      }
Example #4
0
 T* new_object_bytes(Class* cls, size_t& bytes) {
   bytes = ObjectHeader::align(sizeof(T) + bytes);
   return static_cast<T*>(new_object_typed(cls, bytes, T::type));
 }
Example #5
0
 T* new_object(Class *cls) {
   return static_cast<T*>(new_object_typed(cls, sizeof(T), T::type));
 }
Example #6
0
 T* new_struct(Class* cls, size_t bytes = 0) {
   T* obj = reinterpret_cast<T*>(new_object_typed(cls, sizeof(T) + bytes, T::type));
   return obj;
 }
Example #7
0
 T* new_object(Class *cls) {
   return reinterpret_cast<T*>(new_object_typed(cls, sizeof(T), T::type));
 }
Example #8
0
 T* new_object_variable(Class* cls, size_t fields, size_t& bytes) {
   bytes = T::fields_offset + (fields * sizeof(Object*));
   return static_cast<T*>(new_object_typed(cls, bytes, T::type));
 }
Example #9
0
 T* new_object_variable(Class* cls, size_t fields, size_t& bytes) {
     bytes = sizeof(T) + (fields * sizeof(Object*));
     return reinterpret_cast<T*>(new_object_typed(cls, bytes, T::type));
 }
Example #10
0
    T* new_object_bytes(Class* cls, size_t& bytes) {
        bytes = ObjectHeader::align(sizeof(T) + bytes);
        T* obj = reinterpret_cast<T*>(new_object_typed(cls, bytes, T::type));

        return obj;
    }
Example #11
0
Object* VM::new_object_from_type(Class* cls, TypeInfo* ti) {
    return new_object_typed(cls, ti->instance_size, ti->type);
}