ghostscript/ghostscript-obj-size.patch

133 lines
4.8 KiB
Diff

diff -up ghostscript-9.06/doc/Language.htm.obj-size ghostscript-9.06/doc/Language.htm
--- ghostscript-9.06/doc/Language.htm.obj-size 2012-08-08 09:01:37.000000000 +0100
+++ ghostscript-9.06/doc/Language.htm 2013-05-16 17:34:50.428601551 +0100
@@ -231,25 +231,25 @@ shown.
<td>&nbsp;
<tr valign=top> <td>array
<td>&nbsp;
- <td>65535
+ <td>16777216
<td>&nbsp;
<td>elements
<td>&nbsp;
- <td>&nbsp;
+ <td>65535
<tr valign=top> <td>dictionary
<td>&nbsp;
- <td>65534
+ <td>16777215
<td>&nbsp;
<td>elements
<td>&nbsp;
<td>65535
<tr valign=top> <td>string
<td>&nbsp;
- <td>65535
+ <td>16777216
<td>&nbsp;
<td>characters
<td>&nbsp;
- <td>&nbsp;
+ <td>65535
<tr valign=top> <td>name
<td>&nbsp;
<td>16383
@@ -381,10 +381,14 @@ starts with a %...% IODevice designation
<h3><a name="VM_consumption"></a>Other differences in VM consumption</h3>
<p>
-Packed array elements occupy either 2 bytes or 8 bytes. The average
-element size is probably about 5 bytes. Names occupy 12 bytes plus the
+In 32-bit builds packed array elements occupy either 2 bytes or 12 bytes.
+The average element size is probably about 7 bytes. Names occupy 16 bytes plus the
space for the string.
<p>
+In 64-bit builds packed array elements occupy either 2 bytes or 16 bytes.
+The average element size is probably about 9 bytes.
+Names occupy 24 bytes plus the space for the string.
+<p>
The garbage collector doesn't reclaim portions of arrays obtained with
<tt>getinterval</tt>, rather it collects entire arrays.
<hr>
diff -up ghostscript-9.06/psi/igcref.c.obj-size ghostscript-9.06/psi/igcref.c
--- ghostscript-9.06/psi/igcref.c.obj-size 2012-08-08 09:01:36.000000000 +0100
+++ ghostscript-9.06/psi/igcref.c 2013-05-16 17:34:50.458601694 +0100
@@ -745,7 +745,7 @@ refs_compact(const gs_memory_t *mem, obj
}
#endif
/* Pad to a multiple of sizeof(ref). */
- while (new_size & (sizeof(ref) - 1))
+ while (new_size % sizeof(ref))
*dest++ = pt_tag(pt_integer),
new_size += sizeof(ref_packed);
/* We want to make the newly freed space into a free block, */
diff -up ghostscript-9.06/psi/int.mak.obj-size ghostscript-9.06/psi/int.mak
--- ghostscript-9.06/psi/int.mak.obj-size 2013-05-16 17:34:26.682488246 +0100
+++ ghostscript-9.06/psi/int.mak 2013-05-16 17:34:50.459601698 +0100
@@ -64,7 +64,7 @@ iname_h=$(PSSRC)iname.h $(inames_h)
inameidx_h=$(PSSRC)inameidx.h
inamestr_h=$(PSSRC)inamestr.h $(inameidx_h)
ipacked_h=$(PSSRC)ipacked.h
-iref_h=$(PSSRC)iref.h
+iref_h=$(PSSRC)iref.h $(stdint__h)
isave_h=$(PSSRC)isave.h $(idosave_h)
isstate_h=$(PSSRC)isstate.h
istruct_h=$(PSSRC)istruct.h $(gsstruct_h)
diff -up ghostscript-9.06/psi/iref.h.obj-size ghostscript-9.06/psi/iref.h
--- ghostscript-9.06/psi/iref.h.obj-size 2012-08-08 09:01:36.000000000 +0100
+++ ghostscript-9.06/psi/iref.h 2013-05-16 17:34:50.459601698 +0100
@@ -19,6 +19,8 @@
#ifndef iref_INCLUDED
# define iref_INCLUDED
+#include "stdint_.h"
+
/*
* Note: this file defines a large number of macros. Many of these are
* only used for internal purposes within this file, to help in the
@@ -375,7 +377,7 @@ typedef int (*op_proc_t)(i_ctx_t *i_ctx_
struct tas_s {
/* type_attrs is a single element for fast dispatching in the interpreter */
ushort type_attrs;
- ushort rsize;
+ uint32_t rsize;
};
struct ref_s {
@@ -558,10 +560,10 @@ struct ref_s {
(((ARCH_ALIGN_LONG_MOD - 1) | (ARCH_ALIGN_FLOAT_MOD - 1) |\
(ARCH_ALIGN_PTR_MOD - 1)) + 1)
-/* Define the maximum size of an array or a string. */
-/* The maximum array size is determined by the fact that */
-/* the allocator cannot allocate a block larger than max_uint. */
-#define max_array_size (max_ushort & (max_uint / (uint)arch_sizeof_ref))
-#define max_string_size max_ushort
+/* Select reasonable values for PDF interpreter */
+/* The maximum array size cannot exceed max_uint/arch_sizeof_ref */
+/* because the allocator cannot allocate a block larger than max_uint. */
+#define max_array_size (16*1024*1024)
+#define max_string_size (16*1024*1024)
#endif /* iref_INCLUDED */
diff -up ghostscript-9.06/psi/zpacked.c.obj-size ghostscript-9.06/psi/zpacked.c
--- ghostscript-9.06/psi/zpacked.c.obj-size 2012-08-08 09:01:36.000000000 +0100
+++ ghostscript-9.06/psi/zpacked.c 2013-05-16 17:34:50.460601703 +0100
@@ -68,7 +68,6 @@ zsetpacking(i_ctx_t *i_ctx_p)
{
os_ptr op = osp;
ref cont;
-
check_type(*op, t_boolean);
make_struct(&cont, avm_local, ref_array_packing_container);
ref_assign_old(&cont, &ref_array_packing, op, "setpacking");
@@ -151,7 +150,7 @@ make_packed_array(ref * parr, ref_stack_
}
ishort = idest += packed_per_ref;
}
- pad = -(int)idest & (packed_per_ref - 1); /* padding at end */
+ pad = (packed_per_ref - idest % packed_per_ref) % packed_per_ref; /* padding at end */
/* Now we can allocate the array. */