caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] OCaml SPARC asm compiler implementation question
@ 2002-06-03 16:45 John Carr
  2002-06-04  9:58 ` Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: John Carr @ 2002-06-03 16:45 UTC (permalink / raw)
  To: caml-list


ocaml 3.04 uses registers %l6 and %l7 for allocation in compiled SPARC
code.  %l6 is the address of the last object allocated.  %l7 is a
pointer to a word holding the lower limit of the youngest generation,
young_limit in minor_gc.c.

The alloc instruction sequence looks like:
	ld	[%l7],%g1	! load young_limit
	sub	%l6,N,%l6	! decrement alloc pointer
	cmp	%l6,%g1		! bounds check
	bgeu	label		! branch if out of memory
	...

I have three questions:

Why does %l7 hold the address of young_limit instead of its value?
The alloc instruction sequence would be reduced by one instruction and
1-3 cycles (depending on chip) if the load could be omitted.  The MIPS
implementation does not have this indirection.


Looking at this code made me wonder, what fraction of operations in a
typical ocaml program are allocations?  _Garbage Collection_ quotes
statistics for several functional languages, including a version of ML,
but I don't think it mentions ocaml.


Are many people using ocaml on UltraSPARC processors?  The code is
optimized for older SPARCs and substantial improvement is possible
for UltraSPARC.  (For example, the integer load-double and store-double
instructions are faster than a pair of load or store instructions on
older SPARCs, are substantially slower on UltraSPARC, and trap to
emulation on the Hal SPARC-64.)  More on this in a future message.


    --John Carr (jfc@mit.edu)
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-06-04  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-03 16:45 [Caml-list] OCaml SPARC asm compiler implementation question John Carr
2002-06-04  9:58 ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).