diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 1995-07-28 12:21:26 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 1995-07-28 12:21:26 +0000 |
commit | e0ec7bce57d71457c8d9f2bcc69ee532a8a6a452 (patch) | |
tree | 6a41052b86a58cb12d1d2fa72538438b04a4baab | |
parent | ea3c75ad03542f0767952b102978268af0d8a07c (diff) | |
download | ocaml-e0ec7bce57d71457c8d9f2bcc69ee532a8a6a452.tar.gz |
alpha.asm: ldgp oublie dans caml_start_program.
array.c: correction de make_array dans le cas d'un tableau d'entiers.
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@163 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | asmrun/alpha.asm | 3 | ||||
-rw-r--r-- | asmrun/array.c | 47 |
2 files changed, 27 insertions, 23 deletions
diff --git a/asmrun/alpha.asm b/asmrun/alpha.asm index 674672f9b4..6e155bcf71 100644 --- a/asmrun/alpha.asm +++ b/asmrun/alpha.asm @@ -134,11 +134,11 @@ $103: ldgp $gp, 0($27) caml_c_call: /* Function to call is in $27 */ lda $sp, -16($sp) - stq $26, 0($sp) stq $gp, 8($sp) /* Rebuild $gp */ br $25, $105 $105: ldgp $gp, 0($25) + stq $26, 0($sp) /* Record lowest stack address and return address */ stq $26, caml_last_return_address lda $25, 16($sp) @@ -166,6 +166,7 @@ $105: ldgp $gp, 0($25) .ent caml_start_program .align 3 caml_start_program: + ldgp $gp, 0($27) lda $sp, -128($sp) stq $26, 0($sp) /* Save all callee-save registers */ diff --git a/asmrun/array.c b/asmrun/array.c index 09793ff8a4..8a57db3fde 100644 --- a/asmrun/array.c +++ b/asmrun/array.c @@ -12,7 +12,6 @@ value make_vect(len, init) value res; mlsize_t size, wsize, i; double d; - Push_roots(root, 1); size = Long_val(len); if (size == 0) { @@ -21,10 +20,8 @@ value make_vect(len, init) else if (Is_block(init) && Tag_val(init) == Double_tag) { d = Double_val(init); wsize = size * Double_wosize; - if (wsize > Max_wosize) { - Pop_roots(); + if (wsize > Max_wosize) invalid_argument("Array.new"); - } if (wsize < Max_young_wosize) res = alloc(wsize, Double_array_tag); else @@ -33,6 +30,7 @@ value make_vect(len, init) Store_double_field(res, i, d); } } else { + Push_roots(root, 1); if (size > Max_wosize) { Pop_roots(); invalid_argument("Array.new"); @@ -56,8 +54,8 @@ value make_vect(len, init) init = root[0]; for (i = 0; i < size; i++) initialize(&Field(res, i), init); } + Pop_roots(); } - Pop_roots(); return res; } @@ -65,28 +63,33 @@ value make_array(init) value init; { mlsize_t wsize, size, i; - value res; + value v, res; size = Wosize_val(init); - if (size == 0 || Tag_val(Field(init, 0)) != Double_tag) { + if (size == 0) { return init; } else { - Push_roots(root, 1); - root[0] = init; - wsize = size * Double_wosize; - if (wsize > Max_wosize) { - Pop_roots(); - invalid_argument("Array.new"); - } - if (wsize < Max_young_wosize) - res = alloc(wsize, Double_array_tag); - else - res = alloc_shr(wsize, Double_array_tag); - init = root[0]; - for (i = 0; i < size; i++) { - Store_double_field(res, i, Double_val(Field(init, i))); + v = Field(init, 0); + if (Is_long(v) || Tag_val(v) != Double_tag) { + return init; + } else { + Push_roots(root, 1); + root[0] = init; + wsize = size * Double_wosize; + if (wsize > Max_wosize) { + Pop_roots(); + invalid_argument("Array.new"); + } + if (wsize < Max_young_wosize) + res = alloc(wsize, Double_array_tag); + else + res = alloc_shr(wsize, Double_array_tag); + init = root[0]; + for (i = 0; i < size; i++) { + Store_double_field(res, i, Double_val(Field(init, i))); + } + return res; } - return res; } } |