[erlang-patches] Few HiPE patches

Mikael Pettersson <>
Wed Jun 23 12:29:05 CEST 2010

Martti Kuparinen writes:
 > Hi again,
 > Do you guys have any idea what these are? Do they look reasonable?
 > Obvious errors?
 > http://pkgsrc-wip.cvs.sourceforge.net/viewvc/pkgsrc-wip/wip/erlang/patches/patch-al?revision=1.2

For amd64: ignore the availability of MAP_32BIT if the fake MMAP_MAP_FIXED is
defined. Weird.

It also breaks Solaris. In a followup message you mention setting MMAP_MAP_FIXED
outside of the original sources. Although that would seem to unbreak Solaris it's
a totally unacceptable approach: the integrity of the sources must not depend on
external hacks outside of our control.

Why on earth would one want to ignore MAP_32BIT? If it's defined but doesn't
work, then the correct solution is to

#if ...
#undef MAP_32BIT

somewhere before this code.

 > http://pkgsrc-wip.cvs.sourceforge.net/viewvc/pkgsrc-wip/wip/erlang/patches/patch-am?revision=1.2

For arm:
1) Use MAP_ANON if MAP_ANONYMOUS isn't defined. This is Ok.
2. Add MAP_FIXED to mmap call if fake MMAP_MAP_FIXED is defined.
With standard-compliant mmap() [ie POSIX or SUS] this would result in an attempt
to mmap() anonymous memory at address zero, which is bogus and won't work.

Just how broken is BSD's mmap()? And have they redefined MAP_FIXED to mean
something completely non-standard?

Strong NAK util proper justification is given.

 > http://pkgsrc-wip.cvs.sourceforge.net/viewvc/pkgsrc-wip/wip/erlang/patches/patch-an?revision=1.2

For ppc: add MAP_FIXED to mmap() calls under the same conditions as above for arm.
Same breakage, same NAK.

 > http://pkgsrc-wip.cvs.sourceforge.net/viewvc/pkgsrc-wip/wip/erlang/patches/patch-ao?revision=1.2

For sparc: ditto.
There's a cleanup there to remove some dead x86_64 code: that one is Ok.

 > http://pkgsrc-wip.cvs.sourceforge.net/viewvc/pkgsrc-wip/wip/erlang/patches/patch-ap?revision=1.2

For x86 (32-bit): add MAP_FIXED to mmap() call as above. NAK.
There's a similar adjustment wrt MAP_32BIT as in the amd64 patch, but that's
dead code (#ifdef __x86_64__) so it seems unjustified.

I'm amused by the CVS comments about HiPE triggering BSD kernel panics ...

There are other patches in that directory that would seem to range from
obvious (use $(INSTALL_DATA) not $(INSTALL_PROGRAM) for non-executables,
proper ANSI/ISO C in F_PTR/L_PTR typedefs), to reasonable (BSD-specific
snippets for signal handling), to questionable (why do you patch the BEAM
code generator?).

If you want to discuss specific patches, current or future, please post them
(not links to them!) to erlang-patches.


More information about the erlang-patches mailing list