> On Fri, 3 Jun 2005, Leopold Toetsch wrote:
> 
> > Nick Glencross wrote:
> > 
> > > I fear that there may be some pointer alignment problems in hash because 
> > > I'm
> > > getting hangs which seem to be linked to finding strings in hash tables.
> > > (That's pure conjecture)
> > 
> > I'm not aware of any problems with alignment in hash.c. *But* we will have
> > troubles on that platform with doubles. Parrot PMCs are allocate off a big
> > piece of mem. A PMC currently happens to be 24 bytes (on 32-bit) but only 
> > with
> > the debug-ish version field compiled in. With an --optimze compiled parrot
> > every second PMC would have unaligned doubles.
> 
> That's likely to cause a problem.  We've been recently hunting down odd 
> alignment-related oddities on p5p.  As a first approximation, doubles need 
> to be aligned at least on the boundaries given by Perl5's 
> Config{'alignbytes'}. However, when those doubles are part of a structure, 
> it apparently can get more confusing.  I don't think we sorted out all the 
> possibilities, but Nick C. was the last one fiddling with it.

Yup, you were right.  A parrot compiled perl Configure.pl --optimize
core dumps with bus alignment errors almost instantly.  As just one 
example
    $ cat t/op/number_2.pasm
            set     N0, 42.0
            set     N1, N0
            print   N1
            print   "\n"
            end
    $ /parrot -b -t -d ff -v t/op/number_2.pasm
    debug = 0xff
    Reading t/op/number_2.pasm
    using optimization '0' (0) 
    Starting parse...
    set %s, %s      set
    set %s, %s      set
    print %s        print
    print %s        print
    end     end
    emit set N0, 42.0
    emit set N1, N0
    emit print N1
    emit print "\n"
    emit end 
    6 lines compiled.
    Running...
         0 set N0, 42       - N0=0.000000, 
    Bus Error(coredump)

However, recompiling with -misalign (a special directive for Sun's compiler):
    -misalign
        (SPARC, PowerPC) Informs the compiler that data is  not
        properly  aligned  and thus very conservative loads and
        stores must be used for data, that is, one  byte  at  a
        time.  Using  this option can cause significant perfor-
        mance degradation when running  the  program.   If  you
        compile  and  link  in separate steps, this option must
        appear on both the compile and link command lines.

allows that test to pass.

-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to