summaryrefslogtreecommitdiffstats
path: root/asmrun/array.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1998-04-06 09:09:22 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1998-04-06 09:09:22 +0000
commitd83bfc2f72be1d4861369eb80ecce0a3a29c2f79 (patch)
tree847e324640ac49935b55025f2b10b08c5de393a9 /asmrun/array.c
parent268f9837e9289709d933e784421eea3eaf7b69c4 (diff)
array.c est maintenant partage avec byterun
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1894 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'asmrun/array.c')
-rw-r--r--asmrun/array.c102
1 files changed, 0 insertions, 102 deletions
diff --git a/asmrun/array.c b/asmrun/array.c
deleted file mode 100644
index 6218039f8..000000000
--- a/asmrun/array.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/***********************************************************************/
-/* */
-/* Objective Caml */
-/* */
-/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
-/* */
-/* Copyright 1996 Institut National de Recherche en Informatique et */
-/* Automatique. Distributed only by permission. */
-/* */
-/***********************************************************************/
-
-/* $Id$ */
-
-/* Operations on arrays */
-
-#include "alloc.h"
-#include "fail.h"
-#include "memory.h"
-#include "misc.h"
-#include "mlvalues.h"
-
-value make_vect(value len, value init)
-{
- value res;
- mlsize_t size, wsize, i;
- double d;
-
- size = Long_val(len);
- if (size == 0) {
- res = Atom(0);
- }
- else if (Is_block(init) && Tag_val(init) == Double_tag) {
- d = Double_val(init);
- wsize = size * Double_wosize;
- if (wsize > Max_wosize) invalid_argument("Array.new");
- if (wsize < Max_young_wosize) {
- res = alloc(wsize, Double_array_tag);
- } else {
- res = alloc_shr(wsize, Double_array_tag);
- res = check_urgent_gc (res);
- }
- for (i = 0; i < size; i++) {
- Store_double_field(res, i, d);
- }
- } else {
- if (size > Max_wosize) invalid_argument("Array.new");
- Begin_root(init);
- if (size < Max_young_wosize) {
- res = alloc(size, 0);
- for (i = 0; i < size; i++) Field(res, i) = init;
- }
- else if (Is_block(init) && Is_young(init)) {
- minor_collection();
- res = alloc_shr(size, 0);
- for (i = 0; i < size; i++) Field(res, i) = init;
- res = check_urgent_gc (res);
- }
- else {
- res = alloc_shr(size, 0);
- for (i = 0; i < size; i++) initialize(&Field(res, i), init);
- res = check_urgent_gc (res);
- }
- End_roots();
- }
- return res;
-}
-
-value make_array(value init)
-{
- mlsize_t wsize, size, i;
- value v, res;
-
- size = Wosize_val(init);
- if (size == 0) {
- return init;
- } else {
- v = Field(init, 0);
- if (Is_long(v) || Tag_val(v) != Double_tag) {
- return init;
- } else {
- wsize = size * Double_wosize;
- if (wsize > Max_wosize) invalid_argument("Array.new");
- Begin_root(init);
- if (wsize < Max_young_wosize) {
- res = alloc(wsize, Double_array_tag);
- } else {
- res = alloc_shr(wsize, Double_array_tag);
- res = check_urgent_gc (res);
- }
- for (i = 0; i < size; i++) {
- Store_double_field(res, i, Double_val(Field(init, i)));
- }
- End_roots();
- return res;
- }
- }
-}
-
-void array_bound_error(void)
-{
- fatal_error("Fatal error: out-of-bound access in array or string\n");
-}