GC_API GC_ATTR_MALLOC void * GC_CALL GC_debug_malloc_ignore_off_page(size_t lb, GC_EXTRA_PARAMS) { void * result = GC_malloc_ignore_off_page(SIZET_SAT_ADD(lb, DEBUG_BYTES)); return store_debug_info(result, lb, "GC_debug_malloc_ignore_off_page", OPT_RA s, i); }
extern "C" descriptor_t* allocate_stack(void) { static descriptor_t* always(NULL); const size_t dylan_stack(64*1024); if (always) memset(always, 0, dylan_stack); return always ? always : (always = static_cast<descriptor_t*>(GC_malloc_ignore_off_page(dylan_stack))); }
bool sym_file::init() { // open the file. if (!open()) return false; // read the header. should make sure it is a valid .xSYM file, etc. DiskSymbolHeaderBlock& header = mHeader; long count = sizeof(header); if (::FSRead(mFileRef, (long*) &count, &header) != noErr || count != sizeof(header)) return false; // read the name table. // mNameTable = new UInt8*[header.dshb_nte.dti_page_count]; mNameTable = (UInt8**) GC_malloc_ignore_off_page(header.dshb_nte.dti_page_count * sizeof(UInt8*)); if (mNameTable == NULL) return false; // seek to first page of the name table. ::SetFPos(mFileRef, fsFromStart, header.dshb_nte.dti_first_page * header.dshb_page_size); // read all of the pages into memory, for speed. for (int i = 0; i < header.dshb_nte.dti_page_count; i++) { // allocate each page atomically, so GC won't have to scan them. UInt8* page = mNameTable[i] = (UInt8*) GC_malloc_atomic(header.dshb_page_size); if (page == NULL) return false; count = header.dshb_page_size; if (::FSRead(mFileRef, &count, page) != noErr || count != header.dshb_page_size) return false; } // allocate the page buffer and initialize offsets. // mPageBuffer = (UInt8*) new UInt8[header.dshb_page_size]; mPageBuffer = (UInt8*) GC_malloc_atomic(header.dshb_page_size); // read the RTE tables. seek(header.dshb_rte.dti_first_page * header.dshb_page_size + sizeof(ResourceTableEntry)); for (int i = 1; i <= header.dshb_rte.dti_object_count; i++) { ResourceTableEntry resEntry; if (read(&resEntry, sizeof(resEntry)) == sizeof(resEntry)) { switch (resEntry.rte_ResType) { case 'CODE': mCodeEntry = resEntry; break; case 'DATA': break; } } } return true; }
Array_T::Array_T(unsigned long rank, unsigned long dimensions[], Value element_type, Value initial_contents, Value initial_element) : AbstractArray(WIDETAG_ARRAY_T), _array(NULL), _offset(0), _rank(rank), _dimensions(dimensions), _element_type(element_type) { _total_size = compute_total_size(rank, dimensions); _data = (Value *) GC_malloc_ignore_off_page(_total_size * sizeof(Value)); if (initial_contents != NIL) set_initial_contents(0, rank, dimensions, initial_contents, 0); else for (unsigned long i = _total_size; i-- > 0;) _data[i] = initial_element; }
GC_API void * GC_CALL GC_debug_malloc_ignore_off_page(size_t lb, GC_EXTRA_PARAMS) { void * result = GC_malloc_ignore_off_page(lb + DEBUG_BYTES); if (result == 0) { GC_err_printf("GC_debug_malloc_ignore_off_page(%lu)" " returning NULL (%s:%d)\n", (unsigned long)lb, s, i); return(0); } if (!GC_debugging_started) { GC_start_debugging(); } ADD_CALL_CHAIN(result, ra); return (GC_store_debug_info(result, (word)lb, s, i)); }
void * operator new(size_t size, INDEX capacity) { return GC_malloc_ignore_off_page(sizeof(SimpleVector) + capacity * sizeof(Value)); }
void * operator new(size_t size, INDEX numslots) { return GC_malloc_ignore_off_page(sizeof(StructureObject) + numslots * sizeof(Value)); }