]>
Commit | Line | Data |
---|---|---|
d819f5cd PS |
1 | --- dietlibc-0.25/include/sys/cdefs.h.orig 2004-01-07 16:06:48.000000000 +0100 |
2 | +++ dietlibc-0.25/include/sys/cdefs.h 2004-04-20 15:05:15.157348200 +0200 | |
3 | @@ -63,4 +63,11 @@ | |
4 | #define __deprecated__ | |
5 | #endif | |
6 | ||
7 | +#ifdef __i386__ | |
8 | +/* regparm exists only on i386 */ | |
9 | +#define FASTCALL(n) __attribute__((regparm(n))) | |
10 | +#else | |
11 | +#define FASTCALL(n) | |
12 | +#endif | |
13 | + | |
14 | #endif | |
15 | --- dietlibc-0.25/lib/alloc.c.orig 2004-01-27 15:24:11.000000000 +0100 | |
16 | +++ dietlibc-0.25/lib/alloc.c 2004-04-20 15:08:25.261447984 +0200 | |
17 | @@ -44,14 +44,7 @@ | |
18 | ||
19 | /* a simple mmap :) */ | |
20 | ||
21 | -#ifdef __i386__ | |
22 | -/* regparm exists only on i386 */ | |
23 | -static void *do_mmap(size_t size) __attribute__((regparm(1))); | |
24 | -static size_t get_index(size_t _size) __attribute__((regparm(1))); | |
25 | -static void* __small_malloc(size_t _size) __attribute__((regparm(1))); | |
26 | -#endif | |
27 | - | |
28 | -static void *do_mmap(size_t size) { | |
29 | +static FASTCALL(1) void *do_mmap(size_t size) { | |
30 | return mmap(0, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, (size_t)0); | |
31 | } | |
32 | ||
33 | @@ -70,7 +63,7 @@ | |
34 | ||
35 | static inline int __ind_shift() { return (MEM_BLOCK_SIZE==4096)?4:5; } | |
36 | ||
37 | -static size_t get_index(size_t _size) { | |
38 | +static FASTCALL(1) size_t get_index(size_t _size) { | |
39 | register size_t idx=0; | |
40 | if (_size) { | |
41 | register size_t size=((_size-1)&(MEM_BLOCK_SIZE-1))>>__ind_shift(); | |
42 | @@ -80,9 +73,7 @@ | |
43 | } | |
44 | ||
45 | /* small mem */ | |
46 | -static void __small_free(void*_ptr,size_t _size) __attribute__((regparm(2))); | |
47 | - | |
48 | -static void __small_free(void*_ptr,size_t _size) { | |
49 | +static FASTCALL(2) void __small_free(void*_ptr,size_t _size) { | |
50 | __alloc_t* ptr=BLOCK_START(_ptr); | |
51 | size_t size=_size; | |
52 | size_t idx=get_index(size); | |
53 | @@ -93,7 +84,7 @@ | |
54 | __small_mem[idx]=ptr; | |
55 | } | |
56 | ||
57 | -static void* __small_malloc(size_t _size) { | |
58 | +static FASTCALL(1) void* __small_malloc(size_t _size) { | |
59 | __alloc_t *ptr; | |
60 | size_t size=_size; | |
61 | size_t idx; | |
62 | --- dietlibc-0.25/libpthread/pthread_internal.c.orig 2003-09-29 16:00:59.000000000 +0200 | |
63 | +++ dietlibc-0.25/libpthread/pthread_internal.c 2004-04-20 15:11:08.280665296 +0200 | |
64 | @@ -49,10 +49,7 @@ | |
65 | static inline unsigned long hash_tid(int tid) { return (tid&(NR_BUCKETS-1)); } | |
66 | ||
67 | /* O(1) */ | |
68 | -#if defined(__i386__) | |
69 | -static void __thread_add_tid_(_pthread_descr*root,_pthread_descr thread) __attribute__((regparm(2))); | |
70 | -#endif | |
71 | -static void __thread_add_tid_(_pthread_descr*root,_pthread_descr thread) { | |
72 | +static FASTCALL(2) void __thread_add_tid_(_pthread_descr*root,_pthread_descr thread) { | |
73 | _pthread_descr tmp=*root; | |
74 | thread->prev=root; | |
75 | thread->next=tmp; | |
76 | @@ -76,12 +73,12 @@ | |
77 | /* find thread by thread-id O(n) (LOCK struct if found) */ | |
78 | /* O(n*) linear to the number of thread in the same bucket */ | |
79 | #if defined(__i386__) | |
80 | -static _pthread_descr __thread_find_(int pid) __attribute__((regparm(1))); | |
81 | +static FASTCALL(1) _pthread_descr __thread_find_(int pid); | |
82 | _pthread_descr __thread_find(int pid) { return __thread_find_(pid); } | |
83 | #else | |
84 | _pthread_descr __thread_find(int pid) __attribute__((alias("__thread_find_"))); | |
85 | #endif | |
86 | -static _pthread_descr __thread_find_(int pid) { | |
87 | +static FASTCALL(1) _pthread_descr __thread_find_(int pid) { | |
88 | _pthread_descr cur; | |
89 | if (__thread_started==PTHREAD_ONCE_INIT) { /* uninitialised */ | |
90 | LOCK(&_main_thread); |