components/zlib/patches/perf.patch
changeset 1945 3dc1935a2189
parent 825 78809aba88fe
child 7718 9960a50bc6cf
equal deleted inserted replaced
1944:56ac2df1785b 1945:3dc1935a2189
     1 --- zlib-1.2.3/zlib.h.orig   Sun Jul 17 19:26:49 2005
     1 Patch origin: in-house
     2 +++ zlib-1.2.3/zlib.h        Tue May 22 10:17:54 2012
     2 Patch status: inffast.c part: submitted back to community without feedback
       
     3 Patch status: deflate.c part: Solaris-specific; not suitable for upstream
       
     4 
       
     5 --- zlib-1.2.8/zlib.h	2013-04-28 17:23:49.000000000 -0700
       
     6 +++ zlib-1.2.8/zlib.h	2014-04-18 05:32:31.316290241 -0700
     3 @@ -37,8 +37,8 @@
     7 @@ -37,8 +37,8 @@
     4  extern "C" {
     8  extern "C" {
     5  #endif
     9  #endif
     6  
    10  
     7 -#define ZLIB_VERSION "1.2.3"
    11 -#define ZLIB_VERSION "1.2.8"
     8 -#define ZLIB_VERNUM 0x1230
    12 -#define ZLIB_VERNUM 0x1280
     9 +#define ZLIB_VERSION "1.2.3-T4mods"
    13 +#define ZLIB_VERSION "1.2.8-T4mods"
    10 +#define ZLIB_VERNUM 0x123f
    14 +#define ZLIB_VERNUM 0x128f
    11  
    15  #define ZLIB_VER_MAJOR 1
    12  /*
    16  #define ZLIB_VER_MINOR 2
    13       The 'zlib' compression library provides in-memory compression and
    17  #define ZLIB_VER_REVISION 8
    14 --- zlib-1.2.3/Makefile.in.orig	Mon May 14 14:29:35 2012
    18 --- zlib-1.2.8/inffast.c	2013-03-24 22:47:59.000000000 -0700
    15 +++ zlib-1.2.3/Makefile.in	Mon May 14 14:30:29 2012
    19 +++ zlib-1.2.8/inffast.c	2014-02-28 01:57:57.075708259 -0800
    16 @@ -77,8 +77,8 @@
       
    17  	mv _match.o match.o
       
    18  	rm -f _match.s
       
    19  
       
    20 -$(SHAREDLIBV): $(OBJS)
       
    21 -	$(LDSHARED) -o $@ $(OBJS)
       
    22 +$(SHAREDLIBV): $(OBJS) $(PIC_OBJS)
       
    23 +	$(LDSHARED) -o $@ $(OBJS) $(PIC_OBJS)
       
    24  	rm -f $(SHAREDLIB) $(SHAREDLIBM)
       
    25  	ln -s $@ $(SHAREDLIB)
       
    26  	ln -s $@ $(SHAREDLIBM)
       
    27 
       
    28 --- zlib-1.2.3/inffast.c.orig	Fri Nov 12 22:05:29 2004
       
    29 +++ zlib-1.2.3/inffast.c	Tue Mar 27 08:05:36 2012
       
    30 @@ -87,7 +87,7 @@
    20 @@ -87,7 +87,7 @@
    31      code const FAR *dcode;      /* local strm->distcode */
    21      code const FAR *dcode;      /* local strm->distcode */
    32      unsigned lmask;             /* mask for first level of length codes */
    22      unsigned lmask;             /* mask for first level of length codes */
    33      unsigned dmask;             /* mask for first level of distance codes */
    23      unsigned dmask;             /* mask for first level of distance codes */
    34 -    code this;                  /* retrieved table entry */
    24 -    code here;                  /* retrieved table entry */
    35 +    code *this;                 /* retrieved table entry */
    25 +    code *here;                 /* retrieved table entry */
    36      unsigned op;                /* code bits, operation, extra bits, or */
    26      unsigned op;                /* code bits, operation, extra bits, or */
    37                                  /*  window position, window bytes to copy */
    27                                  /*  window position, window bytes to copy */
    38      unsigned len;               /* match length, unused bytes */
    28      unsigned len;               /* match length, unused bytes */
    39 @@ -124,20 +124,20 @@
    29 @@ -124,20 +124,20 @@
    40              hold += (unsigned long)(PUP(in)) << bits;
    30              hold += (unsigned long)(PUP(in)) << bits;
    41              bits += 8;
    31              bits += 8;
    42          }
    32          }
    43 -        this = lcode[hold & lmask];
    33 -        here = lcode[hold & lmask];
    44 +        this = (code *)(&(lcode[hold & lmask]));
    34 +        here = (code *)(&(lcode[hold & lmask]));
    45        dolen:
    35        dolen:
    46 -        op = (unsigned)(this.bits);
    36 -        op = (unsigned)(here.bits);
    47 +        op = (unsigned)(this->bits);
    37 +        op = (unsigned)(here->bits);
    48          hold >>= op;
    38          hold >>= op;
    49          bits -= op;
    39          bits -= op;
    50 -        op = (unsigned)(this.op);
    40 -        op = (unsigned)(here.op);
    51 +        op = (unsigned)(this->op);
    41 +        op = (unsigned)(here->op);
    52          if (op == 0) {                          /* literal */
    42          if (op == 0) {                          /* literal */
    53 -            Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
    43 -            Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
    54 +            Tracevv((stderr, this->val >= 0x20 && this->val < 0x7f ?
    44 +            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
    55                      "inflate:         literal '%c'\n" :
    45                      "inflate:         literal '%c'\n" :
    56 -                    "inflate:         literal 0x%02x\n", this.val));
    46 -                    "inflate:         literal 0x%02x\n", here.val));
    57 -            PUP(out) = (unsigned char)(this.val);
    47 -            PUP(out) = (unsigned char)(here.val);
    58 +                    "inflate:         literal 0x%02x\n", this->val));
    48 +                    "inflate:         literal 0x%02x\n", here->val));
    59 +            PUP(out) = (unsigned char)(this->val);
    49 +            PUP(out) = (unsigned char)(here->val);
    60          }
    50          }
    61          else if (op & 16) {                     /* length base */
    51          else if (op & 16) {                     /* length base */
    62 -            len = (unsigned)(this.val);
    52 -            len = (unsigned)(here.val);
    63 +            len = (unsigned)(this->val);
    53 +            len = (unsigned)(here->val);
    64              op &= 15;                           /* number of extra bits */
    54              op &= 15;                           /* number of extra bits */
    65              if (op) {
    55              if (op) {
    66                  if (bits < op) {
    56                  if (bits < op) {
    67 @@ -155,14 +155,14 @@
    57 @@ -155,14 +155,14 @@
    68                  hold += (unsigned long)(PUP(in)) << bits;
    58                  hold += (unsigned long)(PUP(in)) << bits;
    69                  bits += 8;
    59                  bits += 8;
    70              }
    60              }
    71 -            this = dcode[hold & dmask];
    61 -            here = dcode[hold & dmask];
    72 +            this = (code *)(&(dcode[hold & dmask]));
    62 +            here = (code *)(&(dcode[hold & dmask]));
    73            dodist:
    63            dodist:
    74 -            op = (unsigned)(this.bits);
    64 -            op = (unsigned)(here.bits);
    75 +            op = (unsigned)(this->bits);
    65 +            op = (unsigned)(here->bits);
    76              hold >>= op;
    66              hold >>= op;
    77              bits -= op;
    67              bits -= op;
    78 -            op = (unsigned)(this.op);
    68 -            op = (unsigned)(here.op);
    79 +            op = (unsigned)(this->op);
    69 +            op = (unsigned)(here->op);
    80              if (op & 16) {                      /* distance base */
    70              if (op & 16) {                      /* distance base */
    81 -                dist = (unsigned)(this.val);
    71 -                dist = (unsigned)(here.val);
    82 +                dist = (unsigned)(this->val);
    72 +                dist = (unsigned)(here->val);
    83                  op &= 15;                       /* number of extra bits */
    73                  op &= 15;                       /* number of extra bits */
    84                  if (bits < op) {
    74                  if (bits < op) {
    85                      hold += (unsigned long)(PUP(in)) << bits;
    75                      hold += (unsigned long)(PUP(in)) << bits;
    86 @@ -259,7 +259,8 @@
    76 @@ -281,7 +281,7 @@
    87                  }
    77                  }
    88              }
    78              }
    89              else if ((op & 64) == 0) {          /* 2nd level distance code */
    79              else if ((op & 64) == 0) {          /* 2nd level distance code */
    90 -                this = dcode[this.val + (hold & ((1U << op) - 1))];
    80 -                here = dcode[here.val + (hold & ((1U << op) - 1))];
    91 +                this = (code *)
    81 +                here = (code *)(&(dcode[here->val + (hold & ((1U << op) - 1))]));
    92 +		    (&(dcode[this->val + (hold & ((1U << op) - 1))]));
       
    93                  goto dodist;
    82                  goto dodist;
    94              }
    83              }
    95              else {
    84              else {
    96 @@ -269,7 +270,7 @@
    85 @@ -291,7 +291,7 @@
    97              }
    86              }
    98          }
    87          }
    99          else if ((op & 64) == 0) {              /* 2nd level length code */
    88          else if ((op & 64) == 0) {              /* 2nd level length code */
   100 -            this = lcode[this.val + (hold & ((1U << op) - 1))];
    89 -            here = lcode[here.val + (hold & ((1U << op) - 1))];
   101 +            this = (code *)(&(lcode[this->val + (hold & ((1U << op) - 1))]));
    90 +            here = (code *)(&(lcode[here->val + (hold & ((1U << op) - 1))]));
   102              goto dolen;
    91              goto dolen;
   103          }
    92          }
   104          else if (op & 32) {                     /* end-of-block */
    93          else if (op & 32) {                     /* end-of-block */
   105 
    94 --- zlib-1.2.8/deflate.c	2013-04-28 15:57:10.000000000 -0700
   106 --- zlib-1.2.3/deflate.c.orig   Tue Mar 27 10:02:52 2012
    95 +++ zlib-1.2.8/deflate.c	2014-02-28 02:32:02.517988885 -0800
   107 +++ zlib-1.2.3/deflate.c        Sun Jul 17 19:27:31 2005
    96 @@ -60,6 +60,7 @@
   108 @@ -88,9 +88,13 @@
    97    copyright string in the executable of your product.
       
    98   */
       
    99  
       
   100 +#ifndef LONGEST_MATCH_ONLY
       
   101  /* ===========================================================================
       
   102   *  Function prototypes.
       
   103   */
       
   104 @@ -89,13 +90,18 @@
   109        void match_init OF((void)); /* asm code initialization */
   105        void match_init OF((void)); /* asm code initialization */
   110        uInt longest_match  OF((deflate_state *s, IPos cur_match));
   106        uInt longest_match  OF((deflate_state *s, IPos cur_match));
   111  #else
   107  #else
   112 +#ifdef ORIG_LONGEST_MATCH
   108 +#ifdef ORIG_LONGEST_MATCH
   113  local uInt longest_match  OF((deflate_state *s, IPos cur_match));
   109  local uInt longest_match  OF((deflate_state *s, IPos cur_match));
   114 +#else
   110 +#else
   115 +uInt longest_match  OF((deflate_state *s, IPos cur_match));
   111 +uInt longest_match  OF((deflate_state *s, IPos cur_match));
       
   112 +#endif
       
   113  #endif
       
   114  
       
   115  #ifdef DEBUG
       
   116  local  void check_match OF((deflate_state *s, IPos start, IPos match,
       
   117                              int length));
       
   118  #endif
       
   119 +#endif /* ! LONGEST_MATCH_ONLY */
       
   120  
       
   121  /* ===========================================================================
       
   122   * Local data
       
   123 @@ -104,6 +110,7 @@
       
   124  #define NIL 0
       
   125  /* Tail of hash chains */
       
   126  
       
   127 +#ifndef LONGEST_MATCH_ONLY
       
   128  #ifndef TOO_FAR
       
   129  #  define TOO_FAR 4096
       
   130  #endif
       
   131 @@ -1130,7 +1137,9 @@
   116  #endif
   132  #endif
   117  #endif
   133  #endif
   118 +#endif
       
   119  local uInt longest_match_fast OF((deflate_state *s, IPos cur_match));
       
   120  
       
   121  #ifdef DEBUG
       
   122 @@ -1010,6 +1014,7 @@
       
   123  #endif
       
   124  }
   134  }
       
   135 +#endif /* ! LONGEST_MATCH_ONLY */
   125  
   136  
   126 +#if defined(ORIG_LONGEST_MATCH) || defined(ORIG_LONGEST_MATCH_GLOBAL)
   137 +#if defined(ORIG_LONGEST_MATCH) || defined(ORIG_LONGEST_MATCH_GLOBAL)
   127  #ifndef FASTEST
   138  #ifndef FASTEST
   128  /* ===========================================================================
   139  /* ===========================================================================
   129   * Set match_start to the longest match starting at the given string and
   140   * Set match_start to the longest match starting at the given string and
   130 @@ -1024,7 +1029,11 @@
   141 @@ -1145,7 +1154,11 @@
   131  /* For 80x86 and 680x0, an optimized version will be provided in match.asm or
   142  /* For 80x86 and 680x0, an optimized version will be provided in match.asm or
   132   * match.S. The code will be functionally equivalent.
   143   * match.S. The code will be functionally equivalent.
   133   */
   144   */
   134 +#ifdef ORIG_LONGEST_MATCH_GLOBAL
   145 +#ifdef ORIG_LONGEST_MATCH_GLOBAL
   135 +uInt longest_match(s, cur_match)
   146 +uInt longest_match(s, cur_match)
   137  local uInt longest_match(s, cur_match)
   148  local uInt longest_match(s, cur_match)
   138 +#endif
   149 +#endif
   139      deflate_state *s;
   150      deflate_state *s;
   140      IPos cur_match;                             /* current match */
   151      IPos cur_match;                             /* current match */
   141  {
   152  {
   142 @@ -1168,6 +1177,7 @@
   153 @@ -1288,6 +1301,7 @@
       
   154      return s->lookahead;
   143  }
   155  }
   144  #endif /* ASMV */
   156  #endif /* ASMV */
   145  #endif /* FASTEST */
       
   146 +#endif /* ORIG_LONGEST_MATCHT */
   157 +#endif /* ORIG_LONGEST_MATCHT */
   147  
   158  
   148  /* ---------------------------------------------------------------------------
   159  #else /* FASTEST */
   149   * Optimized version for level == 1 or strategy == Z_RLE only
   160  
       
   161 @@ -1349,6 +1363,7 @@
       
   162  
       
   163  #endif /* FASTEST */
       
   164  
       
   165 +#ifndef LONGEST_MATCH_ONLY
       
   166  #ifdef DEBUG
       
   167  /* ===========================================================================
       
   168   * Check that the match at match_start is indeed a match.
       
   169 @@ -1965,3 +1980,4 @@
       
   170          FLUSH_BLOCK(s, 0);
       
   171      return block_done;
       
   172  }
       
   173 +#endif /* ! LONGEST_MATCH_ONLY */