Update of /cvsroot/pure-data/externals/grill/flext/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7429/source
Modified Files: fldsp.cpp flmap.h flmsg.cpp flout.cpp flprefix.h flqueue.cpp flsupport.cpp flxlet.cpp Log Message: fix for Codewarrior compilation update docs fixed anything/symbol message mixup (thanks to Stefano Papetti) fixed typos, dates, contact info added gcc branch hinting
Index: flqueue.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flqueue.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** flqueue.cpp 24 May 2006 12:20:57 -0000 1.39 --- flqueue.cpp 27 Oct 2006 13:34:56 -0000 1.40 *************** *** 209,213 **** { if(th) { ! if(out < 0) // message to self th->CbMethodHandler(-1-out,sym,argc,argc > STATSIZE?argv:argl); --- 209,213 ---- { if(th) { ! if(UNLIKELY(out < 0)) // message to self th->CbMethodHandler(-1-out,sym,argc,argc > STATSIZE?argv:argl); *************** *** 239,243 **** sym = s; argc = cnt; ! if(cnt > STATSIZE) { argv = new t_atom[cnt]; flext::CopyAtoms(cnt,argv,lst); --- 239,243 ---- sym = s; argc = cnt; ! if(UNLIKELY(cnt > STATSIZE)) { argv = new t_atom[cnt]; flext::CopyAtoms(cnt,argv,lst); *************** *** 252,256 **** { Msg *m = &msg; ! if(m->Ok()) { for(; m->nxt; m = m->nxt) {} m = m->nxt = new Msg; --- 252,256 ---- { Msg *m = &msg; ! if(LIKELY(m->Ok())) { for(; m->nxt; m = m->nxt) {} m = m->nxt = new Msg; *************** *** 263,267 **** inline void Queue::Push(MsgBundle *m) { ! if(m) { Put(m); Trigger(); --- 263,267 ---- inline void Queue::Push(MsgBundle *m) { ! if(LIKELY(m)) { Put(m); Trigger(); *************** *** 532,536 **** { void *cl = recv->s_thing; ! if(!cl) return false;
#if FLEXT_SYS == FLEXT_SYS_PD --- 532,536 ---- { void *cl = recv->s_thing; ! if(UNLIKELY(!cl)) return false;
#if FLEXT_SYS == FLEXT_SYS_PD
Index: flout.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flout.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** flout.cpp 15 May 2006 23:03:52 -0000 1.27 --- flout.cpp 27 Oct 2006 13:34:56 -0000 1.28 *************** *** 21,25 **** { outlet *o = GetOut(n); ! if(o) { CRITON(); if(IsSymbol(at)) --- 21,25 ---- { outlet *o = GetOut(n); ! if(LIKELY(o)) { CRITON(); if(IsSymbol(at)) *************** *** 46,55 **** #if defined(FLEXT_THREADS) #if FLEXT_QMODE == 2 ! #define CHKTHR() ((IsSystemThread() || IsThread(flext::thrmsgid)) && !InDSP()) #else ! #define CHKTHR() (IsSystemThread() && !InDSP()) #endif #else ! #define CHKTHR() (!InDSP()) #endif
--- 46,55 ---- #if defined(FLEXT_THREADS) #if FLEXT_QMODE == 2 ! #define CHKTHR() (LIKELY((IsSystemThread() || IsThread(flext::thrmsgid)) && !InDSP())) #else ! #define CHKTHR() (LIKELY(IsSystemThread() && !InDSP())) #endif #else ! #define CHKTHR() (LIKELY(!InDSP())) #endif
Index: flmap.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flmap.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** flmap.h 11 Oct 2005 10:09:23 -0000 1.23 --- flmap.h 27 Oct 2006 13:34:56 -0000 1.24 *************** *** 59,63 **** { void *r; ! if(n) r = _set(tsize,k,t); else { --- 59,63 ---- { void *r; ! if(LIKELY(n)) r = _set(tsize,k,t); else { *************** *** 69,77 **** }
! void *find(int tsize,size_t k) const { return n?_find(tsize,k):0; }
void *remove(int tsize,size_t k) { ! void *r = n?_remove(tsize,k):0; // check(tsize); return r; --- 69,77 ---- }
! void *find(int tsize,size_t k) const { return LIKELY(n)?_find(tsize,k):0; }
void *remove(int tsize,size_t k) { ! void *r = LIKELY(n)?_remove(tsize,k):0; // check(tsize); return r; *************** *** 214,218 **** { void *d = TableAnyMap::remove(N,*(size_t *)&k); ! if(d) --count; return (T)d; } --- 214,218 ---- { void *d = TableAnyMap::remove(N,*(size_t *)&k); ! if(LIKELY(d)) --count; return (T)d; }
Index: flmsg.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flmsg.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** flmsg.cpp 15 May 2006 23:03:52 -0000 1.20 --- flmsg.cpp 27 Oct 2006 13:34:56 -0000 1.21 *************** *** 128,132 ****
// search for exactly matching tag ! if(methhead && (lst = methhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true; if((lst = clmethhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
--- 128,132 ----
// search for exactly matching tag ! if(UNLIKELY(methhead) && (lst = methhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true; if((lst = clmethhead->FindList(s,inlet)) != NULL && TryMethTag(lst,s,argc,argv)) return true;
*************** *** 143,147 **** ItemCont *clmethhead = ClMeths(thisClassId());
! if(methhead && (lst = methhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true; if((lst = clmethhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
--- 143,147 ---- ItemCont *clmethhead = ClMeths(thisClassId());
! if(UNLIKELY(methhead) && (lst = methhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true; if((lst = clmethhead->FindList(sym_anything,inlet)) != NULL && TryMethAny(lst,s,argc,argv)) return true;
Index: flxlet.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flxlet.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** flxlet.cpp 19 Nov 2005 23:10:54 -0000 1.10 --- flxlet.cpp 27 Oct 2006 13:34:56 -0000 1.11 *************** *** 39,43 **** void flext_base::AddInlet(xlettype tp,int mult,const char *desc) { ! if(incnt+mult >= MAXLETS) post("%s - too many inlets",thisName()); else --- 39,43 ---- void flext_base::AddInlet(xlettype tp,int mult,const char *desc) { ! if(UNLIKELY(incnt+mult >= MAXLETS)) post("%s - too many inlets",thisName()); else *************** *** 51,55 **** void flext_base::AddOutlet(xlettype tp,int mult,const char *desc) { ! if(outcnt+mult >= MAXLETS) post("%s - too many outlets",thisName()); else --- 51,55 ---- void flext_base::AddOutlet(xlettype tp,int mult,const char *desc) { ! if(UNLIKELY(outcnt+mult >= MAXLETS)) post("%s - too many outlets",thisName()); else *************** *** 63,67 **** void flext_base::DescInlet(int ix,const char *d) { ! if(ix >= incnt) post("%s - inlet %i not found",thisName(),ix); else --- 63,67 ---- void flext_base::DescInlet(int ix,const char *d) { ! if(UNLIKELY(ix >= incnt)) post("%s - inlet %i not found",thisName(),ix); else *************** *** 71,75 **** void flext_base::DescOutlet(int ix,const char *d) { ! if(ix >= outcnt) post("%s - outlet %i not found",thisName(),ix); else --- 71,75 ---- void flext_base::DescOutlet(int ix,const char *d) { ! if(UNLIKELY(ix >= incnt)) post("%s - outlet %i not found",thisName(),ix); else
Index: flprefix.h =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flprefix.h,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** flprefix.h 7 Oct 2005 12:58:48 -0000 1.36 --- flprefix.h 27 Oct 2006 13:34:56 -0000 1.37 *************** *** 413,416 **** --- 413,425 ---- #endif
+ // branching hints + #ifdef __GNUC__ + #define LIKELY(expression) (__builtin_expect(!!(expression), 1)) + #define UNLIKELY(expression) (__builtin_expect(!!(expression), 0)) + #else + #define LIKELY(expression) (expression) + #define UNLIKELY(expression) (expression) + #endif +
#endif // __FLEXT_PREFIX_H
Index: fldsp.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/fldsp.cpp,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** fldsp.cpp 15 May 2006 23:03:52 -0000 1.31 --- fldsp.cpp 27 Oct 2006 13:34:56 -0000 1.32 *************** *** 50,54 **** if(!obj->thisHdr()->z_disabled) #else ! if(obj->dspon) #endif { --- 50,54 ---- if(!obj->thisHdr()->z_disabled) #else ! if(LIKELY(obj->dspon)) #endif {
Index: flsupport.cpp =================================================================== RCS file: /cvsroot/pure-data/externals/grill/flext/source/flsupport.cpp,v retrieving revision 1.57 retrieving revision 1.58 diff -C2 -d -r1.57 -r1.58 *** flsupport.cpp 15 Dec 2005 23:04:06 -0000 1.57 --- flsupport.cpp 27 Oct 2006 13:34:56 -0000 1.58 *************** *** 120,124 **** #endif char *blk; ! if(bytes >= LARGEALLOC) { #if FLEXT_SYS == FLEXT_SYS_MAX && defined(_SYSMEM_H_) blk = (char *)::sysmem_newptr(bytes); --- 120,124 ---- #endif char *blk; ! if(UNLIKELY(bytes >= LARGEALLOC)) { #if FLEXT_SYS == FLEXT_SYS_MAX && defined(_SYSMEM_H_) blk = (char *)::sysmem_newptr(bytes); *************** *** 164,168 **** size_t bytes = *(size_t *)ori;
! if(bytes >= LARGEALLOC) { #if FLEXT_SYS == FLEXT_SYS_MAX && defined(_SYSMEM_H_) ::sysmem_freeptr(ori); --- 164,168 ---- size_t bytes = *(size_t *)ori;
! if(UNLIKELY(bytes >= LARGEALLOC)) { #if FLEXT_SYS == FLEXT_SYS_MAX && defined(_SYSMEM_H_) ::sysmem_freeptr(ori); *************** *** 206,210 ****
char *blk; ! if(bytes >= LARGEALLOC) { #if FLEXT_SYS == FLEXT_SYS_MAX && defined(_SYSMEM_H_) blk = (char *)::sysmem_newptr(bytes); --- 206,210 ----
char *blk; ! if(UNLIKELY(bytes >= LARGEALLOC)) { #if FLEXT_SYS == FLEXT_SYS_MAX && defined(_SYSMEM_H_) blk = (char *)::sysmem_newptr(bytes); *************** *** 240,244 **** size_t bytes = *(size_t *)((char *)blk-sizeof(size_t));
! if(bytes >= LARGEALLOC) { #if FLEXT_SYS == FLEXT_SYS_MAX && defined(_SYSMEM_H_) ::sysmem_freeptr(ori); --- 240,244 ---- size_t bytes = *(size_t *)((char *)blk-sizeof(size_t));
! if(UNLIKELY(bytes >= LARGEALLOC)) { #if FLEXT_SYS == FLEXT_SYS_MAX && defined(_SYSMEM_H_) ::sysmem_freeptr(ori);