}
void
-runtime·setFinalizer(void)
+runtime·setFinalizer_m(void)
{
Eface obj, finalizer;
// mcallable cache refill
void
-runtime·mcacheRefill(void)
+runtime·mcacheRefill_m(void)
{
runtime·MCache_Refill(g->m->mcache, (int32)g->m->scalararg[0]);
}
void
-runtime·largeAlloc(void)
+runtime·largeAlloc_m(void)
{
uintptr npages, size;
MSpan *s;
v := s.freelist
if v == nil {
mp.scalararg[0] = tinySizeClass
- onM(&mcacheRefill)
+ onM(&mcacheRefill_m)
s = c.alloc[tinySizeClass]
v = s.freelist
}
v := s.freelist
if v == nil {
mp.scalararg[0] = uint(sizeclass)
- onM(&mcacheRefill)
+ onM(&mcacheRefill_m)
s = c.alloc[sizeclass]
v = s.freelist
}
} else {
mp.scalararg[0] = uint(size)
mp.scalararg[1] = uint(flags)
- onM(&largeAlloc)
+ onM(&largeAlloc_m)
s = (*mspan)(mp.ptrarg[0])
mp.ptrarg[0] = nil
x = unsafe.Pointer(uintptr(s.start << pageShift))
}
mp.scalararg[0] = uint(size)
mp.ptrarg[0] = x
- onM(&mprofMalloc)
+ onM(&mprofMalloc_m)
}
// force = 1 - do GC regardless of current heap usage
} else {
mp.scalararg[1] = 0
}
- onM(&mgc2)
+ onM(&gc_m)
}
// all done
mp.ptrarg[1] = e.data
mp.ptrarg[2] = unsafe.Pointer(ftyp)
mp.ptrarg[3] = f.data
- onM(&setFinalizer)
+ onM(&setFinalizer_m)
releasem(mp)
}
}
void
-runtime·mgc2(void)
+runtime·gc_m(void)
{
struct gc_args a;
G *gp;
// Called by malloc to record a profiled block.
void
-runtime·mprofMalloc(void)
+runtime·mprofMalloc_m(void)
{
uintptr stk[32];
Bucket *b;
// these 4 functions are complicated enough that we will share
// the print logic with the C printf.
-var printstring_m byte
-var printuint_m byte
-var printhex_m byte
-var printfloat_m byte
+var (
+ printstring_m,
+ printuint_m,
+ printhex_m,
+ printfloat_m mFunction
+)
func printstring(s string) {
mp := acquirem()
func acquirem() *m
func releasem(mp *m)
+// An mFunction represents a C function that runs on the M stack. It
+// can be called from Go using mcall or onM. Through the magic of
+// linking, an mFunction variable and the corresponding C code entry
+// point live at the same address.
+type mFunction byte
+
// in asm_*.s
-func mcall(fn *byte)
-func onM(fn *byte)
+func mcall(fn *mFunction)
+func onM(fn *mFunction)
-// C routines that run on the M stack. Call these like
-// mcall(&mcacheRefill)
+// C functions that run on the M stack. Call these like
+// mcall(&mcacheRefill_m)
// Arguments should be passed in m->scalararg[x] and
// m->ptrarg[x]. Return values can be passed in those
// same slots.
-var mcacheRefill byte
-var largeAlloc byte
-var mprofMalloc byte
-var mgc2 byte
-var setFinalizer byte
-var markallocated_m byte
+var (
+ mcacheRefill_m,
+ largeAlloc_m,
+ mprofMalloc_m,
+ gc_m,
+ setFinalizer_m,
+ markallocated_m mFunction
+)
// memclr clears n bytes starting at ptr.
// in memclr_*.s