shithub: riscv

Download patch

ref: cd346556427f3fb37f6e8404a08664c7950b75c2
parent: e3ddbf12bd7629fbf50535ca2815343d7052aa9e
parent: ccb624e2bb67161590f490f671f611a44fcbd61e
author: cinap_lenrek <[email protected]>
date: Sat Feb 21 05:56:32 EST 2015

merge

--- a/sys/src/cmd/gs/src/ialloc.c
+++ b/sys/src/cmd/gs/src/ialloc.c
@@ -161,6 +161,7 @@
 		   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 @@
 	    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;
 }
--- a/sys/src/cmd/gs/src/igcref.c
+++ b/sys/src/cmd/gs/src/igcref.c
@@ -715,7 +715,7 @@
     }
 #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, */
--- a/sys/src/cmd/gs/src/iref.h
+++ b/sys/src/cmd/gs/src/iref.h
@@ -376,7 +376,7 @@
 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 @@
    (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 */
--- a/sys/src/cmd/gs/src/zpacked.c
+++ b/sys/src/cmd/gs/src/zpacked.c
@@ -151,7 +151,7 @@
 	}
 	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. */