Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: celt/stack_alloc.h

Issue 882843002: Update to opus-HEAD-66611f1. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/opus.git@master
Patch Set: Add the contents of Makefile.mips back. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « celt/rate.c ('k') | celt/static_modes_fixed.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (C) 2002-2003 Jean-Marc Valin 1 /* Copyright (C) 2002-2003 Jean-Marc Valin
2 Copyright (C) 2007-2009 Xiph.Org Foundation */ 2 Copyright (C) 2007-2009 Xiph.Org Foundation */
3 /** 3 /**
4 @file stack_alloc.h 4 @file stack_alloc.h
5 @brief Temporary memory allocation on stack 5 @brief Temporary memory allocation on stack
6 */ 6 */
7 /* 7 /*
8 Redistribution and use in source and binary forms, with or without 8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions 9 modification, are permitted provided that the following conditions
10 are met: 10 are met:
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 # endif 109 # endif
110 110
111 #define SAVE_STACK 111 #define SAVE_STACK
112 #define RESTORE_STACK 112 #define RESTORE_STACK
113 #define ALLOC_STACK 113 #define ALLOC_STACK
114 #define ALLOC_NONE 0 114 #define ALLOC_NONE 0
115 115
116 #else 116 #else
117 117
118 #ifdef CELT_C 118 #ifdef CELT_C
119 char *scratch_ptr=0;
119 char *global_stack=0; 120 char *global_stack=0;
120 #else 121 #else
121 extern char *global_stack; 122 extern char *global_stack;
123 extern char *scratch_ptr;
122 #endif /* CELT_C */ 124 #endif /* CELT_C */
123 125
124 #ifdef ENABLE_VALGRIND 126 #ifdef ENABLE_VALGRIND
125 127
126 #include <valgrind/memcheck.h> 128 #include <valgrind/memcheck.h>
127 129
128 #ifdef CELT_C 130 #ifdef CELT_C
129 char *global_stack_top=0; 131 char *global_stack_top=0;
130 #else 132 #else
131 extern char *global_stack_top; 133 extern char *global_stack_top;
132 #endif /* CELT_C */ 134 #endif /* CELT_C */
133 135
134 #define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1)) 136 #define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
135 #define PUSH(stack, size, type) (VALGRIND_MAKE_MEM_NOACCESS(stack, global_stack_ top-stack),ALIGN((stack),sizeof(type)/sizeof(char)),VALGRIND_MAKE_MEM_UNDEFINED( stack, ((size)*sizeof(type)/sizeof(char))),(stack)+=(2*(size)*sizeof(type)/sizeo f(char)),(type*)((stack)-(2*(size)*sizeof(type)/sizeof(char)))) 137 #define PUSH(stack, size, type) (VALGRIND_MAKE_MEM_NOACCESS(stack, global_stack_ top-stack),ALIGN((stack),sizeof(type)/sizeof(char)),VALGRIND_MAKE_MEM_UNDEFINED( stack, ((size)*sizeof(type)/sizeof(char))),(stack)+=(2*(size)*sizeof(type)/sizeo f(char)),(type*)((stack)-(2*(size)*sizeof(type)/sizeof(char))))
136 #define RESTORE_STACK ((global_stack = _saved_stack),VALGRIND_MAKE_MEM_NOACCESS( global_stack, global_stack_top-global_stack)) 138 #define RESTORE_STACK ((global_stack = _saved_stack),VALGRIND_MAKE_MEM_NOACCESS( global_stack, global_stack_top-global_stack))
137 #define ALLOC_STACK char *_saved_stack; ((global_stack = (global_stack==0) ? ((g lobal_stack_top=opus_alloc_scratch(GLOBAL_STACK_SIZE*2)+(GLOBAL_STACK_SIZE*2))-( GLOBAL_STACK_SIZE*2)) : global_stack),VALGRIND_MAKE_MEM_NOACCESS(global_stack, g lobal_stack_top-global_stack)); _saved_stack = global_stack; 139 #define ALLOC_STACK char *_saved_stack; ((global_stack = (global_stack==0) ? ((g lobal_stack_top=opus_alloc_scratch(GLOBAL_STACK_SIZE*2)+(GLOBAL_STACK_SIZE*2))-( GLOBAL_STACK_SIZE*2)) : global_stack),VALGRIND_MAKE_MEM_NOACCESS(global_stack, g lobal_stack_top-global_stack)); _saved_stack = global_stack;
138 140
139 #else 141 #else
140 142
141 #define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1)) 143 #define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
142 #define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)/sizeof(char)),(stack )+=(size)*(sizeof(type)/sizeof(char)),(type*)((stack)-(size)*(sizeof(type)/sizeo f(char)))) 144 #define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)/sizeof(char)),(stack )+=(size)*(sizeof(type)/sizeof(char)),(type*)((stack)-(size)*(sizeof(type)/sizeo f(char))))
145 #if 0 /* Set this to 1 to instrument pseudostack usage */
146 #define RESTORE_STACK (printf("%ld %s:%d\n", global_stack-scratch_ptr, __FILE__, __LINE__),global_stack = _saved_stack)
147 #else
143 #define RESTORE_STACK (global_stack = _saved_stack) 148 #define RESTORE_STACK (global_stack = _saved_stack)
144 #define ALLOC_STACK char *_saved_stack; (global_stack = (global_stack==0) ? opus _alloc_scratch(GLOBAL_STACK_SIZE) : global_stack); _saved_stack = global_stack; 149 #endif
150 #define ALLOC_STACK char *_saved_stack; (global_stack = (global_stack==0) ? (scr atch_ptr=opus_alloc_scratch(GLOBAL_STACK_SIZE)) : global_stack); _saved_stack = global_stack;
145 151
146 #endif /* ENABLE_VALGRIND */ 152 #endif /* ENABLE_VALGRIND */
147 153
148 #include "os_support.h" 154 #include "os_support.h"
149 #define VARDECL(type, var) type *var 155 #define VARDECL(type, var) type *var
150 #define ALLOC(var, size, type) var = PUSH(global_stack, size, type) 156 #define ALLOC(var, size, type) var = PUSH(global_stack, size, type)
151 #define SAVE_STACK char *_saved_stack = global_stack; 157 #define SAVE_STACK char *_saved_stack = global_stack;
152 #define ALLOC_NONE 0 158 #define ALLOC_NONE 0
153 159
154 #endif /* VAR_ARRAYS */ 160 #endif /* VAR_ARRAYS */
(...skipping 14 matching lines...) Expand all
169 static OPUS_INLINE int _opus_false(void) {return 0;} 175 static OPUS_INLINE int _opus_false(void) {return 0;}
170 #define OPUS_CHECK_ARRAY(ptr, len) _opus_false() 176 #define OPUS_CHECK_ARRAY(ptr, len) _opus_false()
171 #define OPUS_CHECK_VALUE(value) _opus_false() 177 #define OPUS_CHECK_VALUE(value) _opus_false()
172 #define OPUS_PRINT_INT(value) do{}while(0) 178 #define OPUS_PRINT_INT(value) do{}while(0)
173 #define OPUS_FPRINTF (void) 179 #define OPUS_FPRINTF (void)
174 180
175 #endif 181 #endif
176 182
177 183
178 #endif /* STACK_ALLOC_H */ 184 #endif /* STACK_ALLOC_H */
OLDNEW
« no previous file with comments | « celt/rate.c ('k') | celt/static_modes_fixed.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698