caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Int32 and boxing
@ 2007-08-13  4:08 Jon Harrop
  2007-08-13 17:55 ` [Caml-list] " Richard Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Harrop @ 2007-08-13  4:08 UTC (permalink / raw)
  To: caml-list


Are int32s are boxed on a 64-bit machine?

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?e


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

* Re: [Caml-list] Int32 and boxing
  2007-08-13  4:08 Int32 and boxing Jon Harrop
@ 2007-08-13 17:55 ` Richard Jones
  2007-08-15  6:48   ` Jon Harrop
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Jones @ 2007-08-13 17:55 UTC (permalink / raw)
  To: Jon Harrop; +Cc: caml-list

On Mon, Aug 13, 2007 at 05:08:09AM +0100, Jon Harrop wrote:
> 
> Are int32s are boxed on a 64-bit machine?

Unfortunately yes:

# Obj.is_block (Obj.repr 1_l);;
- : bool = true
# Sys.word_size;;
- : int = 64

I deal a lot with int32 and int64 types when interfacing with other
languages, so this causes an annoyance.  I'm not sure what the
implications would be of having a different representation on 32 and
64 bit machines.  I guess Marshal would have to go through hoops for a
start.

Rich.

-- 
Richard Jones
Red Hat


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

* Re: [Caml-list] Int32 and boxing
  2007-08-13 17:55 ` [Caml-list] " Richard Jones
@ 2007-08-15  6:48   ` Jon Harrop
  0 siblings, 0 replies; 3+ messages in thread
From: Jon Harrop @ 2007-08-15  6:48 UTC (permalink / raw)
  To: Richard Jones; +Cc: caml-list

On Monday 13 August 2007 18:55:01 Richard Jones wrote:
> I deal a lot with int32 and int64 types when interfacing with other
> languages, so this causes an annoyance.  I'm not sure what the
> implications would be of having a different representation on 32 and
> 64 bit machines.  I guess Marshal would have to go through hoops for a
> start.

Now that I think about it in more detail, this would probably require deeper 
compiler changes than I had thought. You wouldn't need to alter the run-time 
but you'd need to emit different load and store code for unboxed float32s, 
tagging and untagging them, and do arithmetic in 32-bit registers.

I'm not sure Marshal would need changing though. The representation would be 
embedded in nativeint so it would just be a type difference.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
OCaml for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists/?e


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

end of thread, other threads:[~2007-08-15  6:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-13  4:08 Int32 and boxing Jon Harrop
2007-08-13 17:55 ` [Caml-list] " Richard Jones
2007-08-15  6:48   ` Jon Harrop

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).