Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004074OCamlOCaml backend (code generation)public2006-08-03 16:242013-09-03 17:17
Reporterfrisch 
Assigned To 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusacknowledgedResolutionopen 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0004074: Patch for in-place compilation of structures
Description[edit: english translation]

The attached patch adds an "-inplace" option to ocamlopt. When the option is set, it uses for all structures the same compilation scheme as is currently done for global structures only. This reduce pressure on the register allocater when compiling big structures.

The patch is careful to adapt the inliner to the new way of filling structure fields.

The program generated by the following code:

  print_string "module F(X:sig val x : int end) = struct\n let x0 = X.x";;
  for i = 1 to 300 do Printf.printf " let x%i = %i * x%i\n" i i (i-1) done;;
  print_string "end";;

needs 15 seconds to compile with ocamlopt and 0.3s with option -inplace,
and the generated .o goes from 15044 bytes to 12740 bytes.

---

Le patch en pièce jointe ajoute une option "-inplace" à ocamlopt, dont l'effet
est d'utiliser le schéma de compilation des structures globales pour toutes les structures. Ça permet de réduire la pression sur l'allocateur de registres lorsque l'on compile de grosses structures.

Le patch prend soin d'adapter l'inliner pour qu'il comprenne la nouvelle manière de remplir les champs d'une structure.

Le programme produit par:

  print_string "module F(X:sig val x : int end) = struct\n let x0 = X.x";;
  for i = 1 to 300 do Printf.printf " let x%i = %i * x%i\n" i i (i-1) done;;
  print_string "end";;

prend 15s à compiler avec ocamlopt et 0.3s avec l'option -inplace,
et le .o passe de 15044 octets à 12740 octets.
Tagspatch
Attached Files? file icon diff_inplace [^] (26,297 bytes) 2006-08-03 16:24 [Show Content]

- Relationships
related to 0005546resolvedfrisch moving a function into an internal module slows down its use 
related to 0005573resolvedfrisch Access to values in nested modules 

-  Notes
(0003727)
frisch (developer)
2006-08-05 11:17
edited on: 2012-04-05 06:11

You have to remove the assertion (assert(a.(n) = Value_unknown) so that it still works without -inplace.

(0003730)
frisch (developer)
2006-08-08 19:15
edited on: 2012-04-05 06:12

For the record, the patch compiles Ocamlr.ml for example in 7 seconds, against 21s without the patch. It is mostly the computation of the register interference graph which makes the difference.


- Issue History
Date Modified Username Field Change
2006-08-03 16:24 frisch New Issue
2006-08-03 16:24 frisch File Added: diff_inplace
2006-08-05 11:17 frisch Note Added: 0003727
2006-08-08 19:15 frisch Note Added: 0003730
2006-08-29 16:40 doligez Status new => acknowledged
2012-03-29 09:29 frisch Relationship added related to 0005546
2012-04-04 22:47 gasche Relationship added related to 0005573
2012-04-05 06:09 gasche Severity minor => feature
2012-04-05 06:09 gasche Summary Patch pour compiler les structures en place => Patch for in-place compilation of structures
2012-04-05 06:09 gasche Description Updated View Revisions
2012-04-05 06:11 gasche Note Edited: 0003727 View Revisions
2012-04-05 06:12 gasche Note Edited: 0003730 View Revisions
2012-06-20 11:19 frisch Category OCaml general => OCaml backend (code generation)
2013-09-03 17:17 doligez Tag Attached: patch


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker