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,6 +31,8 @@ | ||
| 31 | /* XXX: make it dynamic */ | 31 | /* XXX: make it dynamic */ |
| 32 | StructEntry struct_entries[MAX_STRUCTS]; | 32 | StructEntry struct_entries[MAX_STRUCTS]; |
| 33 | 33 | ||
| 34 | +static const argtype *thunk_type_next_ptr(const argtype *type_ptr); | ||
| 35 | + | ||
| 34 | static inline const argtype *thunk_type_next(const argtype *type_ptr) | 36 | static inline const argtype *thunk_type_next(const argtype *type_ptr) |
| 35 | { | 37 | { |
| 36 | int type; | 38 | int type; |
| @@ -47,9 +49,9 @@ static inline const argtype *thunk_type_next(const argtype *type_ptr) | @@ -47,9 +49,9 @@ static inline const argtype *thunk_type_next(const argtype *type_ptr) | ||
| 47 | case TYPE_PTRVOID: | 49 | case TYPE_PTRVOID: |
| 48 | return type_ptr; | 50 | return type_ptr; |
| 49 | case TYPE_PTR: | 51 | case TYPE_PTR: |
| 50 | - return thunk_type_next(type_ptr); | 52 | + return thunk_type_next_ptr(type_ptr); |
| 51 | case TYPE_ARRAY: | 53 | case TYPE_ARRAY: |
| 52 | - return thunk_type_next(type_ptr + 1); | 54 | + return thunk_type_next_ptr(type_ptr + 1); |
| 53 | case TYPE_STRUCT: | 55 | case TYPE_STRUCT: |
| 54 | return type_ptr + 1; | 56 | return type_ptr + 1; |
| 55 | default: | 57 | default: |
| @@ -57,6 +59,11 @@ static inline const argtype *thunk_type_next(const argtype *type_ptr) | @@ -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 | void thunk_register_struct(int id, const char *name, const argtype *types) | 67 | void thunk_register_struct(int id, const char *name, const argtype *types) |
| 61 | { | 68 | { |
| 62 | const argtype *type_ptr; | 69 | const argtype *type_ptr; |
| @@ -267,3 +274,15 @@ unsigned int host_to_target_bitmask(unsigned int alpha_mask, | @@ -267,3 +274,15 @@ unsigned int host_to_target_bitmask(unsigned int alpha_mask, | ||
| 267 | } | 274 | } |
| 268 | return(x86_mask); | 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,6 +75,9 @@ const argtype *thunk_convert(void *dst, const void *src, | ||
| 75 | 75 | ||
| 76 | extern StructEntry struct_entries[]; | 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 | static inline int thunk_type_size(const argtype *type_ptr, int is_host) | 81 | static inline int thunk_type_size(const argtype *type_ptr, int is_host) |
| 79 | { | 82 | { |
| 80 | int type, size; | 83 | int type, size; |
| @@ -103,7 +106,7 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host) | @@ -103,7 +106,7 @@ static inline int thunk_type_size(const argtype *type_ptr, int is_host) | ||
| 103 | break; | 106 | break; |
| 104 | case TYPE_ARRAY: | 107 | case TYPE_ARRAY: |
| 105 | size = type_ptr[1]; | 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 | case TYPE_STRUCT: | 110 | case TYPE_STRUCT: |
| 108 | se = struct_entries + type_ptr[1]; | 111 | se = struct_entries + type_ptr[1]; |
| 109 | return se->size[is_host]; | 112 | return se->size[is_host]; |
| @@ -139,7 +142,7 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host) | @@ -139,7 +142,7 @@ static inline int thunk_type_align(const argtype *type_ptr, int is_host) | ||
| 139 | } | 142 | } |
| 140 | break; | 143 | break; |
| 141 | case TYPE_ARRAY: | 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 | case TYPE_STRUCT: | 146 | case TYPE_STRUCT: |
| 144 | se = struct_entries + type_ptr[1]; | 147 | se = struct_entries + type_ptr[1]; |
| 145 | return se->align[is_host]; | 148 | return se->align[is_host]; |