Commit 265531154a05a26e9b79819ddd068c285e681cbc
1 parent
3f4afa14
Fix attempt to inline recursive functions.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3700 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
26 additions
and
4 deletions
thunk.c
| ... | ... | @@ -31,6 +31,8 @@ |
| 31 | 31 | /* XXX: make it dynamic */ |
| 32 | 32 | StructEntry struct_entries[MAX_STRUCTS]; |
| 33 | 33 | |
| 34 | +static const argtype *thunk_type_next_ptr(const argtype *type_ptr); | |
| 35 | + | |
| 34 | 36 | static inline const argtype *thunk_type_next(const argtype *type_ptr) |
| 35 | 37 | { |
| 36 | 38 | int type; |
| ... | ... | @@ -47,9 +49,9 @@ static inline const argtype *thunk_type_next(const argtype *type_ptr) |
| 47 | 49 | case TYPE_PTRVOID: |
| 48 | 50 | return type_ptr; |
| 49 | 51 | case TYPE_PTR: |
| 50 | - return thunk_type_next(type_ptr); | |
| 52 | + return thunk_type_next_ptr(type_ptr); | |
| 51 | 53 | case TYPE_ARRAY: |
| 52 | - return thunk_type_next(type_ptr + 1); | |
| 54 | + return thunk_type_next_ptr(type_ptr + 1); | |
| 53 | 55 | case TYPE_STRUCT: |
| 54 | 56 | return type_ptr + 1; |
| 55 | 57 | default: |
| ... | ... | @@ -57,6 +59,11 @@ static inline const argtype *thunk_type_next(const argtype *type_ptr) |
| 57 | 59 | } |
| 58 | 60 | } |
| 59 | 61 | |
| 62 | +static const argtype *thunk_type_next_ptr(const argtype *type_ptr) | |
| 63 | +{ | |
| 64 | + return thunk_type_next(type_ptr); | |
| 65 | +} | |
| 66 | + | |
| 60 | 67 | void thunk_register_struct(int id, const char *name, const argtype *types) |
| 61 | 68 | { |
| 62 | 69 | const argtype *type_ptr; |
| ... | ... | @@ -267,3 +274,15 @@ unsigned int host_to_target_bitmask(unsigned int alpha_mask, |
| 267 | 274 | } |
| 268 | 275 | return(x86_mask); |
| 269 | 276 | } |
| 277 | + | |
| 278 | +#ifndef NO_THUNK_TYPE_SIZE | |
| 279 | +int thunk_type_size_array(const argtype *type_ptr, int is_host) | |
| 280 | +{ | |
| 281 | + return thunk_type_size(type_ptr, is_host); | |
| 282 | +} | |
| 283 | + | |
| 284 | +int thunk_type_align_array(const argtype *type_ptr, int is_host) | |
| 285 | +{ | |
| 286 | + return thunk_type_align(type_ptr, is_host); | |
| 287 | +} | |
| 288 | +#endif /* ndef NO_THUNK_TYPE_SIZE */ | ... | ... |
thunk.h
| ... | ... | @@ -75,6 +75,9 @@ const argtype *thunk_convert(void *dst, const void *src, |
| 75 | 75 | |
| 76 | 76 | extern StructEntry struct_entries[]; |
| 77 | 77 | |
| 78 | +int thunk_type_size_array(const argtype *type_ptr, int is_host); | |
| 79 | +int thunk_type_align_array(const argtype *type_ptr, int is_host); | |
| 80 | + | |
| 78 | 81 | static inline int thunk_type_size(const argtype *type_ptr, int is_host) |
| 79 | 82 | { |
| 80 | 83 | int type, size; |
| ... | ... | @@ -103,7 +106,7 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host) |
| 103 | 106 | break; |
| 104 | 107 | case TYPE_ARRAY: |
| 105 | 108 | size = type_ptr[1]; |
| 106 | - return size * thunk_type_size(type_ptr + 2, is_host); | |
| 109 | + return size * thunk_type_size_array(type_ptr + 2, is_host); | |
| 107 | 110 | case TYPE_STRUCT: |
| 108 | 111 | se = struct_entries + type_ptr[1]; |
| 109 | 112 | return se->size[is_host]; |
| ... | ... | @@ -139,7 +142,7 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host) |
| 139 | 142 | } |
| 140 | 143 | break; |
| 141 | 144 | case TYPE_ARRAY: |
| 142 | - return thunk_type_align(type_ptr + 2, is_host); | |
| 145 | + return thunk_type_align_array(type_ptr + 2, is_host); | |
| 143 | 146 | case TYPE_STRUCT: |
| 144 | 147 | se = struct_entries + type_ptr[1]; |
| 145 | 148 | return se->align[is_host]; | ... | ... |