Commits

xleroy  committed 7da087e

cmmgen: rectification acces generique aux tableaux de flottants.
emit_alpha: modifs mineures sur $gp.

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@162f963ae5c-01c2-4b8c-9fe0-0dff7051ff02

  • Participants
  • Parent commits 957c427

Comments (0)

Files changed (3)

File asmcomp/cmm.ml

 
 type machtype = machtype_component array
 
-let typ_void = ([||] : machtype)
+let typ_void = ([||] : machtype_component array)
 let typ_addr = [|Addr|]
 let typ_int = [|Int|]
 let typ_float = [|Float|]

File asmcomp/cmmgen.ml

   | _ -> let id = Ident.new name in Clet(id, arg, fn (Cvar id))
 
 (* Block headers. Meaning of the tag field:
-       0 - 249: regular blocks
-       250: closures
-       251: infix closure
-       252: abstract
-       253: string
-       254: float
+       0 - 248: regular blocks
+       249: closures
+       250: infix closure
+       251: abstract
+       252: string
+       253: float
+       254: float array
        255: finalized *)
 
-let float_tag = Cconst_int 254
+let float_tag = Cconst_int 253
 
 let block_header tag sz = (sz lsl 10) + tag
-let closure_header sz = block_header 250 sz
-let infix_header ofs = block_header 251 ofs
-let float_header = block_header 254 (size_float / size_addr)
+let closure_header sz = block_header 249 sz
+let infix_header ofs = block_header 250 ofs
+let float_header = block_header 253 (size_float / size_addr)
 let floatarray_header len = block_header 254 (len * size_float / size_addr)
-let string_header len = block_header 253 ((len + size_addr) / size_addr)
+let string_header len = block_header 252 ((len + size_addr) / size_addr)
 
 let alloc_block_header tag sz = Cconst_int(block_header tag sz)
 let alloc_floatarray_header len = Cconst_int(floatarray_header len)
               bind "arr" (transl arg1) (fun arr ->
                 Cifthenelse(is_addr_array(header arr),
                             addr_array_set arr index newval,
-                            float_array_set arr index newval))))
+                            float_array_set arr index (unbox_float newval)))))
       | Paddrarray ->
           addr_array_set (transl arg1) (transl arg2) (transl arg3)
       | Pintarray ->
                     Csequence(Cop(Ccheckbound, [addr_array_length hdr; idx]),
                               addr_array_set arr idx newval),
                     Csequence(Cop(Ccheckbound, [float_array_length hdr; idx]),
-                              float_array_set arr idx newval))))))
+                              float_array_set arr idx
+                                              (unbox_float newval)))))))
       | Paddrarray ->
           bind "index" (transl arg2) (fun idx ->
             bind "arr" (transl arg1) (fun arr ->

File asmcomp/emit_alpha.mlp

   | Isubf -> "subt"
   | Imulf -> "mult"
   | Idivf -> "divt"
+  | _ -> Misc.fatal_error "Emit.name_for_float_operation"
 
 let name_for_specific_operation = function
     Iadd4 -> "s4addq"
           (* caml_c_call preserves $gp *)
         end else begin
           `	jsr	{emit_symbol s}\n`;
-          `	ldgp	$gp, 0($26)\n`
+          if !uses_gp then
+            `	ldgp	$gp, 0($26)\n`
         end
     | Lop(Istackoffset n) ->
         `	lda	$sp, {emit_int (-n)}($sp)\n`;
   let n = frame_size() in
   if n > 0 then
     `	lda	$sp, -{emit_int n}($sp)\n`;
-  if !contains_calls then
-    `	stq	$26, {emit_int(n - 8)}($sp)\n`;
   if !uses_gp then begin
     `	stq	$gp, {emit_int(n - 16)}($sp)\n`;
     let lbl = new_label() in
     `	br	$27, {emit_label lbl}\n`;
     `{emit_label lbl}:	ldgp	$gp, 0($27)\n`
   end;
+  if !contains_calls then
+    `	stq	$26, {emit_int(n - 8)}($sp)\n`;
   `{emit_label !tailrec_entry_point}:`;
   emit_all fundecl.fun_body;
   List.iter emit_call_gc !call_gc_sites;