From patchwork Sun Jun 24 03:19:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 166868 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 11846B6F9D for ; Sun, 24 Jun 2012 13:19:35 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1341112776; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:From:To:Cc:Subject:References:Date:In-Reply-To: Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=rwnYlMdQsA3uaCrtbCm/hWan9Q4=; b=FioEHlaB7Ou1ke62lT9hgnD4SjM52bL59RWAiNuD8LIpP8ntfEN9X6f2722KpS KXhL8RlXvBleaVM5Bk1qQICbPxSijThXYPH4NDsuT1MGZJpQaKiPcCMV3rPlTnhx h9w1Xzey4tFAgj4MUBSaqyl4qFNDxf3iwn3fdV6QD+vTY= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=aK8Sy7d2gQsLnLlYeh1hpl/VwmtpWn0/yEAM+up2bMFRDfsU2zJoTEahERa5aP LpDlOcS3UG7YQRPwmX7vgevAW3AGtMZ66CZGQKVzs8Lfl1roy4MPhJZALbSr+18E d9N2BPDfHKqAZLs/0xnlGMAygbKna9XWrOWm4Wex5bhDA=; Received: (qmail 26489 invoked by alias); 24 Jun 2012 03:19:30 -0000 Received: (qmail 26358 invoked by uid 22791); 24 Jun 2012 03:19:27 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f47.google.com (HELO mail-pz0-f47.google.com) (209.85.210.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 24 Jun 2012 03:19:13 +0000 Received: by dalh21 with SMTP id h21so3913633dal.20 for ; Sat, 23 Jun 2012 20:19:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:x-gm-message-state; bh=jklYQ3rFJpmwgeKlbOFblY8CV+K133ynBGYI5aOvWR0=; b=YqpIX7pR8udAGbyx42raSoxMhAAr1Z6hPpvBVgnSmr2NnLdoBUwIPOFCj/SGX9aGDn R0zmCBr7MNCBPdTAg6lfapNpoAAg80mtjeUUV1lek93Lmzf0d4dVlTESxawdC/W3ykvU Y+F1rzKul3KkfKJ0Hv9fsa7R9fBSUXFY5WrTSof6jAWKQflvFjulQ+auuxi+1fS5XU61 srNP5QQn0GUddtjWYoEgzq4mKgw9TpjKHR6LO8S7GLViISfKlOwEPS39ptWTQOyxEWvy AtyoRTcds+jcXMKX60IyR6kNhBmuoTqp69npjq2rRTDzRgxwOqt7BcqRnaredvwfLmIb EIbQ== Received: by 10.68.191.72 with SMTP id gw8mr25948373pbc.143.1340507952881; Sat, 23 Jun 2012 20:19:12 -0700 (PDT) Received: by 10.68.191.72 with SMTP id gw8mr25948351pbc.143.1340507952718; Sat, 23 Jun 2012 20:19:12 -0700 (PDT) Received: from coign.google.com ([216.239.45.130]) by mx.google.com with ESMTPS id ms1sm4055718pbb.63.2012.06.23.20.19.07 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 23 Jun 2012 20:19:11 -0700 (PDT) From: Ian Lance Taylor To: michael@chamberlain.net.au Cc: gcc-patches@gcc.gnu.org Subject: Re: libgo patch committed: Copy runtime_printf from other library References: <4FE67012.2000703@chamberlain.net.au> Date: Sat, 23 Jun 2012 20:19:01 -0700 In-Reply-To: <4FE67012.2000703@chamberlain.net.au> (michael@chamberlain.net.au's message of "Sun, 24 Jun 2012 11:40:34 +1000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmRmNfa1izqclnThqX/oEQCgqeZs3XLYSgGVr0CDerplZI0QUL5hAQGBdTlrxrJn85bV5lCqXo5K9FYxP1+tFqkEdmhBw0afnflwy3HBU+YmZLikuFiJGk6XlluPkB66lU2LbjCTUUiig35AOtNPxDcBMHSs8DvKs6BJ/twv8m3Vh/nnPUioCqZ2x4cKf5LoscJengVGw+FUaAKjswv9TLBIQqAxw== X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org michael@chamberlain.net.au writes: > On 25/05/2012 6:45 AM, Ian Lance Taylor wrote: >> This patch to libgo copies the implementation of runtime_printf ... > > The actual patch attached to the message was the one you had earlier > posted for the Go 1 release compatibility with the off-by-1 error in > runtime.Callers, rather than the described patch. Sorry, here is the correct patch. Ian Index: libgo/runtime/msize.c =================================================================== --- libgo/runtime/msize.c (revision 187847) +++ libgo/runtime/msize.c (revision 187848) @@ -103,7 +103,7 @@ runtime_InitSizes(void) sizeclass++; } if(sizeclass != NumSizeClasses) { - // runtime_printf("sizeclass=%d NumSizeClasses=%d\n", sizeclass, NumSizeClasses); + runtime_printf("sizeclass=%d NumSizeClasses=%d\n", sizeclass, NumSizeClasses); runtime_throw("InitSizes - bad NumSizeClasses"); } @@ -122,13 +122,13 @@ runtime_InitSizes(void) for(n=0; n < MaxSmallSize; n++) { sizeclass = runtime_SizeToClass(n); if(sizeclass < 1 || sizeclass >= NumSizeClasses || runtime_class_to_size[sizeclass] < n) { - // runtime_printf("size=%d sizeclass=%d runtime_class_to_size=%d\n", n, sizeclass, runtime_class_to_size[sizeclass]); - // runtime_printf("incorrect SizeToClass"); + runtime_printf("size=%d sizeclass=%d runtime_class_to_size=%d\n", n, sizeclass, runtime_class_to_size[sizeclass]); + runtime_printf("incorrect SizeToClass"); goto dump; } if(sizeclass > 1 && runtime_class_to_size[sizeclass-1] >= n) { - // runtime_printf("size=%d sizeclass=%d runtime_class_to_size=%d\n", n, sizeclass, runtime_class_to_size[sizeclass]); - // runtime_printf("SizeToClass too big"); + runtime_printf("size=%d sizeclass=%d runtime_class_to_size=%d\n", n, sizeclass, runtime_class_to_size[sizeclass]); + runtime_printf("SizeToClass too big"); goto dump; } } Index: libgo/runtime/thread-linux.c =================================================================== --- libgo/runtime/thread-linux.c (revision 187847) +++ libgo/runtime/thread-linux.c (revision 187848) @@ -68,7 +68,7 @@ runtime_futexwakeup(uint32 *addr, uint32 // I don't know that futex wakeup can return // EAGAIN or EINTR, but if it does, it would be // safe to loop and call futex again. - runtime_printf("futexwakeup addr=%p returned %lld\n", addr, (long long)ret); + runtime_printf("futexwakeup addr=%p returned %D\n", addr, ret); *(int32*)0x1006 = 0x1006; } Index: libgo/runtime/chan.c =================================================================== --- libgo/runtime/chan.c (revision 187847) +++ libgo/runtime/chan.c (revision 187848) @@ -100,8 +100,8 @@ runtime_makechan_c(ChanType *t, int64 hi c->dataqsiz = hint; if(debug) - runtime_printf("makechan: chan=%p; elemsize=%lld; elemalign=%d; dataqsiz=%d\n", - c, (long long)elem->__size, elem->__align, c->dataqsiz); + runtime_printf("makechan: chan=%p; elemsize=%D; elemalign=%d; dataqsiz=%d\n", + c, (int64)elem->__size, elem->__align, c->dataqsiz); return c; } Index: libgo/runtime/malloc.goc =================================================================== --- libgo/runtime/malloc.goc (revision 187847) +++ libgo/runtime/malloc.goc (revision 187848) @@ -139,7 +139,7 @@ __go_free(void *v) m->mallocing = 1; if(!runtime_mlookup(v, nil, nil, &s)) { - // runtime_printf("free %p: not an allocated block\n", v); + runtime_printf("free %p: not an allocated block\n", v); runtime_throw("free runtime_mlookup"); } prof = runtime_blockspecial(v); @@ -367,7 +367,7 @@ runtime_mallocinit(void) if(p == nil) runtime_throw("runtime: cannot reserve arena virtual address space"); if((uintptr)p & (((uintptr)1<__code != GO_PTR) { - // runtime_printf("runtime.SetFinalizer: first argument is %S, not pointer\n", *obj.type->string); + runtime_printf("runtime.SetFinalizer: first argument is %S, not pointer\n", *obj.__type_descriptor->__reflection); goto throw; } if(!runtime_mlookup(obj.__object, &base, &size, nil) || obj.__object != base) { - // runtime_printf("runtime.SetFinalizer: pointer not at beginning of allocated block\n"); + runtime_printf("runtime.SetFinalizer: pointer not at beginning of allocated block\n"); goto throw; } ft = nil; @@ -494,7 +494,7 @@ func SetFinalizer(obj Eface, finalizer E return; badfunc: - // runtime_printf("runtime.SetFinalizer: second argument is %S, not func(%S)\n", *finalizer.type->string, *obj.type->string); + runtime_printf("runtime.SetFinalizer: second argument is %S, not func(%S)\n", *finalizer.__type_descriptor->__reflection, *obj.__type_descriptor->__reflection); throw: runtime_throw("runtime.SetFinalizer"); } Index: libgo/runtime/go-print.c =================================================================== --- libgo/runtime/go-print.c (revision 187847) +++ libgo/runtime/go-print.c (revision 187848) @@ -8,6 +8,7 @@ #include #include +#include "runtime.h" #include "array.h" #include "go-panic.h" #include "go-string.h" @@ -17,154 +18,20 @@ the predeclared functions print/println/panic/panicln. */ void -__go_print_space () -{ - putc (' ', stderr); -} - -void -__go_print_nl () -{ - putc ('\n', stderr); -} - -void -__go_print_string (struct __go_string val) -{ - fprintf (stderr, "%.*s", (int) val.__length, (const char *) val.__data); -} - -void -__go_print_uint64 (uint64_t val) -{ - fprintf (stderr, "%llu", (unsigned long long) val); -} - -void -__go_print_int64 (int64_t val) -{ - fprintf (stderr, "%lld", (long long) val); -} - -void -__go_print_double (double v) -{ - char buf[20]; - int e, s, i, n; - double h; - - if (isnan (v)) - { - fputs ("NaN", stderr); - return; - } - if (__builtin_isinf (v)) - { - putc (v < 0 ? '-' : '+', stderr); - fputs ("Inf", stderr); - return; - } - - /* The number of digits printed. */ - n = 7; - /* The exponent. */ - e = 0; - /* The sign. */ - s = 0; - if (v != 0) - { - if (v < 0) - { - v = -v; - s = 1; - } - - /* Normalize. */ - while (v >= 10) - { - ++e; - v /= 10; - } - while (v < 1) - { - --e; - v *= 10; - } - - /* Round. */ - h = 5; - for (i = 0; i < n; ++i) - h /= 10; - - v += h; - if (v >= 10) - { - ++e; - v /= 10; - } - } - - /* The format is +d.dddd+edd. */ - buf[0] = s ? '-' : '+'; - for (i = 0; i < n; ++i) - { - int d; - - d = v; - buf[i + 2] = d + '0'; - v -= d; - v *= 10; - } - buf[1] = buf[2]; - buf[2] = '.'; - - buf[n + 2] = 'e'; - buf[n + 3] = e < 0 ? '-' : '+'; - if (e < 0) - e = - e; - buf[n + 4] = e / 100 + '0'; - buf[n + 5] = (e / 10) % 10 + '0'; - buf[n + 6] = e % 10 + '0'; - buf[n + 7] = '\0'; - fputs (buf, stderr); -} - -void -__go_print_complex (__complex double val) -{ - putc ('(', stderr); - __go_print_double (__builtin_creal (val)); - __go_print_double (__builtin_cimag (val)); - fputs ("i)", stderr); -} - -void -__go_print_bool (_Bool val) -{ - fputs (val ? "true" : "false", stderr); -} - -void -__go_print_pointer (void *val) -{ - fprintf (stderr, "0x%lx", (unsigned long) (uintptr_t) val); -} - -void __go_print_empty_interface (struct __go_empty_interface e) { - fprintf (stderr, "(%p,%p)", e.__type_descriptor, e.__object); + runtime_printf ("(%p,%p)", e.__type_descriptor, e.__object); } void __go_print_interface (struct __go_interface i) { - fprintf (stderr, "(%p,%p)", i.__methods, i.__object); + runtime_printf ("(%p,%p)", i.__methods, i.__object); } void __go_print_slice (struct __go_open_array val) { - fprintf (stderr, "[%d/%d]", val.__count, val.__capacity); - __go_print_pointer (val.__values); + runtime_printf ("[%d/%d]", val.__count, val.__capacity); + runtime_printpointer (val.__values); } Index: libgo/runtime/go-assert.c =================================================================== --- libgo/runtime/go-assert.c (revision 187847) +++ libgo/runtime/go-assert.c (revision 187848) @@ -7,12 +7,13 @@ #include #include +#include "runtime.h" #include "go-assert.h" void __go_assert_fail (const char *file, unsigned int lineno) { /* FIXME: Eventually we should dump a stack trace here. */ - fprintf (stderr, "%s:%u: libgo assertion failure\n", file, lineno); + runtime_printf ("%s:%U: libgo assertion failure\n", file, (uint64) lineno); abort (); } Index: libgo/runtime/runtime.c =================================================================== --- libgo/runtime/runtime.c (revision 187847) +++ libgo/runtime/runtime.c (revision 187848) @@ -236,3 +236,15 @@ runtime_showframe(const unsigned char *s traceback = runtime_gotraceback(); return traceback > 1 || (__builtin_strchr((const char*)s, '.') != nil && __builtin_memcmp(s, "runtime.", 7) != 0); } + +bool +runtime_isInf(float64 f, int32 sign) +{ + if(!__builtin_isinf(f)) + return false; + if(sign == 0) + return true; + if(sign > 0) + return f > 0; + return f < 0; +} Index: libgo/runtime/runtime.h =================================================================== --- libgo/runtime/runtime.h (revision 187847) +++ libgo/runtime/runtime.h (revision 187848) @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -275,6 +276,7 @@ int32 runtime_ncpu; * common functions and data */ int32 runtime_findnull(const byte*); +void runtime_dump(byte*, int32); /* * very low level c-called @@ -286,6 +288,8 @@ void runtime_goenvs(void); void runtime_goenvs_unix(void); void runtime_throw(const char*) __attribute__ ((noreturn)); void runtime_panicstring(const char*) __attribute__ ((noreturn)); +void runtime_prints(const char*); +void runtime_printf(const char*, ...); void* runtime_mal(uintptr); void runtime_schedinit(void); void runtime_initsig(void); @@ -374,9 +378,35 @@ void __wrap_rtems_task_variable_add(void #endif /* + * Names generated by gccgo. + */ +#define runtime_printbool __go_print_bool +#define runtime_printfloat __go_print_double +#define runtime_printint __go_print_int64 +#define runtime_printiface __go_print_interface +#define runtime_printeface __go_print_empty_interface +#define runtime_printstring __go_print_string +#define runtime_printpointer __go_print_pointer +#define runtime_printuint __go_print_uint64 +#define runtime_printslice __go_print_slice +#define runtime_printcomplex __go_print_complex + +/* * runtime go-called */ -void runtime_panic(Eface); +void runtime_printbool(_Bool); +void runtime_printfloat(double); +void runtime_printint(int64); +void runtime_printiface(Iface); +void runtime_printeface(Eface); +void runtime_printstring(String); +void runtime_printpc(void*); +void runtime_printpointer(void*); +void runtime_printuint(uint64); +void runtime_printhex(uint64); +void runtime_printslice(Slice); +void runtime_printcomplex(__complex double); + struct __go_func_type; void reflect_call(const struct __go_func_type *, const void *, _Bool, _Bool, void **, void **) @@ -384,7 +414,7 @@ void reflect_call(const struct __go_func /* Functions. */ #define runtime_panic __go_panic -#define runtime_printf printf +#define runtime_write(d, v, n) write((d), (v), (n)) #define runtime_malloc(s) __go_alloc(s) #define runtime_free(p) __go_free(p) #define runtime_strcmp(s1, s2) __builtin_strcmp((s1), (s2)) @@ -432,6 +462,8 @@ void runtime_newErrorString(String, Efac /* * wrapped for go users */ +bool runtime_isInf(float64 f, int32 sign); +#define runtime_isNaN(f) __builtin_isnan(f) void runtime_semacquire(uint32 volatile *); void runtime_semrelease(uint32 volatile *); int32 runtime_gomaxprocsfunc(int32 n); Index: libgo/runtime/go-panic.c =================================================================== --- libgo/runtime/go-panic.c (revision 187847) +++ libgo/runtime/go-panic.c (revision 187848) @@ -24,13 +24,13 @@ __printpanics (struct __go_panic_stack * if (p->__next != NULL) { __printpanics (p->__next); - fprintf (stderr, "\t"); + runtime_printf ("\t"); } - fprintf (stderr, "panic: "); + runtime_printf ("panic: "); runtime_printany (p->__arg); if (p->__was_recovered) - fprintf (stderr, " [recovered]"); - fputc ('\n', stderr); + runtime_printf (" [recovered]"); + runtime_printf ("\n"); } /* This implements __go_panic which is used for the panic Index: libgo/runtime/mgc0.c =================================================================== --- libgo/runtime/mgc0.c (revision 187847) +++ libgo/runtime/mgc0.c (revision 187848) @@ -159,7 +159,7 @@ scanblock(byte *b, int64 n) bool keepworking; if((int64)(uintptr)n != n || n < 0) { - // runtime_printf("scanblock %p %lld\n", b, (long long)n); + runtime_printf("scanblock %p %D\n", b, n); runtime_throw("scanblock"); } @@ -190,7 +190,7 @@ scanblock(byte *b, int64 n) // Each iteration scans the block b of length n, queueing pointers in // the work buffer. if(Debug > 1) - runtime_printf("scanblock %p %lld\n", b, (long long) n); + runtime_printf("scanblock %p %D\n", b, n); vp = (void**)b; n >>= (2+PtrSize/8); /* n /= PtrSize (4 or 8) */ @@ -346,7 +346,7 @@ debug_scanblock(byte *b, int64 n) runtime_throw("debug_scanblock without DebugMark"); if((int64)(uintptr)n != n || n < 0) { - //runtime_printf("debug_scanblock %p %D\n", b, n); + runtime_printf("debug_scanblock %p %D\n", b, n); runtime_throw("debug_scanblock"); } @@ -1047,14 +1047,13 @@ runtime_gc(int32 force) mstats.pause_total_ns += t3 - t0; mstats.numgc++; if(mstats.debuggc) - runtime_printf("pause %llu\n", (unsigned long long)t3-t0); + runtime_printf("pause %D\n", t3-t0); if(gctrace) { - runtime_printf("gc%d(%d): %llu+%llu+%llu ms %llu -> %llu MB %llu -> %llu (%llu-%llu) objects %llu handoff\n", - mstats.numgc, work.nproc, (unsigned long long)(t1-t0)/1000000, (unsigned long long)(t2-t1)/1000000, (unsigned long long)(t3-t2)/1000000, - (unsigned long long)heap0>>20, (unsigned long long)heap1>>20, (unsigned long long)obj0, (unsigned long long)obj1, - (unsigned long long) mstats.nmalloc, (unsigned long long)mstats.nfree, - (unsigned long long) nhandoff); + runtime_printf("gc%d(%d): %D+%D+%D ms, %D -> %D MB %D -> %D (%D-%D) objects\n", + mstats.numgc, work.nproc, (t1-t0)/1000000, (t2-t1)/1000000, (t3-t2)/1000000, + heap0>>20, heap1>>20, obj0, obj1, + mstats.nmalloc, mstats.nfree); } runtime_MProf_GC(); @@ -1152,8 +1151,8 @@ runtime_markallocated(void *v, uintptr n { uintptr *b, obits, bits, off, shift; - // if(0) - // runtime_printf("markallocated %p+%p\n", v, n); + if(0) + runtime_printf("markallocated %p+%p\n", v, n); if((byte*)v+n > (byte*)runtime_mheap.arena_used || (byte*)v < runtime_mheap.arena_start) runtime_throw("markallocated: bad pointer"); @@ -1184,8 +1183,8 @@ runtime_markfreed(void *v, uintptr n) { uintptr *b, obits, bits, off, shift; - // if(0) - // runtime_printf("markallocated %p+%p\n", v, n); + if(0) + runtime_printf("markallocated %p+%p\n", v, n); if((byte*)v+n > (byte*)runtime_mheap.arena_used || (byte*)v < runtime_mheap.arena_start) runtime_throw("markallocated: bad pointer"); @@ -1227,7 +1226,7 @@ runtime_checkfreed(void *v, uintptr n) bits = *b>>shift; if((bits & bitAllocated) != 0) { runtime_printf("checkfreed %p+%p: off=%p have=%p\n", - v, (void*)n, (void*)off, (void*)(bits & bitMask)); + v, n, off, bits & bitMask); runtime_throw("checkfreed: not freed"); } } Index: libgo/runtime/mheap.c =================================================================== --- libgo/runtime/mheap.c (revision 187847) +++ libgo/runtime/mheap.c (revision 187848) @@ -191,7 +191,7 @@ MHeap_Grow(MHeap *h, uintptr npage) v = runtime_MHeap_SysAlloc(h, ask); } if(v == nil) { - runtime_printf("runtime: out of memory: cannot allocate %llu-byte block (%llu in use)\n", (unsigned long long)ask, (unsigned long long)mstats.heap_sys); + runtime_printf("runtime: out of memory: cannot allocate %D-byte block (%D in use)\n", (uint64)ask, mstats.heap_sys); return false; } } @@ -277,7 +277,7 @@ MHeap_FreeLocked(MHeap *h, MSpan *s) PageID p; if(s->state != MSpanInUse || s->ref != 0) { - // runtime_printf("MHeap_FreeLocked - span %p ptr %p state %d ref %d\n", s, s->start<state, s->ref); + runtime_printf("MHeap_FreeLocked - span %p ptr %p state %d ref %d\n", s, s->start<state, s->ref); runtime_throw("MHeap_FreeLocked - invalid free"); } mstats.heap_idle += s->npages< 0) - runtime_printf("scvg%d: %p MB released\n", k, (void*)(sumreleased>>20)); - runtime_printf("scvg%d: inuse: %lld, idle: %lld, sys: %lld, released: %lld, consumed: %lld (MB)\n", - k, (long long)(mstats.heap_inuse>>20), (long long)(mstats.heap_idle>>20), (long long)(mstats.heap_sys>>20), - (long long)(mstats.heap_released>>20), (long long)((mstats.heap_sys - mstats.heap_released)>>20)); + runtime_printf("scvg%d: %p MB released\n", k, sumreleased>>20); + runtime_printf("scvg%d: inuse: %D, idle: %D, sys: %D, released: %D, consumed: %D (MB)\n", + k, mstats.heap_inuse>>20, mstats.heap_idle>>20, mstats.heap_sys>>20, + mstats.heap_released>>20, (mstats.heap_sys - mstats.heap_released)>>20); } } } @@ -451,7 +451,7 @@ void runtime_MSpanList_Insert(MSpan *list, MSpan *span) { if(span->next != nil || span->prev != nil) { - // runtime_printf("failed MSpanList_Insert %p %p %p\n", span, span->next, span->prev); + runtime_printf("failed MSpanList_Insert %p %p %p\n", span, span->next, span->prev); runtime_throw("MSpanList_Insert"); } span->next = list->next; Index: libgo/merge.sh =================================================================== --- libgo/merge.sh (revision 187847) +++ libgo/merge.sh (revision 187848) @@ -163,7 +163,7 @@ done done done -runtime="chan.c cpuprof.c lock_futex.c lock_sema.c mcache.c mcentral.c mfinal.c mfixalloc.c mgc0.c mheap.c msize.c proc.c runtime.c runtime.h signal_unix.c malloc.h malloc.goc mprof.goc runtime1.goc sema.goc sigqueue.goc string.goc time.goc" +runtime="chan.c cpuprof.c lock_futex.c lock_sema.c mcache.c mcentral.c mfinal.c mfixalloc.c mgc0.c mheap.c msize.c print.c proc.c runtime.c runtime.h signal_unix.c malloc.h malloc.goc mprof.goc runtime1.goc sema.goc sigqueue.goc string.goc time.goc" for f in $runtime; do merge_c $f $f done Index: libgo/Makefile.am =================================================================== --- libgo/Makefile.am (revision 187847) +++ libgo/Makefile.am (revision 187848) @@ -465,6 +465,7 @@ runtime_files = \ runtime/mgc0.c \ runtime/mheap.c \ runtime/msize.c \ + runtime/print.c \ runtime/proc.c \ runtime/runtime.c \ runtime/signal_unix.c \