[svn:parrot] r42030 - in branches/auto_libjit: . config/auto config/auto/frames config/gen/libjit lib/Parrot t/steps/auto

jkeenan at svn.parrot.org jkeenan at svn.parrot.org
Fri Oct 23 01:00:46 UTC 2009


Author: jkeenan
Date: Fri Oct 23 01:00:40 2009
New Revision: 42030
URL: https://trac.parrot.org/parrot/changeset/42030

Log:
Applying config_fixup patch submitted by plobsing++ in https://trac.parrot.org/parrot/ticket/1105.

Deleted:
   branches/auto_libjit/config/auto/frames/test_exec_cygwin_c.in
   branches/auto_libjit/config/auto/frames/test_exec_linux_c.in
   branches/auto_libjit/config/auto/frames/test_exec_openbsd_c.in
Modified:
   branches/auto_libjit/MANIFEST
   branches/auto_libjit/config/auto/frames.pm
   branches/auto_libjit/config/auto/libjit.pm
   branches/auto_libjit/config/gen/libjit/frame_builder_libjit_h.in
   branches/auto_libjit/lib/Parrot/Distribution.pm
   branches/auto_libjit/t/steps/auto/frames-01.t
   branches/auto_libjit/t/steps/auto/libjit-01.t

Modified: branches/auto_libjit/MANIFEST
==============================================================================
--- branches/auto_libjit/MANIFEST	Fri Oct 23 00:46:32 2009	(r42029)
+++ branches/auto_libjit/MANIFEST	Fri Oct 23 01:00:40 2009	(r42030)
@@ -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                                          []

Modified: branches/auto_libjit/config/auto/frames.pm
==============================================================================
--- branches/auto_libjit/config/auto/frames.pm	Fri Oct 23 00:46:32 2009	(r42029)
+++ branches/auto_libjit/config/auto/frames.pm	Fri Oct 23 01:00:40 2009	(r42030)
@@ -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;

Deleted: branches/auto_libjit/config/auto/frames/test_exec_cygwin_c.in
==============================================================================
--- branches/auto_libjit/config/auto/frames/test_exec_cygwin_c.in	Fri Oct 23 01:00:40 2009	(r42029)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,76 +0,0 @@
-/*
-Copyright (C) 2008-2009, Parrot Foundation.
-$Id$
-
-test for exec privs
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <limits.h>
-#include <errno.h>
-#include <malloc.h>
-#include <unistd.h>
-#include <string.h>
-#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:
- */

Deleted: branches/auto_libjit/config/auto/frames/test_exec_linux_c.in
==============================================================================
--- branches/auto_libjit/config/auto/frames/test_exec_linux_c.in	Fri Oct 23 01:00:40 2009	(r42029)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,71 +0,0 @@
-/*
-Copyright (C) 2004-2009, Parrot Foundation.
-$Id$
-
-test for exec privs
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <limits.h>
-#include <errno.h>
-#include <malloc.h>
-#include <unistd.h>
-#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:
- */

Deleted: branches/auto_libjit/config/auto/frames/test_exec_openbsd_c.in
==============================================================================
--- branches/auto_libjit/config/auto/frames/test_exec_openbsd_c.in	Fri Oct 23 01:00:40 2009	(r42029)
+++ /dev/null	00:00:00 1970	(deleted)
@@ -1,71 +0,0 @@
-/*
-Copyright (C) 2004-2009, Parrot Foundation.
-$Id$
-
-test for exec privs
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <limits.h>
-#include <errno.h>
-#include <malloc.h>
-#include <unistd.h>
-#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:
- */

Modified: branches/auto_libjit/config/auto/libjit.pm
==============================================================================
--- branches/auto_libjit/config/auto/libjit.pm	Fri Oct 23 00:46:32 2009	(r42029)
+++ branches/auto_libjit/config/auto/libjit.pm	Fri Oct 23 01:00:40 2009	(r42030)
@@ -101,8 +101,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 );

Modified: branches/auto_libjit/config/gen/libjit/frame_builder_libjit_h.in
==============================================================================
--- branches/auto_libjit/config/gen/libjit/frame_builder_libjit_h.in	Fri Oct 23 00:46:32 2009	(r42029)
+++ branches/auto_libjit/config/gen/libjit/frame_builder_libjit_h.in	Fri Oct 23 01:00:40 2009	(r42030)
@@ -19,7 +19,7 @@
 
 #ifdef PARROT_HAS_LIBJIT
 
-#include <jit/jit.h>
+#  include <jit/jit.h>
 
 /*
  * 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

Modified: branches/auto_libjit/lib/Parrot/Distribution.pm
==============================================================================
--- branches/auto_libjit/lib/Parrot/Distribution.pm	Fri Oct 23 00:46:32 2009	(r42029)
+++ branches/auto_libjit/lib/Parrot/Distribution.pm	Fri Oct 23 01:00:40 2009	(r42030)
@@ -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;

Modified: branches/auto_libjit/t/steps/auto/frames-01.t
==============================================================================
--- branches/auto_libjit/t/steps/auto/frames-01.t	Fri Oct 23 00:46:32 2009	(r42029)
+++ branches/auto_libjit/t/steps/auto/frames-01.t	Fri Oct 23 01:00:40 2009	(r42030)
@@ -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");
 

Modified: branches/auto_libjit/t/steps/auto/libjit-01.t
==============================================================================
--- branches/auto_libjit/t/steps/auto/libjit-01.t	Fri Oct 23 00:46:32 2009	(r42029)
+++ branches/auto_libjit/t/steps/auto/libjit-01.t	Fri Oct 23 01:00:40 2009	(r42030)
@@ -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' ), "",


More information about the parrot-commits mailing list