gs: backport 16MB string support

This commit is contained in:
cinap_lenrek 2015-02-21 10:55:09 +01:00
parent 6f1787adcb
commit ccb624e2bb
4 changed files with 8 additions and 7 deletions

View file

@ -161,6 +161,7 @@ gs_alloc_ref_array(gs_ref_memory_t * mem, ref * parr, uint attrs,
uint num_refs, client_name_t cname)
{
ref *obj;
uint i;
/* If we're allocating a run of refs already, */
/* and we aren't about to overflow the maximum run length, use it. */
@ -214,6 +215,8 @@ gs_alloc_ref_array(gs_ref_memory_t * mem, ref * parr, uint attrs,
cl.cp->has_refs = true;
}
}
for (i = 0; i < num_refs; i++)
make_null(&(obj[i]));
make_array(parr, attrs | mem->space, num_refs, obj);
return 0;
}

View file

@ -715,7 +715,7 @@ refs_compact(const gs_memory_t *mem, obj_header_t * pre, obj_header_t * dpre, ui
}
#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, */

View file

@ -376,7 +376,7 @@ typedef int (*op_proc_t)(i_ctx_t *i_ctx_p);
struct tas_s {
/* type_attrs is a single element for fast dispatching in the interpreter */
ushort type_attrs;
ushort rsize;
uint rsize;
};
struct ref_s {
@ -560,9 +560,7 @@ struct ref_s {
(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
#define max_array_size (16*1024*1024)
#define max_string_size (16*1024*1024)
#endif /* iref_INCLUDED */

View file

@ -151,7 +151,7 @@ make_packed_array(ref * parr, ref_stack_t * pstack, uint size,
}
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. */