static void markfin(void *v) { uintptr size; uint32 *refp; size = 0; refp = nil; if(!mlookup(v, &v, &size, nil, &refp) || !(*refp & RefHasFinalizer)) throw("mark - finalizer inconsistency"); // do not mark the finalizer block itself. just mark the things it points at. scanblock(1, v, size); }
void runtime·free ( void *v ) { int32 sizeclass; MSpan *s; MCache *c; uint32 prof; uintptr size; #line 2161 "C:\Go\src\pkg\runtime\malloc.goc" if ( v == nil ) return; #line 2167 "C:\Go\src\pkg\runtime\malloc.goc" if ( m->mallocing ) runtime·throw ( "malloc/free - deadlock" ) ; m->mallocing = 1; #line 2171 "C:\Go\src\pkg\runtime\malloc.goc" if ( !runtime·mlookup ( v , nil , nil , &s ) ) { runtime·printf ( "free %p: not an allocated block\n" , v ) ; runtime·throw ( "free runtime·mlookup" ) ; } prof = runtime·blockspecial ( v ) ; #line 2178 "C:\Go\src\pkg\runtime\malloc.goc" sizeclass = s->sizeclass; c = m->mcache; if ( sizeclass == 0 ) { #line 2182 "C:\Go\src\pkg\runtime\malloc.goc" size = s->npages<<PageShift; * ( uintptr* ) ( s->start<<PageShift ) = 1; #line 2186 "C:\Go\src\pkg\runtime\malloc.goc" runtime·markfreed ( v , size ) ; runtime·unmarkspan ( v , 1<<PageShift ) ; runtime·MHeap_Free ( &runtime·mheap , s , 1 ) ; } else { #line 2191 "C:\Go\src\pkg\runtime\malloc.goc" size = runtime·class_to_size[sizeclass]; if ( size > sizeof ( uintptr ) ) ( ( uintptr* ) v ) [1] = 1; #line 2197 "C:\Go\src\pkg\runtime\malloc.goc" runtime·markfreed ( v , size ) ; c->local_by_size[sizeclass].nfree++; runtime·MCache_Free ( c , v , sizeclass , size ) ; } c->local_alloc -= size; if ( prof ) runtime·MProf_Free ( v , size ) ; m->mallocing = 0; }
/* * Read a register name. Return register value, -1 if no register found */ int reg(void) { struct mne *mp; char id[NCPS]; getid(id, -1); if ((mp = mlookup(id))==NULL) { aerr(); return (-1); } switch (mp->m_type) { case S_A: case S_AB: case S_DPTR: case S_PC: case S_REG: return ((int) mp->m_valu); default: return (-1); } }