Hopefully in time to make the feature freeze, here's an effort at solving this 
problem.  I went through the platform .c and .h files and broke out the redundant bits 
into the following "modules", which were already delimited by comments in generic.*:

        dl: dynamic library loading
        env: environment twiddling
        exec: system()
        io: I/O
        itimer: system timers
        memalign: memory alignment
        memexec: executable memory protection
        signal: signal handling
        threads: pthreads interface
        time: time() and get

I've removed the .c and .h files from platform/ and created per-platform 
subdirectories there.  generic/ has the pieces split out from generic.c and generic.h, 
openbsd/ has those from openbsd.c, etc.  Those pieces which were just copied from 
generic.* are now gone, instead relying on platform.pl to fall back to generic/ code 
when platform-specific versions aren't needed.  This eliminates a fair bit of 
duplication.

I also made changes to conditionally assemble and link a .s file into parrot when 
requested in the hints file; at least the AIX and IA64 targets have need of this.  A 
remade patch to fix JIT on the former will follow provided there are no objections to 
this one.

Attached patch is tested on Linux, AIX, and OpenBSD.  It does twiddle the order of 
includes and declarations, so there might still be problems.  Testing very much 
requested, most especially on Darwin and Win32.

Adam

> -----Original Message-----
> From: Dan Sugalski (via RT) 
> [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 23, 2004 6:44 AM
> To: [EMAIL PROTECTED]
> Subject: [perl #25239] Platform-specific files not granular enough 
> 
> 
> # New Ticket Created by  Dan Sugalski 
> # Please include the string:  [perl #25239]
> # in the subject line of all future correspondence about this issue. 
> # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=25239 >
> 
> 
> We've got per-platform .c and .h files that get loaded in by 
> configure.pl, which is good as far as it goes, but it isn't granular 
> enough to be a viable long-term solution.
> 
> What we need to do is split this up into modules, with each platform 
> choosing which modules to build into the platform-specific source 
> file. This will also allow us to provide a default set of modules for 
> those cases where the platform doesn't want to override, and we don't 
> want to have to cut and paste the code into a dozen different files.
> -- 
>                                          Dan
> 
> --------------------------------------"it's like 
> this"-------------------
> Dan Sugalski                          even samurai
> [EMAIL PROTECTED]                         have teddy bears and even
>                                        teddy bears get drunk
> 

Attachment: platform.patch
Description: platform.patch

Reply via email to