Revision: 130 http://trac.macosforge.org/projects/libdispatch/changeset/130 Author: robert@fledge.watson.org Date: 2009-11-04 12:31:55 -0800 (Wed, 04 Nov 2009) Log Message: ----------- Remove duplicated header content that resulted from a misapplied patch, clean up header guards. Modified Paths: -------------- trunk/src/shims/perfmon.h trunk/src/shims/time.c trunk/src/shims/time.h trunk/src/shims/tsd.h Modified: trunk/src/shims/perfmon.h =================================================================== --- trunk/src/shims/perfmon.h 2009-11-04 19:28:06 UTC (rev 129) +++ trunk/src/shims/perfmon.h 2009-11-04 20:31:55 UTC (rev 130) @@ -87,94 +87,4 @@ #define _dispatch_workitem_dec() #endif // DISPATCH_PERF_MON -#endif -/* - * Copyright (c) 2008-2009 Apple Inc. All rights reserved. - * - * @APPLE_APACHE_LICENSE_HEADER_START@ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @APPLE_APACHE_LICENSE_HEADER_END@ - */ - -/* - * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch - * which are subject to change in future releases of Mac OS X. Any applications - * relying on these interfaces WILL break. - */ - -#ifndef __DISPATCH_SHIMS_PERFMON__ -#define __DISPATCH_SHIMS_PERFMON__ - -#if DISPATCH_PERF_MON - -#if defined (USE_APPLE_TSD_OPTIMIZATIONS) && defined(SIMULATE_5491082) && (defined(__i386__) || defined(__x86_64__)) -#ifdef __LP64__ -#define _dispatch_workitem_inc() asm("incq %%gs:%0" : "+m" \ - (*(void **)(dispatch_bcounter_key * sizeof(void *) + _PTHREAD_TSD_OFFSET)) :: "cc") -#define _dispatch_workitem_dec() asm("decq %%gs:%0" : "+m" \ - (*(void **)(dispatch_bcounter_key * sizeof(void *) + _PTHREAD_TSD_OFFSET)) :: "cc") -#else -#define _dispatch_workitem_inc() asm("incl %%gs:%0" : "+m" \ - (*(void **)(dispatch_bcounter_key * sizeof(void *) + _PTHREAD_TSD_OFFSET)) :: "cc") -#define _dispatch_workitem_dec() asm("decl %%gs:%0" : "+m" \ - (*(void **)(dispatch_bcounter_key * sizeof(void *) + _PTHREAD_TSD_OFFSET)) :: "cc") -#endif -#else /* !USE_APPLE_TSD_OPTIMIZATIONS */ -static inline void -_dispatch_workitem_inc(void) -{ - unsigned long cnt = (unsigned long)_dispatch_thread_getspecific(dispatch_bcounter_key); - _dispatch_thread_setspecific(dispatch_bcounter_key, (void *)++cnt); -} -static inline void -_dispatch_workitem_dec(void) -{ - unsigned long cnt = (unsigned long)_dispatch_thread_getspecific(dispatch_bcounter_key); - _dispatch_thread_setspecific(dispatch_bcounter_key, (void *)--cnt); -} -#endif /* USE_APPLE_TSD_OPTIMIZATIONS */ - -// C99 doesn't define flsll() or ffsll() -#ifdef __LP64__ -#define flsll(x) flsl(x) -#else -static inline unsigned int -flsll(uint64_t val) -{ - union { - struct { -#ifdef __BIG_ENDIAN__ - unsigned int hi, low; -#else - unsigned int low, hi; -#endif - } words; - uint64_t word; - } _bucket = { - .word = val, - }; - if (_bucket.words.hi) { - return fls(_bucket.words.hi) + 32; - } - return fls(_bucket.words.low); -} -#endif - -#else -#define _dispatch_workitem_inc() -#define _dispatch_workitem_dec() -#endif // DISPATCH_PERF_MON - -#endif +#endif /* __DISPATCH_SHIMS_PERFMON__ */ Modified: trunk/src/shims/time.c =================================================================== --- trunk/src/shims/time.c 2009-11-04 19:28:06 UTC (rev 129) +++ trunk/src/shims/time.c 2009-11-04 20:31:55 UTC (rev 130) @@ -65,4 +65,3 @@ return tmp; } #endif - Modified: trunk/src/shims/time.h =================================================================== --- trunk/src/shims/time.h 2009-11-04 19:28:06 UTC (rev 129) +++ trunk/src/shims/time.h 2009-11-04 20:31:55 UTC (rev 130) @@ -59,57 +59,4 @@ #endif } -#endif -/* - * Copyright (c) 2008-2009 Apple Inc. All rights reserved. - * - * @APPLE_APACHE_LICENSE_HEADER_START@ - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @APPLE_APACHE_LICENSE_HEADER_END@ - */ - -/* - * IMPORTANT: This header file describes INTERNAL interfaces to libdispatch - * which are subject to change in future releases of Mac OS X. Any applications - * relying on these interfaces WILL break. - */ - -#ifndef __DISPATCH_SHIMS_TIME__ -#define __DISPATCH_SHIMS_TIME__ - -static inline uint64_t -_dispatch_absolute_time(void) -{ -#ifndef HAVE_MACH_ABSOLUTE_TIME - struct timespec ts; - int ret; - -#if HAVE_DECL_CLOCK_UPTIME - ret = clock_gettime(CLOCK_UPTIME, &ts); -#elif HAVE_DECL_CLOCK_MONOTONIC - ret = clock_gettime(CLOCK_MONOTONIC, &ts); -#else -#error "clock_gettime: no supported absolute time clock" -#endif - dispatch_assume_zero(ret); - - /* XXXRW: Some kind of overflow detection needed? */ - return (ts.tv_sec * NSEC_PER_SEC + ts.tv_nsec); -#else - return mach_absolute_time(); -#endif -} - -#endif +#endif /* __DISPATCH_SHIMS_TIME__ */ Modified: trunk/src/shims/tsd.h =================================================================== --- trunk/src/shims/tsd.h 2009-11-04 19:28:06 UTC (rev 129) +++ trunk/src/shims/tsd.h 2009-11-04 20:31:55 UTC (rev 130) @@ -117,4 +117,4 @@ #define _dispatch_thread_self pthread_self -#endif +#endif /* __DISPATCH_SHIMS_TSD__ */