| Attached Files | int31.patch [^] (7,686 bytes) 2009-11-13 20:42 [Show Content] [Hide Content]only in patch2:
unchanged:
--- ocaml-3.11.1.orig/byterun/compatibility.h
+++ ocaml-3.11.1/byterun/compatibility.h
@@ -324,6 +324,7 @@
#define BIGARRAY_NATIVE_INT CAML_BA_NATIVE_INT
#define BIGARRAY_COMPLEX32 CAML_BA_COMPLEX32
#define BIGARRAY_COMPLEX64 CAML_BA_COMPLEX64
+#define BIGARRAY_INT31 CAML_BA_INT31
#define BIGARRAY_KIND_MASK CAML_BA_KIND_MASK
#define caml_bigarray_layout caml_ba_layout
#define BIGARRAY_C_LAYOUT CAML_BA_C_LAYOUT
only in patch2:
unchanged:
--- ocaml-3.11.1.orig/bytecomp/typeopt.ml
+++ ocaml-3.11.1/bytecomp/typeopt.ml
@@ -118,7 +118,8 @@
"int_elt", Pbigarray_caml_int;
"nativeint_elt", Pbigarray_native_int;
"complex32_elt", Pbigarray_complex32;
- "complex64_elt", Pbigarray_complex64]
+ "complex64_elt", Pbigarray_complex64;
+ "int31_elt", Pbigarray_int31]
let layout_table =
["c_layout", Pbigarray_c_layout;
only in patch2:
unchanged:
--- ocaml-3.11.1.orig/bytecomp/printlambda.ml
+++ ocaml-3.11.1/bytecomp/printlambda.ml
@@ -72,6 +72,7 @@
| Pbigarray_uint8 -> "uint8"
| Pbigarray_sint16 -> "sint16"
| Pbigarray_uint16 -> "uint16"
+ | Pbigarray_int31 -> "int31"
| Pbigarray_int32 -> "int32"
| Pbigarray_int64 -> "int64"
| Pbigarray_caml_int -> "camlint"
only in patch2:
unchanged:
--- ocaml-3.11.1.orig/bytecomp/lambda.mli
+++ ocaml-3.11.1/bytecomp/lambda.mli
@@ -102,6 +102,7 @@
| Pbigarray_int32 | Pbigarray_int64
| Pbigarray_caml_int | Pbigarray_native_int
| Pbigarray_complex32 | Pbigarray_complex64
+ | Pbigarray_int31
and bigarray_layout =
Pbigarray_unknown_layout
only in patch2:
unchanged:
--- ocaml-3.11.1.orig/bytecomp/lambda.ml
+++ ocaml-3.11.1/bytecomp/lambda.ml
@@ -102,6 +102,7 @@
| Pbigarray_int32 | Pbigarray_int64
| Pbigarray_caml_int | Pbigarray_native_int
| Pbigarray_complex32 | Pbigarray_complex64
+ | Pbigarray_int31
and bigarray_layout =
Pbigarray_unknown_layout
only in patch2:
unchanged:
--- ocaml-3.11.1.orig/asmcomp/cmmgen.ml
+++ ocaml-3.11.1/asmcomp/cmmgen.ml
@@ -520,6 +520,7 @@
| Pbigarray_native_int -> size_int
| Pbigarray_complex32 -> 8
| Pbigarray_complex64 -> 16
+ | Pbigarray_int31 -> 4
let bigarray_indexing unsafe elt_kind layout b args dbg =
let check_bound a1 a2 k =
@@ -561,6 +562,7 @@
| Pbigarray_uint8 -> Byte_unsigned
| Pbigarray_sint16 -> Sixteen_signed
| Pbigarray_uint16 -> Sixteen_unsigned
+ | Pbigarray_int31 -> Thirtytwo_signed
| Pbigarray_int32 -> Thirtytwo_signed
| Pbigarray_int64 -> Word
| Pbigarray_caml_int -> Word
@@ -908,6 +910,7 @@
| Pbigarray_int32 -> box_int Pint32 elt
| Pbigarray_int64 -> box_int Pint64 elt
| Pbigarray_native_int -> box_int Pnativeint elt
+ | Pbigarray_int31 -> force_tag_int elt
| Pbigarray_caml_int -> force_tag_int elt
| _ -> tag_int elt
end
only in patch2:
unchanged:
--- ocaml-3.11.1.orig/otherlibs/bigarray/bigarray.h
+++ ocaml-3.11.1/otherlibs/bigarray/bigarray.h
@@ -46,6 +46,7 @@
CAML_BA_NATIVE_INT, /* Platform-native long integers (32 or 64 bits) */
CAML_BA_COMPLEX32, /* Single-precision complex */
CAML_BA_COMPLEX64, /* Double-precision complex */
+ CAML_BA_INT31, /* Small Caml-style integers (signed 31 bits) */
CAML_BA_KIND_MASK = 0xFF /* Mask for kind in flags field */
};
only in patch2:
unchanged:
--- ocaml-3.11.1.orig/otherlibs/bigarray/bigarray_stubs.c
+++ ocaml-3.11.1/otherlibs/bigarray/bigarray_stubs.c
@@ -51,7 +51,8 @@
2 /*SINT16*/, 2 /*UINT16*/,
4 /*INT32*/, 8 /*INT64*/,
sizeof(value) /*CAML_INT*/, sizeof(value) /*NATIVE_INT*/,
- 8 /*COMPLEX32*/, 16 /*COMPLEX64*/
+ 8 /*COMPLEX32*/, 16 /*COMPLEX64*/,
+ 4 /*INT31*/
};
/* Compute the number of bytes for the elements of a big array */
@@ -278,6 +279,8 @@
return Val_int(((int16 *) b->data)[offset]);
case CAML_BA_UINT16:
return Val_int(((uint16 *) b->data)[offset]);
+ case CAML_BA_INT31:
+ return Val_int(((int32 *) b->data)[offset]);
case CAML_BA_INT32:
return caml_copy_int32(((int32 *) b->data)[offset]);
case CAML_BA_INT64:
@@ -377,6 +380,8 @@
case CAML_BA_SINT16:
case CAML_BA_UINT16:
((int16 *) b->data)[offset] = Int_val(newval); break;
+ case CAML_BA_INT31:
+ ((int32 *) b->data)[offset] = Int_val(newval); break;
case CAML_BA_INT32:
((int32 *) b->data)[offset] = Int32_val(newval); break;
case CAML_BA_INT64:
@@ -583,6 +588,8 @@
DO_INTEGER_COMPARISON(int16);
case CAML_BA_UINT16:
DO_INTEGER_COMPARISON(uint16);
+ case CAML_BA_INT31:
+ DO_INTEGER_COMPARISON(int32);
case CAML_BA_INT32:
DO_INTEGER_COMPARISON(int32);
case CAML_BA_INT64:
@@ -641,6 +648,7 @@
}
case CAML_BA_FLOAT32:
case CAML_BA_COMPLEX32:
+ case CAML_BA_INT31:
case CAML_BA_INT32:
#ifndef ARCH_SIXTYFOUR
case CAML_BA_CAML_INT:
@@ -734,6 +742,7 @@
case CAML_BA_UINT16:
caml_serialize_block_2(b->data, num_elts); break;
case CAML_BA_FLOAT32:
+ case CAML_BA_INT31:
case CAML_BA_INT32:
caml_serialize_block_4(b->data, num_elts); break;
case CAML_BA_COMPLEX32:
@@ -806,6 +815,7 @@
case CAML_BA_UINT16:
caml_deserialize_block_2(b->data, num_elts); break;
case CAML_BA_FLOAT32:
+ case CAML_BA_INT31:
case CAML_BA_INT32:
caml_deserialize_block_4(b->data, num_elts); break;
case CAML_BA_COMPLEX32:
@@ -996,6 +1006,12 @@
for (p = b->data; num_elts > 0; p++, num_elts--) *p = init;
break;
}
+ case CAML_BA_INT31: {
+ int32 init = Int_val(vinit);
+ int32 * p;
+ for (p = b->data; num_elts > 0; p++, num_elts--) *p = init;
+ break;
+ }
case CAML_BA_INT32: {
int32 init = Int32_val(vinit);
int32 * p;
only in patch2:
unchanged:
--- ocaml-3.11.1.orig/otherlibs/bigarray/bigarray.ml
+++ ocaml-3.11.1/otherlibs/bigarray/bigarray.ml
@@ -33,6 +33,7 @@
type float64_elt
type complex32_elt
type complex64_elt
+type int31_elt
(* Keep those constants in sync with the caml_ba_kind enumeration
in bigarray.h *)
@@ -50,6 +51,7 @@
let char = int8_unsigned
let complex32 = 10
let complex64 = 11
+let int31 = 12
type 'a layout = int
only in patch2:
unchanged:
--- ocaml-3.11.1.orig/otherlibs/bigarray/bigarray.mli
+++ ocaml-3.11.1/otherlibs/bigarray/bigarray.mli
@@ -49,6 +49,8 @@
({!Bigarray.int16_signed_elt} or {!Bigarray.int16_unsigned_elt}),
- Caml integers (signed, 31 bits on 32-bit architectures,
63 bits on 64-bit architectures) ({!Bigarray.int_elt}),
+- Small Caml integers (signed, 31 bits on 32-bit architectures,
+ 32 bits on 64-bit architectures) ({!Bigarray.int31_elt}),
- 32-bit signed integer ({!Bigarray.int32_elt}),
- 64-bit signed integers ({!Bigarray.int64_elt}),
- platform-native signed integers (32 bits on 32-bit architectures,
@@ -70,6 +72,7 @@
type int32_elt
type int64_elt
type nativeint_elt
+type int31_elt
type ('a, 'b) kind
(** To each element kind is associated a Caml type, which is
@@ -115,6 +118,9 @@
val int : (int, int_elt) kind
(** See {!Bigarray.char}. *)
+val int31 : (int, int31_elt) kind
+(** See {!Bigarray.char}. *)
+
val int32 : (int32, int32_elt) kind
(** See {!Bigarray.char}. *)
@@ -132,7 +138,7 @@
{!Complex.t}. Big arrays of
integer kinds are accessed using the smallest Caml integer
type large enough to represent the array elements:
- [int] for 8- and 16-bit integer bigarrays, as well as Caml-integer
+ [int] for 8-, 16- and 31-bit integer bigarrays, as well as Caml-integer
bigarrays; [int32] for 32-bit integer bigarrays; [int64]
for 64-bit integer bigarrays; and [nativeint] for
platform-native integer bigarrays. Finally, big arrays of
|