On Sun, 24 Nov 2002, Dan Sugalski wrote:

> At 9:20 AM -0500 11/24/02, Andy Dougherty wrote:
> >On Sat, 23 Nov 2002, David Robins wrote:
> >>  When's the long double "KNOWN ISSUE" going to be fixed?  What's the work
<snip>
> >It's (at least partly) a packfile alignment thing.  I think if you look in
> >the packfile.c sources you'll find some more comments about it. (Search
> >for problem spots marked with "XXX".)  Also, if you look in the archives
> >back in Februrary 2002 or so, I think I posted something about the
> >"padding of FLOATVALs in CONSTANT section of bytecode".
<snip>
>
> I'll try and get it fixed, but unfortunately I managed to kill the
> compiler on the only machine I have handy that does long doubles
> (Screwed up the headers on my RedRat 6.2 system somehow--if someone
> knows about fixing this sort of stuff, drop me a line off-list) so it
> might be a little while.

I'm absolutely willing to try to fix it, given a few pointers in the right
direction.  I've been stumbling around packfile.[ch]/packout.c to see how
things work.

Actually it looks like the problem is in assemble.pl's sub constant_table;
even though $PConfig{numvalsize} is 12, $PConfig{packtype_n} is 'd' and
pack('d',$n)  uses 8 bytes.  This is after hacking NUMVAL_SIZE to 12,
though, which explains why it wasn't caught in config/auto/pack.pl.
perldoc for pack shows no way to pack a native NV.  Should assemble.pl be
using packout.c via XS/Inline?  If this is decided to be the way to go then
I'd be glad to work on a patch to do it.

For now, since my concern is working on Cardinal (Ruby -> parrot), I'll hack
on a temporary Inline::C sub to assemble.pl to pack an NV for myself.  With:

use Inline C => <<PACK_NV;
SV* packNV(SV* number) {
  NV nv = SvNV(number);
  SV* ret = newSVpvn((char*)&nv,sizeof(nv));
  return ret;
}
PACK_NV

and replacing '$const .= pack($PConfig{'packtype_n'},$_->[1]);'
         with '$const .= packNV($_->[1]);' in assemble.pl's constant_table
sub, I was able to successfully build and run the IMCC sample.imc
(Mandelbrot) example and a few others in examples/ (and there was much
rejoicing).

Dave
Isa. 40:31

Reply via email to