OLD | NEW |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // See malloc.h for overview. | 5 // See malloc.h for overview. |
6 // | 6 // |
7 // TODO(rsc): double-check stats. | 7 // TODO(rsc): double-check stats. |
8 | 8 |
9 package runtime | 9 package runtime |
10 #include "runtime.h" | 10 #include "runtime.h" |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 void *v; | 483 void *v; |
484 uintptr typ, p; | 484 uintptr typ, p; |
485 MSpan *s; | 485 MSpan *s; |
486 | 486 |
487 buf = mp->settype_buf; | 487 buf = mp->settype_buf; |
488 endbuf = buf + mp->settype_bufsize; | 488 endbuf = buf + mp->settype_bufsize; |
489 | 489 |
490 runtime·lock(&settype_lock); | 490 runtime·lock(&settype_lock); |
491 while(buf < endbuf) { | 491 while(buf < endbuf) { |
492 v = (void*)*buf; | 492 v = (void*)*buf; |
493 » » *buf = 0; | 493 » » if(false) *buf = 0; |
494 buf++; | 494 buf++; |
495 typ = *buf; | 495 typ = *buf; |
496 buf++; | 496 buf++; |
497 | 497 |
498 // (Manually inlined copy of runtime·MHeap_Lookup) | 498 // (Manually inlined copy of runtime·MHeap_Lookup) |
499 p = (uintptr)v>>PageShift; | 499 p = (uintptr)v>>PageShift; |
500 if(sizeof(void*) == 8) | 500 if(sizeof(void*) == 8) |
501 p -= (uintptr)runtime·mheap->arena_start >> PageShift; | 501 p -= (uintptr)runtime·mheap->arena_start >> PageShift; |
502 s = runtime·mheap->map[p]; | 502 s = runtime·mheap->map[p]; |
503 | 503 |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 runtime·printf("runtime.SetFinalizer: finalizer already set\n"); | 799 runtime·printf("runtime.SetFinalizer: finalizer already set\n"); |
800 goto throw; | 800 goto throw; |
801 } | 801 } |
802 return; | 802 return; |
803 | 803 |
804 badfunc: | 804 badfunc: |
805 runtime·printf("runtime.SetFinalizer: second argument is %S, not func(%S
)\n", *finalizer.type->string, *obj.type->string); | 805 runtime·printf("runtime.SetFinalizer: second argument is %S, not func(%S
)\n", *finalizer.type->string, *obj.type->string); |
806 throw: | 806 throw: |
807 runtime·throw("runtime.SetFinalizer"); | 807 runtime·throw("runtime.SetFinalizer"); |
808 } | 808 } |
OLD | NEW |