aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/utils
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/utils')
-rwxr-xr-xerts/emulator/utils/beam_makeops23
-rwxr-xr-xerts/emulator/utils/gen_git_version6
-rwxr-xr-xerts/emulator/utils/make_compiler_flags87
-rwxr-xr-xerts/emulator/utils/make_driver_tab99
-rwxr-xr-xerts/emulator/utils/make_version6
5 files changed, 204 insertions, 17 deletions
diff --git a/erts/emulator/utils/beam_makeops b/erts/emulator/utils/beam_makeops
index 16a949c2a6..0b7c16f606 100755
--- a/erts/emulator/utils/beam_makeops
+++ b/erts/emulator/utils/beam_makeops
@@ -1202,6 +1202,7 @@ sub parse_transformation {
my($from, $to) = split(/\s*=>\s*/);
my(@op);
+ my $rest_var;
# The source instructions.
@@ -1212,7 +1213,7 @@ sub parse_transformation {
$_ = (&compile_transform_function($name, split(/\s*,\s*/, $arglist)));
} else {
(@op) = split;
- $_ = &compile_transform(1, @op);
+ ($rest_var,$_) = compile_transform(1, $rest_var, @op);
}
}
@@ -1230,7 +1231,7 @@ sub parse_transformation {
@to = split(/\s*\|\s*/, $to);
foreach (@to) {
(@op) = split;
- $_ = &compile_transform(0, @op);
+ (undef,$_) = compile_transform(0, $rest_var, @op);
}
}
push(@transformations, [$., $orig, [@from], [reverse @to]]);
@@ -1243,12 +1244,18 @@ sub compile_transform_function {
}
sub compile_transform {
- my($src, $name, @ops) = @_;
+ my($src, $rest_var, $name, @ops) = @_;
my $arity = 0;
-
+
foreach (@ops) {
my(@list) = &tr_parse_op($src, $_);
- $arity++ unless $list[1] eq '*';
+ if ($list[1] eq '*') {
+ $rest_var = $list[0];
+ } elsif (defined $rest_var and $list[0] eq $rest_var) {
+ $list[1] = '*';
+ } else {
+ $arity++;
+ }
$_ = [ @list ];
}
@@ -1260,7 +1267,7 @@ sub compile_transform {
$is_transformed{$name,$arity} = 1;
}
- [$name,$arity,@ops];
+ ($rest_var,[$name,$arity,@ops]);
}
sub tr_parse_op {
@@ -1681,7 +1688,9 @@ sub tr_gen_to {
foreach $op (@ops) {
my($var, $type, $type_val) = @$op;
- if ($var ne '') {
+ if ($type eq '*') {
+ push(@code, make_op($var, 'store_rest_args', $var{$var}));
+ } elsif ($var ne '') {
&error($where, "variable '$var' unbound")
unless defined $var{$var};
push(@code, &make_op($var, 'store_var_next_arg', $var{$var}));
diff --git a/erts/emulator/utils/gen_git_version b/erts/emulator/utils/gen_git_version
index ef06a4b8e2..9faf015b62 100755
--- a/erts/emulator/utils/gen_git_version
+++ b/erts/emulator/utils/gen_git_version
@@ -5,9 +5,9 @@ OUTPUT_FILE=$1
if command -v git 2>&1 >/dev/null &&
test -d $ERL_TOP/.git -o -f $ERL_TOP/.git
then
- VSN=`git describe --match "OTP_R[0-9][0-9][A-B]*" HEAD`
+ VSN=`git describe --match "OTP-[0-9]*" HEAD`
case "$VSN" in
- OTP_R*-g*)
+ OTP-*-g*)
VSN=`echo $VSN | sed -e 's/.*-g\\(.*\\)/\\1/g'` ;;
*) VSN="na" ;;
esac
@@ -36,4 +36,4 @@ then
fi
exit 0
fi
-exit 1 \ No newline at end of file
+exit 1
diff --git a/erts/emulator/utils/make_compiler_flags b/erts/emulator/utils/make_compiler_flags
new file mode 100755
index 0000000000..cebe8cd0c5
--- /dev/null
+++ b/erts/emulator/utils/make_compiler_flags
@@ -0,0 +1,87 @@
+#!/usr/bin/env perl
+#
+# %CopyrightBegin%
+#
+# Copyright Ericsson AB 1999-2009. All Rights Reserved.
+#
+# The contents of this file are subject to the Erlang Public License,
+# Version 1.1, (the "License"); you may not use this file except in
+# compliance with the License. You should have received a copy of the
+# Erlang Public License along with this software. If not, it can be
+# retrieved online at http://www.erlang.org/.
+#
+# Software distributed under the License is distributed on an "AS IS"
+# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+# the License for the specific language governing rights and limitations
+# under the License.
+#
+# %CopyrightEnd%
+#
+use strict;
+use File::Copy;
+# This program generates global constants that contains
+# config.h, CFLAGS and LDFLAGS
+
+my $file = "";
+my %constants = ();
+my $prev_file = "";
+
+while (@ARGV) {
+ my $d = shift;
+ if ( $d =~ /^-o$/ ) {
+ $file = shift or die("-o requires argument");
+ open FILE, "<$file" or next;
+ $prev_file = do { local $/; <FILE> };
+ close FILE;
+ next;
+ }
+ if ( $d =~ /^-f/ ) {
+ my $var = shift or die("-f requires two argument");
+ my $value = shift or die("-f requires two argument");
+ open FILE, "<$value";
+ $value = do { local $/; <FILE> };
+ close FILE;
+
+ $value =~ s/\n/\\n\\\n/g;
+
+ $constants{$var} = $value;
+ }
+ if ( $d =~ /^-v/ ) {
+ my $var = shift or die("-v requires two argument");
+ my $value = shift;
+ $constants{$var} = $value;
+ }
+}
+
+foreach(keys %constants) {
+ my $value = $constants{$_};
+ $value =~ s/"/\\"/g;
+ $constants{$_} = $value
+}
+
+# Did we want output to a file?
+open(my $oldout, ">&STDOUT") or die "Can't dup STDOUT: $!";
+if ( $file ) {
+ open STDOUT, ">$file.tmp" or die("can't open $file for writing");
+}
+
+my(@prog) = split('/', $0);
+my($prog) = $prog[$#prog];
+print "/* Warning: Do not edit this file.\n";
+print " Auto-generated by '$prog'.*/\n";
+
+foreach(keys %constants) {
+ print "const char* erts_build_flags_$_ = \"$constants{$_}\";\n"
+}
+
+open(STDOUT, ">&", $oldout) or die "Can't dup \$oldout: $!";
+
+open FILE, "<$file.tmp";
+my $new_file = do { local $/; <FILE> };
+close FILE;
+
+if ($new_file ne $prev_file) {
+ move("$file.tmp","$file");
+} else {
+ unlink("$file.tmp");
+}
diff --git a/erts/emulator/utils/make_driver_tab b/erts/emulator/utils/make_driver_tab
index fbbfa3e49e..5c68143d58 100755
--- a/erts/emulator/utils/make_driver_tab
+++ b/erts/emulator/utils/make_driver_tab
@@ -2,7 +2,7 @@
#
# %CopyrightBegin%
#
-# Copyright Ericsson AB 1999-2009. All Rights Reserved.
+# Copyright Ericsson AB 1999-2013. All Rights Reserved.
#
# The contents of this file are subject to the Erlang Public License,
# Version 1.1, (the "License"); you may not use this file except in
@@ -27,7 +27,11 @@ use File::Basename;
# usage: make_driver_tab [-o filename] drivers...
my $file = "";
-my @drivers = ();
+my $nif = "";
+my @emu_drivers = ();
+my @static_drivers = ();
+my @nifs = ();
+my $mode = 1;
while (@ARGV) {
my $d = shift;
@@ -35,9 +39,28 @@ while (@ARGV) {
$file = shift or die("-o requires argument");
next;
}
+ if ( $d =~ /^-nifs$/ ) {
+ $mode = 2;
+ next;
+ }
+ if ( $d =~ /^-drivers$/ ) {
+ $mode = 1;
+ next;
+ }
+ if ( $d =~ /^.*\.a$/ ) {
+ $d = basename $d;
+ $d =~ s/\.a$//; # strip .a
+ if ($mode == 1) {
+ push(@static_drivers, $d);
+ }
+ if ($mode == 2) {
+ push(@nifs, $d);
+ }
+ next;
+ }
$d = basename $d;
$d =~ s/drv(\..*|)$//; # strip drv.* or just drv
- push(@drivers, $d);
+ push(@emu_drivers, $d);
}
# Did we want output to a file?
@@ -52,20 +75,84 @@ print <<EOF;
#include <stdio.h>
#include "global.h"
+
EOF
# "extern" declarations
-foreach (@drivers) {
+foreach (@emu_drivers) {
print "extern ErlDrvEntry ${_}driver_entry;\n";
}
+foreach (@static_drivers) {
+ print "ErlDrvEntry *${_}_driver_init(void);\n";
+}
+
# The array itself
-print "\nErlDrvEntry *driver_tab[DRIVER_TAB_SIZE] =\n{\n";
+print "\nErlDrvEntry *driver_tab[] =\n{\n";
-foreach (@drivers) {
+foreach (@emu_drivers) {
print " &${_}driver_entry,\n";
}
+foreach (@static_drivers) {
+ print " NULL, /* ${_} */\n";
+}
print " NULL\n};\n";
+print "void erts_init_static_drivers() {\n";
+
+my $index = 0;
+foreach (@static_drivers) {
+ print " driver_tab[".(scalar @emu_drivers+$index)."] = ${_}_driver_init();\n";
+ $index++;
+}
+
+print "}\n";
+
+print <<EOF;
+
+typedef struct ErtsStaticNifEntry_ {
+ const char *nif_name;
+ ErtsStaticNifInitFPtr nif_init;
+} ErtsStaticNifEntry;
+
+EOF
+
+# prototypes
+foreach (@nifs) {
+ my $d = ${_};
+ $d =~ s/\.debug//; # strip .debug
+ print "void *".$d."_nif_init(void);\n";
+}
+
+# The array itself
+print "static ErtsStaticNifEntry static_nif_tab[] =\n{\n";
+
+foreach (@nifs) {
+ my $d = ${_};
+ $d =~ s/\.debug//; # strip .debug
+ print "{\"${_}\",&".$d."_nif_init},\n";
+}
+
+print " {NULL,NULL}\n};\n";
+
+print <<EOF;
+ErtsStaticNifInitFPtr erts_static_nif_get_nif_init(const char *name, int len) {
+ ErtsStaticNifEntry* p;
+ for (p = static_nif_tab; p->nif_name != NULL; p++)
+ if (strncmp(p->nif_name, name, len) == 0 && p->nif_name[len] == 0)
+ return p->nif_init;
+ return NULL;
+}
+
+int erts_is_static_nif(void *handle) {
+ ErtsStaticNifEntry* p;
+ for (p = static_nif_tab; p->nif_name != NULL; p++)
+ if (((void*)p->nif_init) == handle)
+ return 1;
+ return 0;
+}
+
+EOF
+
# That's it
diff --git a/erts/emulator/utils/make_version b/erts/emulator/utils/make_version
index 7757fa8138..0ba1c77930 100755
--- a/erts/emulator/utils/make_version
+++ b/erts/emulator/utils/make_version
@@ -39,7 +39,10 @@ if ($ARGV[0] eq '-o') {
}
my $release = shift;
-defined $release or die "No release specified";
+defined $release or die "No otp release specified";
+
+my $otp_version = shift;
+defined $otp_version or die "No otp version specified";
my $version = shift;
defined $version or die "No version name specified";
@@ -53,6 +56,7 @@ open(FILE, ">$outputfile") or die "Can't create $outputfile: $!";
print FILE <<EOF;
/* This file was created by 'make_version' -- don't modify. */
#define ERLANG_OTP_RELEASE "$release"
+#define ERLANG_OTP_VERSION "$otp_version"
#define ERLANG_VERSION "$version"
#define ERLANG_COMPILE_DATE "$time_str"
#define ERLANG_ARCHITECTURE "$architecture"