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

Delta Between Two Patch Sets: src/pkg/runtime/runtime.h

Issue 7543043: code review 7543043: runtime: faster & safer hash function (Closed)
Left Patch Set: diff -r 67fc3cb0d3aa https://code.google.com/p/go/ Created 12 years, 1 month ago
Right Patch Set: diff -r a45e271add6c https://code.google.com/p/go/ Created 12 years 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:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/mapspeed_test.go ('k') | src/pkg/runtime/runtime.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 /* 5 /*
6 * basic types 6 * basic types
7 */ 7 */
8 typedef signed char int8; 8 typedef signed char int8;
9 typedef unsigned char uint8; 9 typedef unsigned char uint8;
10 typedef signed short int16; 10 typedef signed short int16;
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 uintptr stack0; 228 uintptr stack0;
229 FuncVal* fnstart; // initial function 229 FuncVal* fnstart; // initial function
230 G* alllink; // on allg 230 G* alllink; // on allg
231 void* param; // passed parameter on wakeup 231 void* param; // passed parameter on wakeup
232 int16 status; 232 int16 status;
233 int64 goid; 233 int64 goid;
234 uint32 selgen; // valid sudog pointer 234 uint32 selgen; // valid sudog pointer
235 int8* waitreason; // if status==Gwaiting 235 int8* waitreason; // if status==Gwaiting
236 G* schedlink; 236 G* schedlink;
237 bool ispanic; 237 bool ispanic;
238 » bool» issystem; 238 » bool» issystem;» // do not output in stack dump
239 » int8» raceignore; // ignore race detection events 239 » bool» isbackground;» // ignore in deadlock detector
240 » int8» raceignore;» // ignore race detection events
240 M* m; // for debuggers, but offset not hard-coded 241 M* m; // for debuggers, but offset not hard-coded
241 M* lockedm; 242 M* lockedm;
242 int32 sig; 243 int32 sig;
243 int32 writenbuf; 244 int32 writenbuf;
244 byte* writebuf; 245 byte* writebuf;
245 DeferChunk *dchunk; 246 DeferChunk *dchunk;
246 DeferChunk *dchunknext; 247 DeferChunk *dchunknext;
247 uintptr sigcode0; 248 uintptr sigcode0;
248 uintptr sigcode1; 249 uintptr sigcode1;
249 uintptr sigpc; 250 uintptr sigpc;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 uint32 moreframesize_minalloc; 314 uint32 moreframesize_minalloc;
314 315
315 uintptr settype_buf[1024]; 316 uintptr settype_buf[1024];
316 uintptr settype_bufsize; 317 uintptr settype_bufsize;
317 318
318 #ifdef GOOS_windows 319 #ifdef GOOS_windows
319 void* thread; // thread handle 320 void* thread; // thread handle
320 #endif 321 #endif
321 #ifdef GOOS_plan9 322 #ifdef GOOS_plan9
322 int8* notesig; 323 int8* notesig;
324 byte* errstr;
323 #endif 325 #endif
324 SEH* seh; 326 SEH* seh;
325 uintptr end[]; 327 uintptr end[];
326 }; 328 };
327 329
328 struct P 330 struct P
329 { 331 {
330 Lock; 332 Lock;
331 333
332 uint32 status; // one of Pidle/Prunning/... 334 uint32 status; // one of Pidle/Prunning/...
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 void (*body)(ParFor*, uint32); // executed for each element 477 void (*body)(ParFor*, uint32); // executed for each element
476 uint32 done; // number of idle threads 478 uint32 done; // number of idle threads
477 uint32 nthr; // total number of threads 479 uint32 nthr; // total number of threads
478 uint32 nthrmax; // maximum number of threads 480 uint32 nthrmax; // maximum number of threads
479 uint32 thrseq; // thread id sequencer 481 uint32 thrseq; // thread id sequencer
480 uint32 cnt; // iteration space [0, cnt) 482 uint32 cnt; // iteration space [0, cnt)
481 void *ctx; // arbitrary user context 483 void *ctx; // arbitrary user context
482 bool wait; // if true, wait while all threads finis h processing, 484 bool wait; // if true, wait while all threads finis h processing,
483 // otherwise parfor may return while oth er threads are still working 485 // otherwise parfor may return while oth er threads are still working
484 ParForThread *thr; // array of thread descriptors 486 ParForThread *thr; // array of thread descriptors
487 uint32 pad; // to align ParForThread.pos for 64-bit atomic operations
485 // stats 488 // stats
486 uint64 nsteal; 489 uint64 nsteal;
487 uint64 nstealcnt; 490 uint64 nstealcnt;
488 uint64 nprocyield; 491 uint64 nprocyield;
489 uint64 nosyield; 492 uint64 nosyield;
490 uint64 nsleep; 493 uint64 nsleep;
491 }; 494 };
492 495
493 // Track memory allocated by code not written in Go during a cgo call, 496 // Track memory allocated by code not written in Go during a cgo call,
494 // so that the garbage collector can see them. 497 // so that the garbage collector can see them.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 struct Alg 551 struct Alg
549 { 552 {
550 void (*hash)(uintptr*, uintptr, void*); 553 void (*hash)(uintptr*, uintptr, void*);
551 void (*equal)(bool*, uintptr, void*, void*); 554 void (*equal)(bool*, uintptr, void*, void*);
552 void (*print)(uintptr, void*); 555 void (*print)(uintptr, void*);
553 void (*copy)(uintptr, void*, void*); 556 void (*copy)(uintptr, void*, void*);
554 }; 557 };
555 558
556 extern Alg runtime·algarray[Amax]; 559 extern Alg runtime·algarray[Amax];
557 560
561 byte* runtime·startup_random_data;
562 uint32 runtime·startup_random_data_len;
563 void runtime·get_random_data(byte**, int32*);
558 564
559 enum { 565 enum {
560 // hashinit wants this many random bytes 566 // hashinit wants this many random bytes
561 » hash_random_bytes = 32 567 » HashRandomBytes = 32
562 }; 568 };
563 void» runtime·hashinit(uint8*); 569 void» runtime·hashinit(void);
564 570
565 void runtime·memhash(uintptr*, uintptr, void*); 571 void runtime·memhash(uintptr*, uintptr, void*);
566 void runtime·nohash(uintptr*, uintptr, void*); 572 void runtime·nohash(uintptr*, uintptr, void*);
567 void runtime·strhash(uintptr*, uintptr, void*); 573 void runtime·strhash(uintptr*, uintptr, void*);
568 void runtime·interhash(uintptr*, uintptr, void*); 574 void runtime·interhash(uintptr*, uintptr, void*);
569 void runtime·nilinterhash(uintptr*, uintptr, void*); 575 void runtime·nilinterhash(uintptr*, uintptr, void*);
570 void runtime·aeshash(uintptr*, uintptr, void*); 576 void runtime·aeshash(uintptr*, uintptr, void*);
571 void runtime·aeshash32(uintptr*, uintptr, void*); 577 void runtime·aeshash32(uintptr*, uintptr, void*);
572 void runtime·aeshash64(uintptr*, uintptr, void*); 578 void runtime·aeshash64(uintptr*, uintptr, void*);
573 void runtime·aeshashstr(uintptr*, uintptr, void*); 579 void runtime·aeshashstr(uintptr*, uintptr, void*);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 void runtime·goargs(void); 678 void runtime·goargs(void);
673 void runtime·goenvs(void); 679 void runtime·goenvs(void);
674 void runtime·goenvs_unix(void); 680 void runtime·goenvs_unix(void);
675 void* runtime·getu(void); 681 void* runtime·getu(void);
676 void runtime·throw(int8*); 682 void runtime·throw(int8*);
677 void runtime·panicstring(int8*); 683 void runtime·panicstring(int8*);
678 void runtime·prints(int8*); 684 void runtime·prints(int8*);
679 void runtime·printf(int8*, ...); 685 void runtime·printf(int8*, ...);
680 byte* runtime·mchr(byte*, byte, byte*); 686 byte* runtime·mchr(byte*, byte, byte*);
681 int32 runtime·mcmp(byte*, byte*, uint32); 687 int32 runtime·mcmp(byte*, byte*, uint32);
682 void» runtime·memmove(void*, void*, uint32); 688 void» runtime·memmove(void*, void*, uintptr);
683 void* runtime·mal(uintptr); 689 void* runtime·mal(uintptr);
684 String runtime·catstring(String, String); 690 String runtime·catstring(String, String);
685 String runtime·gostring(byte*); 691 String runtime·gostring(byte*);
686 String runtime·gostringn(byte*, intgo); 692 String runtime·gostringn(byte*, intgo);
687 Slice runtime·gobytes(byte*, intgo); 693 Slice runtime·gobytes(byte*, intgo);
688 String runtime·gostringnocopy(byte*); 694 String runtime·gostringnocopy(byte*);
689 String runtime·gostringw(uint16*); 695 String runtime·gostringw(uint16*);
690 void runtime·initsig(void); 696 void runtime·initsig(void);
691 void runtime·sigenable(uint32 sig); 697 void runtime·sigenable(uint32 sig);
692 int32 runtime·gotraceback(void); 698 int32 runtime·gotraceback(void);
693 void runtime·goroutineheader(G*); 699 void runtime·goroutineheader(G*);
694 void runtime·traceback(uint8 *pc, uint8 *sp, uint8 *lr, G* gp); 700 void runtime·traceback(uint8 *pc, uint8 *sp, uint8 *lr, G* gp);
695 void runtime·tracebackothers(G*); 701 void runtime·tracebackothers(G*);
702 int32 runtime·open(int8*, int32, int32);
703 int32 runtime·read(int32, void*, int32);
696 int32 runtime·write(int32, void*, int32); 704 int32 runtime·write(int32, void*, int32);
705 int32 runtime·close(int32);
697 int32 runtime·mincore(void*, uintptr, byte*); 706 int32 runtime·mincore(void*, uintptr, byte*);
698 bool runtime·cas(uint32*, uint32, uint32); 707 bool runtime·cas(uint32*, uint32, uint32);
699 bool runtime·cas64(uint64*, uint64*, uint64); 708 bool runtime·cas64(uint64*, uint64*, uint64);
700 bool runtime·casp(void**, void*, void*); 709 bool runtime·casp(void**, void*, void*);
701 // Don't confuse with XADD x86 instruction, 710 // Don't confuse with XADD x86 instruction,
702 // this one is actually 'addx', that is, add-and-fetch. 711 // this one is actually 'addx', that is, add-and-fetch.
703 uint32 runtime·xadd(uint32 volatile*, int32); 712 uint32 runtime·xadd(uint32 volatile*, int32);
704 uint64 runtime·xadd64(uint64 volatile*, int64); 713 uint64 runtime·xadd64(uint64 volatile*, int64);
705 uint32 runtime·xchg(uint32 volatile*, uint32); 714 uint32 runtime·xchg(uint32 volatile*, uint32);
715 uint64 runtime·xchg64(uint64 volatile*, uint64);
706 uint32 runtime·atomicload(uint32 volatile*); 716 uint32 runtime·atomicload(uint32 volatile*);
707 void runtime·atomicstore(uint32 volatile*, uint32); 717 void runtime·atomicstore(uint32 volatile*, uint32);
708 void runtime·atomicstore64(uint64 volatile*, uint64); 718 void runtime·atomicstore64(uint64 volatile*, uint64);
709 uint64 runtime·atomicload64(uint64 volatile*); 719 uint64 runtime·atomicload64(uint64 volatile*);
710 void* runtime·atomicloadp(void* volatile*); 720 void* runtime·atomicloadp(void* volatile*);
711 void runtime·atomicstorep(void* volatile*, void*); 721 void runtime·atomicstorep(void* volatile*, void*);
712 void runtime·jmpdefer(FuncVal*, void*); 722 void runtime·jmpdefer(FuncVal*, void*);
713 void runtime·exit1(int32); 723 void runtime·exit1(int32);
714 void runtime·ready(G*); 724 void runtime·ready(G*);
715 byte* runtime·getenv(int8*); 725 byte* runtime·getenv(int8*);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 void runtime·startpanic(void); 776 void runtime·startpanic(void);
767 void runtime·unwindstack(G*, byte*); 777 void runtime·unwindstack(G*, byte*);
768 void runtime·sigprof(uint8 *pc, uint8 *sp, uint8 *lr, G *gp); 778 void runtime·sigprof(uint8 *pc, uint8 *sp, uint8 *lr, G *gp);
769 void runtime·resetcpuprofiler(int32); 779 void runtime·resetcpuprofiler(int32);
770 void runtime·setcpuprofilerate(void(*)(uintptr*, int32), int32); 780 void runtime·setcpuprofilerate(void(*)(uintptr*, int32), int32);
771 void runtime·usleep(uint32); 781 void runtime·usleep(uint32);
772 int64 runtime·cputicks(void); 782 int64 runtime·cputicks(void);
773 int64 runtime·tickspersecond(void); 783 int64 runtime·tickspersecond(void);
774 void runtime·blockevent(int64, int32); 784 void runtime·blockevent(int64, int32);
775 extern int64 runtime·blockprofilerate; 785 extern int64 runtime·blockprofilerate;
786 void runtime·addtimer(Timer*);
787 bool runtime·deltimer(Timer*);
788 G* runtime·netpoll(bool);
776 789
777 #pragma varargck argpos runtime·printf 1 790 #pragma varargck argpos runtime·printf 1
778 #pragma varargck type "d" int32 791 #pragma varargck type "d" int32
779 #pragma varargck type "d" uint32 792 #pragma varargck type "d" uint32
780 #pragma varargck type "D" int64 793 #pragma varargck type "D" int64
781 #pragma varargck type "D" uint64 794 #pragma varargck type "D" uint64
782 #pragma varargck type "x" int32 795 #pragma varargck type "x" int32
783 #pragma varargck type "x" uint32 796 #pragma varargck type "x" uint32
784 #pragma varargck type "X" int64 797 #pragma varargck type "X" int64
785 #pragma varargck type "X" uint64 798 #pragma varargck type "X" uint64
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 extern float64 runtime·nan; 980 extern float64 runtime·nan;
968 extern float64 runtime·posinf; 981 extern float64 runtime·posinf;
969 extern float64 runtime·neginf; 982 extern float64 runtime·neginf;
970 extern uint64 ·nan; 983 extern uint64 ·nan;
971 extern uint64 ·posinf; 984 extern uint64 ·posinf;
972 extern uint64 ·neginf; 985 extern uint64 ·neginf;
973 #define ISNAN(f) ((f) != (f)) 986 #define ISNAN(f) ((f) != (f))
974 987
975 enum 988 enum
976 { 989 {
977 » UseSpanType = 1, 990 » UseSpanType = 0,
978 }; 991 };
LEFTRIGHT

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