components/zlib/patches/perf.patch
changeset 1945 3dc1935a2189
parent 825 78809aba88fe
child 7718 9960a50bc6cf
--- a/components/zlib/patches/perf.patch	Wed Jun 11 17:13:12 2014 -0700
+++ b/components/zlib/patches/perf.patch	Wed Jun 11 23:33:02 2014 -0700
@@ -1,38 +1,28 @@
---- zlib-1.2.3/zlib.h.orig   Sun Jul 17 19:26:49 2005
-+++ zlib-1.2.3/zlib.h        Tue May 22 10:17:54 2012
+Patch origin: in-house
+Patch status: inffast.c part: submitted back to community without feedback
+Patch status: deflate.c part: Solaris-specific; not suitable for upstream
+
+--- zlib-1.2.8/zlib.h	2013-04-28 17:23:49.000000000 -0700
++++ zlib-1.2.8/zlib.h	2014-04-18 05:32:31.316290241 -0700
 @@ -37,8 +37,8 @@
  extern "C" {
  #endif
  
--#define ZLIB_VERSION "1.2.3"
--#define ZLIB_VERNUM 0x1230
-+#define ZLIB_VERSION "1.2.3-T4mods"
-+#define ZLIB_VERNUM 0x123f
- 
- /*
-      The 'zlib' compression library provides in-memory compression and
---- zlib-1.2.3/Makefile.in.orig	Mon May 14 14:29:35 2012
-+++ zlib-1.2.3/Makefile.in	Mon May 14 14:30:29 2012
-@@ -77,8 +77,8 @@
- 	mv _match.o match.o
- 	rm -f _match.s
- 
--$(SHAREDLIBV): $(OBJS)
--	$(LDSHARED) -o $@ $(OBJS)
-+$(SHAREDLIBV): $(OBJS) $(PIC_OBJS)
-+	$(LDSHARED) -o $@ $(OBJS) $(PIC_OBJS)
- 	rm -f $(SHAREDLIB) $(SHAREDLIBM)
- 	ln -s $@ $(SHAREDLIB)
- 	ln -s $@ $(SHAREDLIBM)
-
---- zlib-1.2.3/inffast.c.orig	Fri Nov 12 22:05:29 2004
-+++ zlib-1.2.3/inffast.c	Tue Mar 27 08:05:36 2012
+-#define ZLIB_VERSION "1.2.8"
+-#define ZLIB_VERNUM 0x1280
++#define ZLIB_VERSION "1.2.8-T4mods"
++#define ZLIB_VERNUM 0x128f
+ #define ZLIB_VER_MAJOR 1
+ #define ZLIB_VER_MINOR 2
+ #define ZLIB_VER_REVISION 8
+--- zlib-1.2.8/inffast.c	2013-03-24 22:47:59.000000000 -0700
++++ zlib-1.2.8/inffast.c	2014-02-28 01:57:57.075708259 -0800
 @@ -87,7 +87,7 @@
      code const FAR *dcode;      /* local strm->distcode */
      unsigned lmask;             /* mask for first level of length codes */
      unsigned dmask;             /* mask for first level of distance codes */
--    code this;                  /* retrieved table entry */
-+    code *this;                 /* retrieved table entry */
+-    code here;                  /* retrieved table entry */
++    code *here;                 /* retrieved table entry */
      unsigned op;                /* code bits, operation, extra bits, or */
                                  /*  window position, window bytes to copy */
      unsigned len;               /* match length, unused bytes */
@@ -40,27 +30,27 @@
              hold += (unsigned long)(PUP(in)) << bits;
              bits += 8;
          }
--        this = lcode[hold & lmask];
-+        this = (code *)(&(lcode[hold & lmask]));
+-        here = lcode[hold & lmask];
++        here = (code *)(&(lcode[hold & lmask]));
        dolen:
--        op = (unsigned)(this.bits);
-+        op = (unsigned)(this->bits);
+-        op = (unsigned)(here.bits);
++        op = (unsigned)(here->bits);
          hold >>= op;
          bits -= op;
--        op = (unsigned)(this.op);
-+        op = (unsigned)(this->op);
+-        op = (unsigned)(here.op);
++        op = (unsigned)(here->op);
          if (op == 0) {                          /* literal */
--            Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
-+            Tracevv((stderr, this->val >= 0x20 && this->val < 0x7f ?
+-            Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
++            Tracevv((stderr, here->val >= 0x20 && here->val < 0x7f ?
                      "inflate:         literal '%c'\n" :
--                    "inflate:         literal 0x%02x\n", this.val));
--            PUP(out) = (unsigned char)(this.val);
-+                    "inflate:         literal 0x%02x\n", this->val));
-+            PUP(out) = (unsigned char)(this->val);
+-                    "inflate:         literal 0x%02x\n", here.val));
+-            PUP(out) = (unsigned char)(here.val);
++                    "inflate:         literal 0x%02x\n", here->val));
++            PUP(out) = (unsigned char)(here->val);
          }
          else if (op & 16) {                     /* length base */
--            len = (unsigned)(this.val);
-+            len = (unsigned)(this->val);
+-            len = (unsigned)(here.val);
++            len = (unsigned)(here->val);
              op &= 15;                           /* number of extra bits */
              if (op) {
                  if (bits < op) {
@@ -68,44 +58,50 @@
                  hold += (unsigned long)(PUP(in)) << bits;
                  bits += 8;
              }
--            this = dcode[hold & dmask];
-+            this = (code *)(&(dcode[hold & dmask]));
+-            here = dcode[hold & dmask];
++            here = (code *)(&(dcode[hold & dmask]));
            dodist:
--            op = (unsigned)(this.bits);
-+            op = (unsigned)(this->bits);
+-            op = (unsigned)(here.bits);
++            op = (unsigned)(here->bits);
              hold >>= op;
              bits -= op;
--            op = (unsigned)(this.op);
-+            op = (unsigned)(this->op);
+-            op = (unsigned)(here.op);
++            op = (unsigned)(here->op);
              if (op & 16) {                      /* distance base */
--                dist = (unsigned)(this.val);
-+                dist = (unsigned)(this->val);
+-                dist = (unsigned)(here.val);
++                dist = (unsigned)(here->val);
                  op &= 15;                       /* number of extra bits */
                  if (bits < op) {
                      hold += (unsigned long)(PUP(in)) << bits;
-@@ -259,7 +259,8 @@
+@@ -281,7 +281,7 @@
                  }
              }
              else if ((op & 64) == 0) {          /* 2nd level distance code */
--                this = dcode[this.val + (hold & ((1U << op) - 1))];
-+                this = (code *)
-+		    (&(dcode[this->val + (hold & ((1U << op) - 1))]));
+-                here = dcode[here.val + (hold & ((1U << op) - 1))];
++                here = (code *)(&(dcode[here->val + (hold & ((1U << op) - 1))]));
                  goto dodist;
              }
              else {
-@@ -269,7 +270,7 @@
+@@ -291,7 +291,7 @@
              }
          }
          else if ((op & 64) == 0) {              /* 2nd level length code */
--            this = lcode[this.val + (hold & ((1U << op) - 1))];
-+            this = (code *)(&(lcode[this->val + (hold & ((1U << op) - 1))]));
+-            here = lcode[here.val + (hold & ((1U << op) - 1))];
++            here = (code *)(&(lcode[here->val + (hold & ((1U << op) - 1))]));
              goto dolen;
          }
          else if (op & 32) {                     /* end-of-block */
-
---- zlib-1.2.3/deflate.c.orig   Tue Mar 27 10:02:52 2012
-+++ zlib-1.2.3/deflate.c        Sun Jul 17 19:27:31 2005
-@@ -88,9 +88,13 @@
+--- zlib-1.2.8/deflate.c	2013-04-28 15:57:10.000000000 -0700
++++ zlib-1.2.8/deflate.c	2014-02-28 02:32:02.517988885 -0800
+@@ -60,6 +60,7 @@
+   copyright string in the executable of your product.
+  */
+ 
++#ifndef LONGEST_MATCH_ONLY
+ /* ===========================================================================
+  *  Function prototypes.
+  */
+@@ -89,13 +90,18 @@
        void match_init OF((void)); /* asm code initialization */
        uInt longest_match  OF((deflate_state *s, IPos cur_match));
  #else
@@ -113,21 +109,36 @@
  local uInt longest_match  OF((deflate_state *s, IPos cur_match));
 +#else
 +uInt longest_match  OF((deflate_state *s, IPos cur_match));
++#endif
+ #endif
+ 
+ #ifdef DEBUG
+ local  void check_match OF((deflate_state *s, IPos start, IPos match,
+                             int length));
+ #endif
++#endif /* ! LONGEST_MATCH_ONLY */
+ 
+ /* ===========================================================================
+  * Local data
+@@ -104,6 +110,7 @@
+ #define NIL 0
+ /* Tail of hash chains */
+ 
++#ifndef LONGEST_MATCH_ONLY
+ #ifndef TOO_FAR
+ #  define TOO_FAR 4096
+ #endif
+@@ -1130,7 +1137,9 @@
  #endif
  #endif
-+#endif
- local uInt longest_match_fast OF((deflate_state *s, IPos cur_match));
- 
- #ifdef DEBUG
-@@ -1010,6 +1014,7 @@
- #endif
  }
++#endif /* ! LONGEST_MATCH_ONLY */
  
 +#if defined(ORIG_LONGEST_MATCH) || defined(ORIG_LONGEST_MATCH_GLOBAL)
  #ifndef FASTEST
  /* ===========================================================================
   * Set match_start to the longest match starting at the given string and
-@@ -1024,7 +1029,11 @@
+@@ -1145,7 +1154,11 @@
  /* For 80x86 and 680x0, an optimized version will be provided in match.asm or
   * match.S. The code will be functionally equivalent.
   */
@@ -139,11 +150,24 @@
      deflate_state *s;
      IPos cur_match;                             /* current match */
  {
-@@ -1168,6 +1177,7 @@
+@@ -1288,6 +1301,7 @@
+     return s->lookahead;
  }
  #endif /* ASMV */
- #endif /* FASTEST */
 +#endif /* ORIG_LONGEST_MATCHT */
  
- /* ---------------------------------------------------------------------------
-  * Optimized version for level == 1 or strategy == Z_RLE only
+ #else /* FASTEST */
+ 
+@@ -1349,6 +1363,7 @@
+ 
+ #endif /* FASTEST */
+ 
++#ifndef LONGEST_MATCH_ONLY
+ #ifdef DEBUG
+ /* ===========================================================================
+  * Check that the match at match_start is indeed a match.
+@@ -1965,3 +1980,4 @@
+         FLUSH_BLOCK(s, 0);
+     return block_done;
+ }
++#endif /* ! LONGEST_MATCH_ONLY */