From owner-p4-projects@FreeBSD.ORG Tue Mar 23 23:21:56 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 94CB316A4D0; Tue, 23 Mar 2004 23:21:56 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 682C516A4CE for ; Tue, 23 Mar 2004 23:21:56 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6070C43D49 for ; Tue, 23 Mar 2004 23:21:56 -0800 (PST) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.10/8.12.10) with ESMTP id i2O7LuGe073307 for ; Tue, 23 Mar 2004 23:21:56 -0800 (PST) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.10/8.12.10/Submit) id i2O7Lu8B073298 for perforce@freebsd.org; Tue, 23 Mar 2004 23:21:56 -0800 (PST) (envelope-from marcel@freebsd.org) Date: Tue, 23 Mar 2004 23:21:56 -0800 (PST) Message-Id: <200403240721.i2O7Lu8B073298@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Subject: PERFORCE change 49613 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Mar 2004 07:21:57 -0000 http://perforce.freebsd.org/chv.cgi?CH=49613 Change 49613 by marcel@marcel_nfs on 2004/03/23 23:21:00 Implement run-length encoding. For platforms with a large amount of register data (like ia64), this can be a major booster. On ia64 it will be, because the high FP registers (96 registers, each 16 bytes) are most of the time zeroes. Instead of pumping 3072 characters over the link, we can compress that to 96 characters in case they are all zero. Affected files ... .. //depot/projects/gdb/sys/gdb/gdb_packet.c#5 edit Differences ... ==== //depot/projects/gdb/sys/gdb/gdb_packet.c#5 (text+ko) ==== @@ -158,6 +158,7 @@ gdb_tx_end(void) { const char *p; + int runlen; unsigned char c, cksum; do { @@ -166,8 +167,51 @@ cksum = 0; p = gdb_txbuf; while (p < gdb_txp) { - gdb_cur->gdb_putc(*p); - cksum += *p++; + /* Send a character and start run-length encoding. */ + c = *p++; + gdb_cur->gdb_putc(c); + cksum += c; + runlen = 0; + /* Determine run-length and update checksum. */ + while (p < gdb_txp && *p == c) { + runlen++; + p++; + } + /* Emit the run-length encoded string. */ + while (runlen >= 97) { + gdb_cur->gdb_putc('*'); + cksum += '*'; + gdb_cur->gdb_putc(97+29); + cksum += 97+29; + runlen -= 97; + if (runlen > 0) { + gdb_cur->gdb_putc(c); + cksum += c; + runlen--; + } + } + if (runlen == 1) { + gdb_cur->gdb_putc(c); + cksum += c; + runlen--; + } + if (runlen == 0) + continue; + /* Don't emit '$', '#', '+' or '-'. */ + if (runlen == 7) { + gdb_cur->gdb_putc(c); + cksum += c; + runlen--; + } + if (runlen == 6 || runlen == 14 || runlen == 16) { + gdb_cur->gdb_putc(c); + cksum += c; + runlen--; + } + gdb_cur->gdb_putc('*'); + cksum += '*'; + gdb_cur->gdb_putc(runlen+29); + cksum += runlen+29; } gdb_cur->gdb_putc('#');