Update of /cvsroot/pure-data/externals/pdp/system/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2628/system/kernel
Modified Files: pdp_list.c pdp_mem.c pdp_packet.c pdp_post.c pdp_type.c Log Message: pdp current darcs merge
Index: pdp_list.c =================================================================== RCS file: /cvsroot/pure-data/externals/pdp/system/kernel/pdp_list.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pdp_list.c 16 Dec 2005 01:05:39 -0000 1.3 --- pdp_list.c 1 Sep 2006 13:45:31 -0000 1.4 *************** *** 761,768 ****
/* return element at index */ ! t_pdp_word pdp_list_index(t_pdp_list *l, int index) { t_pdp_atom *a; ! for (a = l->first; index--; a = a->next); return a->w; } --- 761,768 ----
/* return element at index */ ! t_pdp_word pdp_list_index(t_pdp_list *l, int indx) { t_pdp_atom *a; ! for (a = l->first; indx--; a = a->next); return a->w; }
Index: pdp_mem.c =================================================================== RCS file: /cvsroot/pure-data/externals/pdp/system/kernel/pdp_mem.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pdp_mem.c 16 Dec 2005 01:05:39 -0000 1.3 --- pdp_mem.c 1 Sep 2006 13:45:31 -0000 1.4 *************** *** 20,26 **** --- 20,31 ----
#include <stdlib.h> + #include <stdio.h> #include "pdp_mem.h" #include "pdp_debug.h"
+ // defined here so we don't need to rebuild when changing it (deps for headers are broken) + #define PDP_FASTALLOC_BLOCK_ELEMENTS 4096 + //#define PDP_FASTALLOC_BLOCK_ELEMENTS 1 + #define D if (0)
/* malloc wrapper that calls garbage collector */ *************** *** 31,34 **** --- 36,41 ---- PDP_ASSERT(ptr);
+ D fprintf(stderr, "alloc %p %d\n", ptr, size); + return ptr;
*************** *** 42,45 **** --- 49,53 ---- void pdp_dealloc(void *stuff) { + D fprintf(stderr, "dealloc %p\n", stuff); free (stuff); } *************** *** 88,91 **** --- 96,103 ---- }
+ #define USE_FASTALLOC 1 + + #if USE_FASTALLOC + void *pdp_fastalloc_new_atom(t_pdp_fastalloc *x) { *************** *** 128,129 **** --- 140,148 ---- }
+ #else + + void *pdp_fastalloc_new_atom(t_pdp_fastalloc *x) {return pdp_alloc(12);} + void pdp_fastalloc_save_atom(t_pdp_fastalloc *x, void *atom) {pdp_dealloc(atom);} + t_pdp_fastalloc *pdp_fastalloc_new(unsigned int size) {return 0;} + + #endif
Index: pdp_type.c =================================================================== RCS file: /cvsroot/pure-data/externals/pdp/system/kernel/pdp_type.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pdp_type.c 16 Dec 2005 01:05:39 -0000 1.3 --- pdp_type.c 1 Sep 2006 13:45:31 -0000 1.4 *************** *** 343,347 **** } if (program_last == program_tail){ ! pdp_post("ERROR: pdp_packet_convert: conversion loop detected"); } program_last = program_tail; --- 343,347 ---- } if (program_last == program_tail){ ! //pdp_post("ERROR: pdp_packet_convert: conversion loop detected"); } program_last = program_tail;
Index: pdp_packet.c =================================================================== RCS file: /cvsroot/pure-data/externals/pdp/system/kernel/pdp_packet.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pdp_packet.c 16 Dec 2005 01:05:39 -0000 1.3 --- pdp_packet.c 1 Sep 2006 13:45:31 -0000 1.4 *************** *** 33,36 **** --- 33,38 ----
+ #define D if(0) + /* packet implementation. contains class and packet (instance) handling
*************** *** 153,156 **** --- 155,159 ---- /* call class constructor */ while(a){ + D pdp_post("new: %s", type->s_name); c = (t_pdp_class *)(a->w.w_pointer); if (c->type && pdp_type_description_match(type, c->type)){ *************** *** 288,291 **** --- 291,303 ---- */
+ /* NEW DOES NOT USE THE REUSE FIFO !!!! + this is a true and genuine mess: + the reuse fifo can grow indefinitely with garbage elements if it's never used, + while it points to stale packets.. backdoor access = BAD. + + if i recall, this is mainly a compatibility issue.. + + */ + int pdp_packet_new(unsigned int datatype, unsigned int datasize) *************** *** 328,331 **** --- 340,346 ---- _pdp_packet_save_nolock(int packet) { + + + t_pdp *header = pdp_packet_header(packet); t_pdp_symbol *s; *************** *** 335,339 **** --- 350,377 ---- s = header->desc; if (!s->s_reusefifo) s->s_reusefifo = pdp_list_new(0); + + + /* big o hack: since pdp_packet_new can reap packets behind our back, + we won't add a packet if it's already in here */ + + if (1) { + t_pdp_atom *a = s->s_reusefifo->first; + while (a){ + if (a->w.w_packet == packet) goto found; + a = a->next; + } + } + pdp_list_add(s->s_reusefifo, a_packet, (t_pdp_word)packet); + + found: + + + + if (PDP_DEBUG){ + int el = s->s_reusefifo->elements; + int maxel = 100; + if (el > maxel) pdp_post("WARNING: %s reuse fifo has %d elements.", s->s_name, el); + } }
Index: pdp_post.c =================================================================== RCS file: /cvsroot/pure-data/externals/pdp/system/kernel/pdp_post.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pdp_post.c 16 Dec 2005 01:05:39 -0000 1.3 --- pdp_post.c 1 Sep 2006 13:45:31 -0000 1.4 *************** *** 30,34 ****
/* write a message to log (console) */ ! void pdp_post_n(char *fmt, ...) { va_list ap; --- 30,34 ----
/* write a message to log (console) */ ! void _pdp_post_n(char *fmt, ...) { va_list ap; *************** *** 37,41 **** va_end(ap); } ! void pdp_post(char *fmt, ...) { va_list ap; --- 37,41 ---- va_end(ap); } ! void _pdp_post(char *fmt, ...) { va_list ap;