profile was calling vlong run-time support directly which is counter-productive when those operations are done by the compiler and might not even exist in the library. i've used A = A+B rather than A += B to ensure the generated code is the same (ie, calls to _addv and _subv) on those platforms that still use them. (those functions are handled specially for profiling purposes in vlop.s on some platforms.) it's probably time to put a bit more intelligent vlong support into the portable part of cc, but this change will allow alpha, amd64 and others to cope until i have a chance to look at that (eg, for powerpc). Reference: /n/sources/patch/applied/profilev Date: Fri Mar 18 12:21:22 CET 2005 --- /sys/src/libc/port/profile.c Fri Mar 18 12:16:42 2005 +++ /sys/src/libc/port/profile.c Fri Mar 18 12:16:39 2005 @@ -4,8 +4,6 @@ extern long _callpc(void**); extern long _savearg(void); -extern void _addv(vlong*,vlong,vlong); -extern void _subv(vlong*,vlong,vlong); ulong khz; uvlong cyclefreq; @@ -61,19 +59,19 @@ p->count++; switch(_tos->prof.what){ case Profkernel: - _subv(&p->time, p->time, _tos->pcycles); + p->time = p->time - _tos->pcycles; goto proftime; case Profuser: /* Add kernel cycles on proc entry */ - _addv(&p->time, p->time, _tos->kcycles); + p->time = p->time + _tos->kcycles; /* fall through */ case Proftime: proftime: /* Subtract cycle counter on proc entry */ cycles((uvlong*)&t); - _subv(&p->time, p->time, t); + p->time = p->time - t; break; case Profsample: - _subv(&p->time, p->time, (vlong)_tos->clock); + p->time = p->time - _tos->clock; break; } return arg; /* disgusting linkage */ @@ -92,18 +90,18 @@ return arg; /* Not our process */ switch(_tos->prof.what){ case Profkernel: /* Add proc cycles on proc entry */ - _addv(&p->time, p->time, _tos->pcycles); + p->time = p->time + _tos->pcycles; goto proftime; case Profuser: /* Subtract kernel cycles on proc entry */ - _subv(&p->time, p->time, _tos->kcycles); + p->time = p->time - _tos->kcycles; /* fall through */ case Proftime: proftime: /* Add cycle counter on proc entry */ cycles((uvlong*)&t); - _addv(&p->time, p->time, t); + p->time = p->time + t; break; case Profsample: - _addv(&p->time, p->time, (vlong)_tos->clock); + p->time = p->time + _tos->clock; break; } _tos->prof.pp = p->old; @@ -137,11 +135,11 @@ switch(_tos->prof.what){ case Profkernel: cycles((uvlong*)&_tos->prof.first->time); - _addv(&_tos->prof.first->time, _tos->prof.first->time, _tos->pcycles); + _tos->prof.first->time = _tos->prof.first->time + _tos->pcycles; break; case Profuser: cycles((uvlong*)&_tos->prof.first->time); - _addv(&_tos->prof.first->time, _tos->prof.first->time, _tos->kcycles); + _tos->prof.first->time = _tos->prof.first->time + _tos->kcycles; break; case Proftime: cycles((uvlong*)&_tos->prof.first->time);