|
List Info
Thread: "ocaml_beginners"::[] Fatal error on AMD64
|
|
| "ocaml_beginners"::[] Fatal
error on AMD64 |

|
2006-08-22 07:28:17 |
I recently bought a new AMD64 - my firste experience of
64-bit on a PC.
One of the programs that I have used in the past years was
one I wrote
in Ocaml to archive files to CD's.
On 32-bit machines it works without a problem but on my
AMD64 I get an
error:
Fatal error: exception ExtList.List.Invalid_index(3).
In both cases (32-bit and 64-bit) it was compiled to native
code and I
have tested it with the same data.
Is there something special about using ExtList or compiling
programs on
64-bit machines?
Regards
Johann
--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch
"For yourselves know perfectly that the day of
the Lord
so cometh as a thief in the night. For when they shall
say, Peace and safety; then sudden destruction cometh
upon them, as travail upon a woman with child; and
they shall not escape." I Thessalonians
5:2,3
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
| "ocaml_beginners"::[] Fatal
error on AMD64 |

|
2006-08-22 10:21:37 |
On Tue, Aug 22, 2006 at 09:28:17AM +0200, Johann Spies
wrote:
> Fatal error: exception ExtList.List.Invalid_index(3).
>
> In both cases (32-bit and 64-bit) it was compiled to
native code and I
> have tested it with the same data.
>
> Is there something special about using ExtList or
compiling programs on
> 64-bit machines?
Without seeing the code it's rather hard to tell, but there
is
certainly a big difference between 32 and 64 bit platforms,
and that
is of course the size of the 'int' type (31 and 63 bits
respectively).
Since OCaml doesn't trap overflows, the following code
reacts very
differently on 32 and 64 bit platforms:
let xs = [ 0; 1; 2; 3 ]
let i = 2
let i = i + 2 lsl 30 + 2 lsl 30
let () = Printf.printf "xs.(%d) = %d\n" i
(List.nth xs i)
On 32 bit platforms, it will print:
xs.(2) = 2
On 64 bit, it will throw an exception similar to or the same
as the
one above.
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
| "ocaml_beginners"::[] Fatal
error on AMD64 |

|
2006-08-22 11:12:13 |
On Tuesday 22 August 2006 08:28, Johann Spies wrote:
> Is there something special about using ExtList or
compiling programs on
> 64-bit machines?
Try using ordinary lists.
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scient
ists
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
| "ocaml_beginners"::[] Fatal
error on AMD64 |

|
2006-08-22 11:17:53 |
On Tue, Aug 22, 2006 at 12:12:13PM +0100, Jon Harrop wrote:
> Try using ordinary lists.
Because all the functions of ordinary lists are not tail
recursive, I
had problems with that before on 32-bit machines. The
programs
sometimes works with large lists.
Regards
Johann
--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch
"For yourselves know perfectly that the day of
the Lord
so cometh as a thief in the night. For when they shall
say, Peace and safety; then sudden destruction cometh
upon them, as travail upon a woman with child; and
they shall not escape." I Thessalonians
5:2,3
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
| "ocaml_beginners"::[] Fatal
error on AMD64 |

|
2006-08-22 11:38:55 |
On Tuesday 22 August 2006 12:17, Johann Spies wrote:
> On Tue, Aug 22, 2006 at 12:12:13PM +0100, Jon Harrop
wrote:
> > Try using ordinary lists.
>
> Because all the functions of ordinary lists are not
tail recursive, I
> had problems with that before on 32-bit machines. The
programs
> sometimes works with large lists.
Yes, that will be even more of a problem on AMD64 where the
stack frames are
larger so you can't recurse as deeply. Moreover, you might
get a
Stack_overflow exception on x86 but you won't on AMD64.
Only some functions are not tail recursive (e.g. map). You
can rewrite them in
a tail recursive form (e.g. rev (revmap a)) to avoid stack
overflows.
Many third party libraries that use illegal hacks break on
AMD64. I believe
ExtLib does such things, particularly with lists.
--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scient
ists
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
| "ocaml_beginners"::[] Fatal
error on AMD64 |

|
2006-08-23 06:31:37 |
On Tue, Aug 22, 2006 at 12:38:55PM +0100, Jon Harrop wrote:
> Only some functions are not tail recursive (e.g. map).
You can rewrite them in
> a tail recursive form (e.g. rev (revmap a)) to avoid
stack overflows.
Thanks. I did not now about rev_map although I have used
rev_append
before.
I think I have found my problem: In the code I use a
regular expression
to parse the output of a shell command (df) and on the new
computer that
output had a different format than on the one the code was
originally
used on. List.nth then tried to access data that did not
exist in the
output.
Anyhow, after you message I have removed the ExtList-stuff
now from my
code. I still have to test the new code with larger volumes
of data,
but for now it is working.
Regards
Johann
--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch
"For God hath not appointed us to wrath, but to
obtain
salvation by our Lord Jesus Christ, Who died for us,
that, whether we wake or sleep, we should live
together with him."
I Thessalonians 5:9,10
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
| "ocaml_beginners"::[] Fatal
error on AMD64 |

|
2006-08-23 16:19:18 |
On Wed, Aug 23, 2006 at 08:31:37AM +0200, Johann Spies
wrote:
> I think I have found my problem: In the code I use a
regular expression
> to parse the output of a shell command (df) and on the
new computer that
> output had a different format than on the one the code
was originally
> used on. List.nth then tried to access data that did
not exist in the
> output.
>
> Anyhow, after you message I have removed the
ExtList-stuff now from my
> code. I still have to test the new code with larger
volumes of data,
> but for now it is working.
There's no problem with Extlib on AMD64 that we've ever
come across.
We use it extensively.
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
| "ocaml_beginners"::[] Fatal
error on AMD64 |

|
2006-08-24 12:41:05 |
On Wed, Aug 23, 2006 at 05:19:18PM +0100, Richard Jones
wrote:
> On Wed, Aug 23, 2006 at 08:31:37AM +0200, Johann Spies
wrote:
> > I think I have found my problem: In the code I
use a regular expression
> > to parse the output of a shell command (df) and on
the new computer that
> > output had a different format than on the one the
code was originally
> > used on. List.nth then tried to access data that
did not exist in the
> > output.
> >
> > Anyhow, after you message I have removed the
ExtList-stuff now from my
> > code. I still have to test the new code with
larger volumes of data,
> > but for now it is working.
>
> There's no problem with Extlib on AMD64 that we've
ever come across.
> We use it extensively.
Thanks. It is good to know.
By the way, is there an way to determine the free space on a
disk
without having to use the shell command "df" ?
If that can be done then
I do not depend on the format of the output of the shell
command.
Regards
Johann
--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch
"I saw in the night visions, and, behold, one
like the
Son of man came with the clouds of heaven, and came to
the Ancient of days, and they brought him near before
him. And there was given him dominion, and glory, and
a kingdom, that all people, nations, and languages,
should serve him; his dominion is an everlasting
dominion, which shall not pass away, and his kingdom
that which shall not be destroyed."
Daniel 7:13,14
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
| statfs on Ocaml (was: Re:
"ocaml_beginners"::[] Fatal
error on AMD64) |

|
2006-08-24 13:38:18 |
On Thu, Aug 24, 2006 at 02:41:05PM +0200, Johann Spies
wrote:
> By the way, is there an way to determine the free space
on a disk
> without having to use the shell command
"df" ? If that can be done then
> I do not depend on the format of the output of the
shell command.
You'd use the statfs(2) system call. That's not bound in
the OCaml
Unix library, but I did write a binding for it. Note that
my binding
turned out to be buggy, so be sure to read the follow-up
messages too.
http://caml.inria
.fr/pub/ml-archives/caml-list/2005/07/bb434b103b1cdbbec3c832
d9a72af9a3.en.html
Rich.
--
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
| "ocaml_beginners"::[] Re:
statfs on Ocaml |

|
2006-08-24 14:39:32 |
Richard Jones wrote:
> On Thu, Aug 24, 2006 at 02:41:05PM +0200, Johann Spies
wrote:
>> By the way, is there an way to determine the free
space on a disk
>> without having to use the shell command
"df" ? If that can be done then
>> I do not depend on the format of the output of the
shell command.
>
> You'd use the statfs(2) system call.
no, you'd use the POSIX statvfs(2) system call instead of
the
linux/bsd-specific statfs (which are mutually incompatible
to boot).
Archives up to August 22, 2005 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors'
one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid
flames etc.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http:/
/groups.yahoo.com/group/ocaml_beginners/
<*> To unsubscribe from this group, send an email to:
ocaml_beginners-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|
|
|
|