Index: MANIFEST =================================================================== --- MANIFEST (revision 42013) +++ MANIFEST (working copy) @@ -1,7 +1,7 @@ # ex: set ro: # $Id$ # -# generated by tools/dev/mk_manifest_and_skip.pl Sat Oct 17 13:02:10 2009 UT +# generated by tools/dev/mk_manifest_and_skip.pl Thu Oct 22 02:09:46 2009 UT # # See below for documentation on the format of this file. # @@ -233,9 +233,6 @@ config/auto/env/test_unsetenv_c.in [] config/auto/format.pm [] config/auto/frames.pm [] -config/auto/frames/test_exec_cygwin_c.in [] -config/auto/frames/test_exec_linux_c.in [] -config/auto/frames/test_exec_openbsd_c.in [] config/auto/gc.pm [] config/auto/gc/test_c.in [] config/auto/gcc.pm [] Index: lib/Parrot/Distribution.pm =================================================================== --- lib/Parrot/Distribution.pm (revision 42013) +++ lib/Parrot/Distribution.pm (working copy) @@ -433,6 +433,8 @@ include/parrot/config.h include/parrot/has_header.h src/gc/malloc.c + src/frame_builder_libjit.h + src/frame_builder_libjit.c } unless @exemptions; my $path = -f $file ? $file : $file->path; Index: t/steps/auto/libjit-01.t =================================================================== --- t/steps/auto/libjit-01.t (revision 42013) +++ t/steps/auto/libjit-01.t (working copy) @@ -6,7 +6,7 @@ use strict; use warnings; -use Test::More tests => 40; +use Test::More tests => 34; use lib qw( lib t/configure/testlib ); use Parrot::Configure; use Parrot::Configure::Options 'process_options'; @@ -105,8 +105,6 @@ my $extra_libs; -$conf->data->set( 'cc_build_call_frames' => undef ); -$conf->data->set( 'has_exec_protect' => undef ); $conf->data->set( 'libjit_has_alloca' => undef ); $conf->data->set( 'libs' => '' ); @@ -115,16 +113,11 @@ $conf->data->set( 'cpuarch' => 'i386' ); auto::libjit::_handle_has_libjit($conf, $has_libjit, $extra_libs); -is( $conf->data->get( 'cc_build_call_frames' ), '-DCAN_BUILD_CALL_FRAMES', - "Got expected value for cc_build_call_frames" ); -ok( $conf->data->get( 'has_exec_protect' ), "has_exec_protect' set" ); ok( $conf->data->get( 'libjit_has_alloca'), "on i386 with libJIT, 'libjit_has_alloca' has true value" ); is( $conf->data->get( 'libs' ), " $extra_libs", "Got expected value for libs" ); -$conf->data->set( 'cc_build_call_frames' => undef ); -$conf->data->set( 'has_exec_protect' => undef ); $conf->data->set( 'libjit_has_alloca' => undef ); $conf->data->set( 'libs' => '' ); @@ -133,16 +126,11 @@ $conf->data->set( 'cpuarch' => 'ppc' ); auto::libjit::_handle_has_libjit($conf, $has_libjit, $extra_libs); -is( $conf->data->get( 'cc_build_call_frames' ), '-DCAN_BUILD_CALL_FRAMES', - "Got expected value for cc_build_call_frames" ); -ok( $conf->data->get( 'has_exec_protect' ), "has_exec_protect' set" ); ok( ! $conf->data->get( 'libjit_has_alloca'), "on non-i386 with libJIT, 'libjit_has_alloca' has false value" ); is( $conf->data->get( 'libs' ), " $extra_libs", "Got expected value for libs" ); -$conf->data->set( 'cc_build_call_frames' => undef ); -$conf->data->set( 'has_exec_protect' => undef ); $conf->data->set( 'libjit_has_alloca' => undef ); $conf->data->set( 'libs' => '' ); @@ -150,10 +138,6 @@ $extra_libs = 'mylibs'; auto::libjit::_handle_has_libjit($conf, $has_libjit, $extra_libs); -ok( ! defined($conf->data->get( 'cc_build_call_frames' )), - "cc_build_call_frames undefined as expected" ); -ok( ! defined($conf->data->get( 'has_exec_protect' )), - "has_exec_protect' undefined" ); ok( ! $conf->data->get( 'libjit_has_alloca'), "without libJIT, 'libjit_has_alloca' has false value" ); is( $conf->data->get( 'libs' ), "", Index: t/steps/auto/frames-01.t =================================================================== --- t/steps/auto/frames-01.t (revision 42013) +++ t/steps/auto/frames-01.t (working copy) @@ -84,10 +84,6 @@ ##### _handle_call_frames_buildable() ##### -#$conf->data->set( nvsize => 8 ); -#$conf->data->set( cpuarch => 'i386' ); -$conf->data->set( osname => 'linux' ); - my $rv; $can_build_call_frames = 0; @@ -103,19 +99,16 @@ $conf->data->set( 'has_exec_protect' => undef ); $can_build_call_frames = 1; -my $realos = $conf->data->get( 'osname' ); -$conf->data->set( 'osname' => 'foobar' ); $rv = $step->_handle_can_build_call_frames( $conf, $can_build_call_frames ); ok( $rv, "_handle_can_build_call_frames() returned true value" ); is( $conf->data->get( 'cc_build_call_frames'), '-DCAN_BUILD_CALL_FRAMES', "cc_build_call_frames set to expected value" ); -is( $conf->data->get( 'has_exec_protect' ), 0, - "has_exec_protect is 0, as expected" ); +is( $conf->data->get( 'has_exec_protect' ), 1, + "has_exec_protect is 1, as expected" ); is( $step->result(), 'yes', "Result is 'yes', as expected" ); $conf->data->set( 'cc_build_call_frames' => undef ); $conf->data->set( 'has_exec_protect' => undef ); -$conf->data->set( 'osname' => $realos ); pass("Completed all tests in $0"); Index: config/auto/libjit.pm =================================================================== --- config/auto/libjit.pm (revision 42013) +++ config/auto/libjit.pm (working copy) @@ -93,8 +93,6 @@ my ($conf, $has_libjit, $extra_libs) = @_; if ($has_libjit) { $conf->data->set( - cc_build_call_frames => '-DCAN_BUILD_CALL_FRAMES', - has_exec_protect => 1, libjit_has_alloca => ($conf->data->get('cpuarch') eq 'i386' ? '1' : '0'), ); $conf->data->add( ' ', libs => $extra_libs ); Index: config/auto/frames.pm =================================================================== --- config/auto/frames.pm (revision 42013) +++ config/auto/frames.pm (working copy) @@ -55,36 +55,13 @@ my ($self, $conf, $can_build_call_frames) = @_; if ( $can_build_call_frames ) { $conf->data->set( - cc_build_call_frames => '-DCAN_BUILD_CALL_FRAMES', + cc_build_call_frames => '-DCAN_BUILD_CALL_FRAMES', + has_exec_protect => 1, ); - # test for executable malloced memory - my $osname = $conf->data->get( 'osname' ); - if ( -e "config/auto/frames/test_exec_${osname}_c.in" ) { - $conf->cc_gen("config/auto/frames/test_exec_${osname}_c.in"); - eval { $conf->cc_build(); }; - if ($@) { - $conf->data->set( has_exec_protect => 0 ); - } - else { - my $exec_protect_test = ( - $conf->cc_run(0) !~ /ok/ && $conf->cc_run(1) =~ /ok/ - ); - if ($exec_protect_test) { - $conf->data->set( has_exec_protect => 1 ); - } - else { - $conf->data->set( has_exec_protect => 0 ); - } - } - $conf->cc_clean(); - } - else { - $conf->data->set( has_exec_protect => 0 ); - } $self->set_result( 'yes' ); } else { - $conf->data->set( cc_build_call_frames => ''); + $conf->data->set(cc_build_call_frames => ''); $self->set_result( 'no' ); } return 1; Index: config/auto/frames/test_exec_openbsd_c.in =================================================================== --- config/auto/frames/test_exec_openbsd_c.in (revision 42013) +++ config/auto/frames/test_exec_openbsd_c.in (working copy) @@ -1,71 +0,0 @@ -/* -Copyright (C) 2004-2009, Parrot Foundation. -$Id$ - -test for exec privs -*/ - -#include -#include -#include -#include -#include -#include -#include -#ifndef PAGE_SIZE -# define PAGE_SIZE sysconf(_SC_PAGESIZE) -#endif - -/* - * c equiv: - int t() { - return 1; -} -*/ - -char code[] = { - 0xB8, 0x01, 0, 0, 0, /* movl $1, %eax */ - 0xC3 /* ret */ -}; - -typedef int (*pf)(void); - -int -main(int argc, char *argv[]) -{ - pf t; - char *p; - int rc; - int prot = PROT_READ; - - if (argc != 2) { - fprintf(stderr, "usage: test 0 | 1\n"); - exit(1); - } - if (atoi(argv[1])) - prot |= PROT_EXEC; - - p = malloc(PAGE_SIZE); - memcpy(p, code, sizeof (code)); - t = (pf) p; - rc = mprotect(p, PAGE_SIZE, prot); - if (rc) { - fprintf(stderr, "p = %p PAGE_SIZE = %d (0x%x)\n", p, - PAGE_SIZE, PAGE_SIZE); - perror("failure"); - } - - if (t() == 1) - puts("ok"); - else - return 1; - - return 0; -} - -/* - * Local variables: - * c-file-style: "parrot" - * End: - * vim: expandtab shiftwidth=4: - */ Index: config/auto/frames/test_exec_linux_c.in =================================================================== --- config/auto/frames/test_exec_linux_c.in (revision 42013) +++ config/auto/frames/test_exec_linux_c.in (working copy) @@ -1,71 +0,0 @@ -/* -Copyright (C) 2004-2009, Parrot Foundation. -$Id$ - -test for exec privs - */ - -#include -#include -#include -#include -#include -#include -#include -#ifndef PAGE_SIZE -# define PAGE_SIZE getpagesize() -#endif - -/* - * c equiv: - int t() { - return 1; -} -*/ - -char code[] = { - 0xB8, 0x01, 0, 0, 0, /* movl $1, %eax */ - 0xC3 /* ret */ -}; - -typedef int (*pf)(void); - -int -main(int argc, char *argv[]) -{ - pf t; - char *p; - int rc; - int prot = PROT_READ; - - if (argc != 2) { - fprintf(stderr, "usage: test 0 | 1\n"); - exit(1); - } - if (atoi(argv[1])) - prot |= PROT_EXEC; - - p = memalign(PAGE_SIZE, sizeof (code)); - memcpy(p, code, sizeof (code)); - t = (pf) p; - rc = mprotect(p, PAGE_SIZE, prot); - if (rc) { - fprintf(stderr, "p = %p PAGE_SIZE = %d (0x%x)\n", p, - PAGE_SIZE, PAGE_SIZE); - perror("failure"); - } - - if (t() == 1) - puts("ok"); - else - return 1; - - return 0; -} - -/* - * Local variables: - * c-file-style: "parrot" - * End: - * vim: expandtab shiftwidth=4: - */ Index: config/auto/frames/test_exec_cygwin_c.in =================================================================== --- config/auto/frames/test_exec_cygwin_c.in (revision 42013) +++ config/auto/frames/test_exec_cygwin_c.in (working copy) @@ -1,76 +0,0 @@ -/* -Copyright (C) 2008-2009, Parrot Foundation. -$Id$ - -test for exec privs -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef PAGE_SIZE -# define PAGE_SIZE getpagesize() -#endif -# - -/* - * c equiv: - int t() { - return 1; -} -*/ - -char code[] = { - 0xB8, 0x01, 0, 0, 0, /* movl $1, %eax */ - 0xC3 /* ret */ -}; - -typedef int (*pf)(void); - -int -main(int argc, char *argv[]) -{ - pf t; - char *p; - int rc; - int prot = PROT_READ; - - if (argc != 2) { - fprintf(stderr, "usage: test 0 | 1\n"); - exit(1); - } - - if (atoi(argv[1])) - prot |= PROT_EXEC; - - p = memalign(PAGE_SIZE, PAGE_SIZE); - memcpy(p, code, sizeof (code)); - - t = (pf) p; - rc = mprotect(p, PAGE_SIZE, prot); - - if (rc) { - fprintf(stderr, "p = %p PAGE_SIZE = %d (0x%x)\n", p, - PAGE_SIZE, PAGE_SIZE); - perror("failure"); - } - - if (t() == 1) - puts("ok"); - else - return 1; - - return 0; -} - -/* - * Local variables: - * c-file-style: "parrot" - * End: - * vim: expandtab shiftwidth=4: - */ Index: config/gen/libjit/frame_builder_libjit_h.in =================================================================== --- config/gen/libjit/frame_builder_libjit_h.in (revision 42013) +++ config/gen/libjit/frame_builder_libjit_h.in (working copy) @@ -19,7 +19,7 @@ #ifdef PARROT_HAS_LIBJIT -#include +# include /* * JITted function state data @@ -33,9 +33,9 @@ * JIT types */ -#define JIT_TYPE_UINTVAL @libjit_uv@ -#define JIT_TYPE_INTVAL @libjit_iv@ -#define JIT_TYPE_FLOATVAL @libjit_nv@ +# define JIT_TYPE_UINTVAL @libjit_uv@ +# define JIT_TYPE_INTVAL @libjit_iv@ +# define JIT_TYPE_FLOATVAL @libjit_nv@ /* * JIT functions @@ -63,13 +63,13 @@ /* * workaround for platforms that lack libjit alloca support */ -#if @libjit_has_alloca@ -# define JIT_ALLOCA(f, n) jit_insn_alloca(f, n) -# define JIT_ALLOCA_FREE(f, p) -#else -# define JIT_ALLOCA(f, n) jit__mem_sys_allocate(f, n) -# define JIT_ALLOCA_FREE(f, p) jit__mem_sys_free(f, p) -#endif +# if @libjit_has_alloca@ +# define JIT_ALLOCA(f, n) jit_insn_alloca((f), (n)) +# define JIT_ALLOCA_FREE(f, p) +# else +# define JIT_ALLOCA(f, n) jit__mem_sys_allocate((f), (n)) +# define JIT_ALLOCA_FREE(f, p) jit__mem_sys_free((f), (p)) +# endif /* * JIT wrappers