Permalink
Browse files

Merge branch 'master' into threads

Fixed conflicts:
	src/pmc/scheduler.pmc
  • Loading branch information...
2 parents c415f17 + d220be7 commit 3b76818a6a4852726519acb66dad45b5d2c066fe Reini Urban committed Sep 27, 2012
View
@@ -1,22 +1,29 @@
2012-10-16 release 4.9.0
- Core
- + Keep encoding information in the imcc optimizer, which fixes the
- concat op but probably many more cases with non-ascii encoded
- constant strings. [GH #837]
- + Fixed ByteBuffer set_string_native, which became out of sync with
- two internal buffers. [GH #835]
- + Preload Configure steps when called with perl -d Configure.pl
- + Strip unneeded config keys from installed config hash. Saves 6360
- bytes from every installed executable.
+ + Keep encoding information in the imcc optimizer, which fixes the
+ concat op but probably many more cases with non-ascii encoded
+ constant strings. [GH #837]
+ + Fixed ByteBuffer set_string_native, which became out of sync with
+ two internal buffers. [GH #835]
+ + Preload Configure steps when called with perl -d Configure.pl [GH #833]
+ + Strip unneeded config keys from installed config hash. Saves 6360
+ bytes from every installed executable. [GH #824]
+ + Parrot_get_cpu_type returns now "unknown" for all unknown cpu types.
+ On non-windows it returned before 4.9.0 a null string. [GH #846]
- Build
- + Improved warnings for clang.
+ + Improved warnings for clang. [GH #843]
+ + Cleaned wrong UNUSED(arg) macros in all pmc's due to an improved
+ pmc2c compiler, which SHIMs all UNUSED args. [GH #836]
+ + Added clang++ support and a new auto::alignof Configure step. [GH #844]
- Branches
+ The threads branch is almost ready to be merged. Some remaining races
- have been fixed. There are only some remaining platforms errors on
- darwin/x86.
+ have been fixed. There are only some remaining platforms errors on
+ darwin/x86.
- Libraries
- + Fixed Mime/Base64 encode_base64. Split long lines at 76 chars [GH #826]
+ + Fixed Mime/Base64 encode_base64. Split long lines at 76 chars. [GH #826]
- Documentation
+ + Cleaned up removed parrot cmdline options -D/-O/-v from --help output and
+ running.pod [GH #838]
- Tests
- Community
View
@@ -120,6 +120,8 @@ compilers/tge/TGE/Tree.pir [tge]
compilers/tge/tgc.pir [tge]
config/README.pod []doc
config/auto/arch.pm []
+config/auto/alignof.pm []
+config/auto/alignof/test_c.in []
config/auto/attributes.pm []
config/auto/attributes/test_c.in []
config/auto/backtrace.pm []
View
@@ -0,0 +1,123 @@
+# Copyright (C) 2012, Parrot Foundation.
+
+=head1 NAME
+
+config/auto/alignof.pm - clang++ offsetof values
+
+=head1 DESCRIPTION
+
+Determines the offsetof() values of our types, if the compiler cannot do compile-time ALIGNOF
+definitions via offsetof(). clang++ or strict C++ compilers need this step, to calculate these
+pre-compiled PARROT_ALIGNOF_* definitions.
+
+=cut
+
+package auto::alignof;
+
+use strict;
+use warnings;
+
+use base qw(Parrot::Configure::Step);
+
+use Parrot::Configure::Utils ':auto';
+
+sub _init {
+ my $self = shift;
+ my %data;
+ $data{description} = q{Determine offsetof values for our types};
+ $data{result} = q{};
+ return \%data;
+}
+
+sub runstep {
+ my ( $self, $conf ) = @_;
+
+ # This step only needed for clang++
+ if (test_if_needed($conf)) {
+ # Can do compile-time ALIGNOF definitions via offsetof()
+ $conf->data->set( 'HAS_COMPILER_OFFSETOF_ALIGNOF' => 1 );
+ $conf->debug("DEBUG: auto::alignof is only needed for clang++\n");
+ $self->set_result('skipped');
+ return 1;
+ }
+ # Need pre-compiled PARROT_ALIGNOF_* definitions
+ $conf->data->set( 'HAS_COMPILER_OFFSETOF_ALIGNOF' => 0 );
+
+ my %types = (
+ intval => $conf->data->get('iv'),
+ floatval => $conf->data->get('nv'),
+ stringptr => 'STRING *',
+ pmcptr => 'PMC *',
+ char => 'char',
+ short => 'short',
+ int => 'int',
+ long => 'long',
+ uchar => 'unsigned char',
+ ushort => 'unsigned short',
+ uint => 'unsigned int',
+ ulong => 'unsigned long',
+ float => 'float',
+ double => 'double',
+ longdouble => 'long double',
+ Parrot_Int1 => 'char',
+ Parrot_Int2 => 'short',
+ Parrot_Int4 => 'int',
+ Parrot_Int8 => 'long long',
+ charptr => 'char *',
+ voidptr => 'void *',
+ funcptr_t => 'funcptr_t',
+
+ longlong => 'long long',
+ ulonglong => 'unsigned long long',
+ __float128 => '__float128',
+ );
+
+ my $alignof = '';
+ for my $name (keys %types) {
+ my $type = $types{$name};
+ my $value = test_alignof($conf, $name, $type);
+ $alignof .= ' '.$name;
+ if ($value) {
+ $conf->data->set( 'PARROT_ALIGNOF_'.$name => $value );
+ }
+ }
+ $conf->data->set( 'alignof' => $alignof );
+
+ return 1;
+}
+
+#################### INTERNAL SUBROUTINES ####################
+
+sub test_if_needed {
+ my ($conf) = @_;
+
+ my ($cc_inc, $ccflags) = $conf->data->get( 'cc_inc', 'ccflags' );
+ $conf->cc_gen('config/auto/alignof/test_c.in');
+ eval { $conf->cc_build("$cc_inc -DCHECK_COMPILER_OFFSETOF_ALIGNOF") };
+ my $ret = $@ ? 0 : eval $conf->cc_run();
+ $conf->cc_clean();
+
+ return $ret;
+}
+
+sub test_alignof {
+ my ($conf, $name, $type) = @_;
+
+ $conf->data->set( TEMP_type => $type );
+ my ($cc_inc, $ccflags) = $conf->data->get( 'cc_inc', 'ccflags' );
+ $conf->cc_gen('config/auto/alignof/test_c.in');
+ eval { $conf->cc_build("$cc_inc -x c++") };
+ my $ret = $@ ? 0 : eval $conf->cc_run();
+ $conf->cc_clean();
+
+ return $ret;
+}
+
+1;
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
@@ -0,0 +1,75 @@
+/*
+Copyright (C) 2012, Parrot Foundation.
+
+figure out some Configure settings
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stddef.h>
+
+/* from parrot/parrot.h:
+ * some SGI compilers have an offsetof()
+ * definition that doesn't work for us. */
+#if defined(__sgi) && defined(_COMPILER_VERSION) && (_COMPILER_VERSION >= 400)
+# undef offsetof
+# define offsetof(s, m) (size_t)(&((((s) *)0)->(m)))
+#endif
+
+struct PMC {
+ unsigned int flags;
+ void *vtable;
+ void *data;
+ struct PMC *_metadata;
+};
+struct parrot_string_t {
+ unsigned int flags;
+ void * _bufstart;
+ size_t _buflen;
+ char *strstart;
+ unsigned int bufused;
+ unsigned int strlen;
+ unsigned int hashval;
+ const struct PMC *encoding;
+};
+typedef struct PMC PMC;
+typedef struct parrot_string_t STRING;
+typedef void (*funcptr_t)(void);
+
+#define ALIGNOF(x) offsetof(struct {char c; x d;}, d)
+
+#ifdef CHECK_COMPILER_OFFSETOF_ALIGNOF
+
+/* as used in parrot/datatypes.h */
+struct _test {
+ const char *name;
+ size_t align;
+};
+extern const struct _test test[];
+const struct _test test[] = {
+ { "int", ALIGNOF(int) }
+};
+
+#else
+
+typedef struct mystruct {char c; @TEMP_type@ d;} mystruct_t;
+
+#endif
+
+int
+main(int argc, char **argv)
+{
+#ifdef CHECK_COMPILER_OFFSETOF_ALIGNOF
+ printf("%u\n", (unsigned)test[0].align);
+#else
+ printf("%u\n", (unsigned)offsetof(mystruct_t, d));
+#endif
+ return EXIT_SUCCESS;
+}
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
+ */
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2010, Parrot Foundation.
+# Copyright (C) 2007-2012, Parrot Foundation.
=head1 NAME
@@ -63,7 +63,7 @@ sub try_attr {
$conf->debug("trying attribute '$attr'\n");
- my $cc = $conf->option_or_data('cc');
+ my $cc = $conf->data->get('cc');
$conf->cc_gen('config/auto/attributes/test_c.in');
my $disable_warnings = '';
View
@@ -1,4 +1,4 @@
-# Copyright (C) 2001-2007, Parrot Foundation.
+# Copyright (C) 2001-2012, Parrot Foundation.
=head1 NAME
@@ -88,11 +88,17 @@ sub _evaluate_gcc {
$conf->data->set( noinline => '__attribute__ ((noinline))' );
# sneaky check for g++
- my $gpp = (index($conf->data->get('cc'), '++') > 0) ? 1 : 0;
+ my $cc = $conf->data->get('cc');
+ my $gpp = (index($cc, '++') > 0) ? 1 : 0;
# even sneakier check for clang
my $clang = $conf->data->get('cc') =~ /clang/ ? 1 : 0;
+ # and set -x c++ for clang++
+ if ($clang and $gpp and index($cc, '-x c++') < 1) {
+ $conf->data->set('cc' => $cc.' -x c++');
+ }
+
$conf->data->set(
gccversion => $gccversion,
'g++' => $gpp,
View
@@ -70,10 +70,13 @@ us ensure that files we know are clean for a new warning stay clean.
'todo' functions just like never does, but it indicates that these
files are expected to eventually be free of this warning.
+'override' adds warnings to the end, to override previous warnings enabled
+by -Wall or -Wextra for example.
+
Note that there is no actual requirement that the 'file' be a full path
to a .c file; the file could be "PMCS" or "OPS" or some other identifier;
whatever the value, it will generate a Config entry prefixed with
-C<ccwarn::>, which will probably be used via @@ expansion in a makefile.
+C<ccwarn::>, which will be used via @@ expansion in a makefile.
It is tempting to put this into a config file, but having it in
perl gives us the ability to dynamically setup certain warnings based
@@ -325,9 +328,7 @@ sub runstep {
'-fvisibility=hidden';
};
if ($conf->data->get('clang') and $compiler eq 'g++') { # clang++
- unshift @{$self->{'warnings'}{$compiler}{'basic'}},
- '-x c++';
- $self->{'warnings'}{$compiler}{'override'} = {
+ $self->{'warnings'}{'g++'}{'override'} = {
'-Wno-parentheses-equality' => [ qw(
src/ops/core_ops.c
) ],
@@ -372,7 +373,7 @@ sub runstep {
if (exists $self->{'warnings'}{$compiler}{override}) {
my %add = %{$self->{'warnings'}{$compiler}{override}};
foreach my $warning (keys %add) {
- if ($self->valid_warning($conf, $warning)) {
+ if ($self->valid_warning($conf, $warning)) {
foreach my $file (@{$add{$warning}}) {
$per_file{$file} = exists $per_file{$file}
? [ @{$per_file{$file}}, $warning ] : [ @warnings, $warning ];
@@ -414,7 +415,7 @@ sub valid_warning {
$conf->debug("trying attribute '$warning'\n");
- my $cc = $conf->option_or_data('cc');
+ my $cc = $conf->data->get('cc');
$conf->cc_gen('config/auto/warnings/test_c.in');
my $ccflags = $conf->data->get('ccflags');
@@ -175,6 +175,60 @@ END_PRINT
print OUT <<'END_PRINT';
+/* from config/auto/alignof */
+END_PRINT
+my $alignof = @alignof@ || '';
+if ($alignof) {
+ # The other case is handled by parrot/has_header.h
+ print OUT <<'END_PRINT';
+/* Need pre-compiled PARROT_ALIGNOF_* definitions */
+#undef PARROT_HAS_COMPILER_OFFSETOF_ALIGNOF
+END_PRINT
+}
+
+for my $name (split / /,$alignof) {
+ my $value = $conf->data->get("PARROT_ALIGNOF_".$name);
+ if ($name and $value) {
+ print OUT <<"END_PRINT";
+#define PARROT_ALIGNOF_$name $value
+END_PRINT
+ }
+}
+for my $name (split / /,$alignof) {
+ my $value = $conf->data->get("PARROT_ALIGNOF_".$name);
+ if ($name and !$value) {
+ if ($name eq 'intval') {
+ $value = "PARROT_ALIGNOF_".$conf->data->get('iv');
+ }
+ elsif ($name eq 'floatval') {
+ $value = "PARROT_ALIGNOF_".$conf->data->get('nv');
+ }
+ elsif ($name =~ /ptr(|_t)$/) {
+ $value = "PARROT_ALIGNOF_charptr";
+ }
+ elsif ($name =~ /^Parrot_Int1$/) {
+ $value = "PARROT_ALIGNOF_char";
+ }
+ elsif ($name =~ /^Parrot_Int2$/) {
+ $value = "PARROT_ALIGNOF_short";
+ }
+ elsif ($name =~ /^Parrot_Int4$/) {
+ $value = "PARROT_ALIGNOF_int";
+ }
+ elsif ($name =~ /^Parrot_Int8$/ and $conf->data->get('HAS_LONGLONG')) {
+ $value = "PARROT_ALIGNOF_long";
+ }
+ else {
+ $value = 0;
+ }
+ print OUT <<"END_PRINT";
+#define PARROT_ALIGNOF_$name $value
+END_PRINT
+ }
+}
+
+print OUT <<'END_PRINT';
+
#endif /* PARROT_FEATURE_H_GUARD */
END_PRINT
Oops, something went wrong.

0 comments on commit 3b76818

Please sign in to comment.