Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2340)

Delta Between Two Patch Sets: src/pkg/runtime/hashmap.goc

Issue 95560046: code review 95560046: reflect: don't panic on delete from nil map. (Closed)
Left Patch Set: Created 9 years, 10 months ago
Right Patch Set: diff -r eabf83a5e11c https://khr%40golang.org@code.google.com/p/go/ Created 9 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/reflect/all_test.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 package runtime 5 package runtime
6 #include "runtime.h" 6 #include "runtime.h"
7 #include "arch_GOARCH.h" 7 #include "arch_GOARCH.h"
8 #include "malloc.h" 8 #include "malloc.h"
9 #include "type.h" 9 #include "type.h"
10 #include "race.h" 10 #include "race.h"
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 t->key->alg->print(t->key->size, key); 983 t->key->alg->print(t->key->size, key);
984 runtime·prints("; val="); 984 runtime·prints("; val=");
985 t->elem->alg->print(t->elem->size, val); 985 t->elem->alg->print(t->elem->size, val);
986 runtime·prints("\n"); 986 runtime·prints("\n");
987 } 987 }
988 } 988 }
989 989
990 #pragma textflag NOSPLIT 990 #pragma textflag NOSPLIT
991 func reflect·mapdelete(t *MapType, h *Hmap, key *byte) { 991 func reflect·mapdelete(t *MapType, h *Hmap, key *byte) {
992 if(h == nil) 992 if(h == nil)
993 » » runtime·panicstring("delete from nil map"); 993 » » return; // see bug 8051
994 if(raceenabled) { 994 if(raceenabled) {
995 runtime·racewritepc(h, runtime·getcallerpc(&t), reflect·mapdelet e); 995 runtime·racewritepc(h, runtime·getcallerpc(&t), reflect·mapdelet e);
996 runtime·racereadobjectpc(key, t->key, runtime·getcallerpc(&t), r eflect·mapdelete); 996 runtime·racereadobjectpc(key, t->key, runtime·getcallerpc(&t), r eflect·mapdelete);
997 } 997 }
998 hash_remove(t, h, key); 998 hash_remove(t, h, key);
999 999
1000 if(debug) { 1000 if(debug) {
1001 runtime·prints("mapdelete: map="); 1001 runtime·prints("mapdelete: map=");
1002 runtime·printpointer(h); 1002 runtime·printpointer(h);
1003 runtime·prints("; key="); 1003 runtime·prints("; key=");
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 len = 0; 1069 len = 0;
1070 else { 1070 else {
1071 len = h->count; 1071 len = h->count;
1072 if(raceenabled) 1072 if(raceenabled)
1073 runtime·racereadpc(h, runtime·getcallerpc(&h), reflect·m aplen); 1073 runtime·racereadpc(h, runtime·getcallerpc(&h), reflect·m aplen);
1074 } 1074 }
1075 } 1075 }
1076 1076
1077 // exported value for testing 1077 // exported value for testing
1078 float64 runtime·hashLoad = LOAD; 1078 float64 runtime·hashLoad = LOAD;
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b