This is for MinGW ( read below why not MSVC ) Changes: * Configure.pl correctly detect $cpuarch/$osname
* jit2h.pl Accept a new osname parameter search jit/cpuarch/$file-$osname.jit, and if found add ops found there/override ops in $file.jit * Makefile.in add jitosname to the parameters to jit2h.pl * hints/mswin32.pl platform is win32 ( not MSWin32-x86-multi-thread, MSWin32-x86-perl-object, etc ) * include/parrot/file.h #include <windows.h>, otherwise you can't count on HANDLE and LARGE_INTEGER to be magically defined * platforms/win32.h those #pragma are MSVC specific, #ifdef them * jit/i386/core-win32.jit New file ( overrides some print_* and time_n: Win32 does not have syscalls, I think ) * lib/Parrot/Jit/i386-win32.pm likewise MSVC would require an AT&T -> Intel syntax translator, but since it seems we are going to have our own assembler, I don't think it's worth the ( small ) effort. Regards Mattia
diff -u -2 -r1.90 Configure.pl --- Configure.pl 31 Jan 2002 21:46:36 -0000 1.90 +++ Configure.pl 3 Feb 2002 17:39:03 -0000 @@ -10,4 +10,5 @@ use strict; use lib 'lib'; +$File::Find::dont_use_nlink = 1; use Config; @@ -147,4 +148,7 @@ $archname = $Config{archname}; ($cpuarch, $osname) = split('-', $archname); +if( "$cpuarch$osname" =~ m/^mswin32x86$/i ) { + ($cpuarch,$osname) = ('i386', 'win32'); +} if (!defined $osname) { ($osname, $cpuarch) = ($cpuarch, ""); diff -u -2 -r1.129 Makefile.in --- Makefile.in 1 Feb 2002 01:38:28 -0000 1.129 +++ Makefile.in 3 Feb 2002 17:39:05 -0000 @@ -344,5 +344,5 @@ $(INC)/jit_struct.h: jit2h.pl lib/Parrot/OpLib/core.pm lib/Parrot/Jit.pm jit/${jitcpuarch}/core.jit jit/${jitcpuarch}/string.jit - $(PERL) jit2h.pl ${jitcpuarch} > $(INC)/jit_struct.h + $(PERL) jit2h.pl ${jitcpuarch} ${jitosname} > $(INC)/jit_struct.h docs: docs/.dummy diff -u -2 -r1.16 jit2h.pl --- jit2h.pl 30 Jan 2002 23:19:44 -0000 1.16 +++ jit2h.pl 3 Feb 2002 17:39:09 -0000 @@ -16,4 +16,5 @@ my $cpuarch = shift @ARGV; +my $osname = shift @ARGV; # @@ -28,5 +29,6 @@ my ($position, $bytecode, $type, $number, $size, $char, $move, $strflag, $asm, $precompiled); -my (%core_ops, %string, %lib, $arg, $tmp, $which, $argc, $argv, $syscall, $tmp_bytecode, $nargop); +my (%core_ops, %string, %lib, + $arg, $tmp, $which, $argc, $argv, $syscall, $tmp_bytecode, $nargop); my (@values); @@ -61,5 +63,5 @@ } if ($line =~ m/}/) { - $ops{$function} = Parrot::Jit->Assemble($asm); + $ops{$function} = $asm; $function = undef; $body = undef; @@ -70,7 +72,18 @@ } -%core_ops = readjit("jit/$cpuarch/core.jit"); -%string = readjit("jit/$cpuarch/string.jit"); -%lib = readjit("jit/$cpuarch/lib.jit"); +my @files; +foreach my $i ( qw(core string lib) ) { + my %ops = readjit("jit/$cpuarch/$i.jit"); + my %ops_os = readjit("jit/$cpuarch/$i-$osname.jit") + if -e "jit/$cpuarch/$i-$osname.jit"; + @ops{keys %ops_os} = values %ops_os; + foreach my $j ( keys %ops ) { + $ops{$j} = Parrot::Jit->Assemble( $ops{$j} ); + } + push @files, \%ops; +} +%core_ops = %{$files[0]}; +%string = %{$files[1]}; +%lib = %{$files[2]}; my $start = Parrot::Jit->init(); diff -u -2 -r1.9 mswin32.pl --- hints/mswin32.pl 31 Jan 2002 21:46:43 -0000 1.9 +++ hints/mswin32.pl 3 Feb 2002 17:39:10 -0000 @@ -5,4 +5,5 @@ $c{rm_f} = '$(PERL) -MExtUtils::Command -e rm_f'; $c{rm_rf} = '$(PERL) -MExtUtils::Command -e rm_rf'; + $c{platform} = 'win32'; if( $is_msvc ) { diff -u -2 -r1.11 io.h --- include/parrot/io.h 29 Jan 2002 21:47:01 -0000 1.11 +++ include/parrot/io.h 3 Feb 2002 17:39:13 -0000 @@ -98,4 +98,6 @@ #ifdef WIN32 +#define WIN32_LEAN_AND_MEAN +#include <windows.h> typedef HANDLE PIOHANDLE; typedef LARGE_INTEGER PIOOFF_T; diff -u -2 -r1.6 win32.h --- platforms/win32.h 29 Jan 2002 18:39:20 -0000 1.6 +++ platforms/win32.h 3 Feb 2002 17:39:14 -0000 @@ -15,6 +15,8 @@ /* These disable certain Level 4 Warnings */ +#ifdef _MSC_VER #pragma warning( disable: 4100 ) /* disables 'unreferenced formal parameter' warnings */ #pragma warning( disable: 4115 ) /* disables 'named type definition in parentheses' warnings triggered in VC98 include files */ +#endif /* diff -u -2 /dev/null jit/i386/core-win32.jit --- /dev/null Thu Nov 30 16:25:58 2000 +++ jit/i386/core-win32.jit Sun Feb 3 18:02:10 2002 @@ -0,0 +1,30 @@ +; +; core-win32.jit +; +; $Id: $ +; + +Parrot_print_ic { + CALL(Parrot_op,V*CUR_OPCODE[0]V&INTERPRETER[0]) + CALL(fflush, V*CONST_INTVAL[0]) +} + +Parrot_print_i { + CALL(Parrot_op,V*CUR_OPCODE[0]V&INTERPRETER[0]) + CALL(fflush, V*CONST_INTVAL[0]) +} + +Parrot_print_sc { + CALL(Parrot_op,V*CUR_OPCODE[0]V&INTERPRETER[0]) + CALL(fflush, V*CONST_INTVAL[0]) +} + +Parrot_print_s { + CALL(Parrot_op,V*CUR_OPCODE[0]V&INTERPRETER[0]) + CALL(fflush, V*CONST_INTVAL[0]) +} + +Parrot_time_n { + CALL(Parrot_op,V*CUR_OPCODE[0]V&INTERPRETER[0]) + CALL(fflush, V*CONST_INTVAL[0]) +} diff -u -2 /dev/null lib/Parrot/Jit/i386-win32.pm --- /dev/null Thu Nov 30 16:25:58 2000 +++ lib/Parrot/Jit/i386-win32.pm Sun Feb 3 17:56:34 2002 @@ -0,0 +1,34 @@ +# +# Parrot::Jit; +# +# $Id: $ +# + +package Parrot::Jit; + +use base qw(Parrot::Jit::i386Generic); + +# just for MinGW +$OBJDUMP = "objdump -w -d"; +$AS = "as"; + +$OP_ARGUMENT_SIZE = 4; + +$Call_inmediate_arg_size = 5; +$Call_address_arg_size = 6; +$Call_start = 1; +$Call_move = 0; +$Precompiled_call_position = 11; + +$Correct_objdump_output = '$result =~ s/\\x90 $//'; + +#my %syscall_number = ( +# "WRITE" => 4, +# "GETTIMEOFDAY" => 78 +#); + +sub system_call($$$) { + die "Win32 can't do syscalls"; +} + +1;