aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/utils
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2016-06-29 11:39:15 +0200
committerBjörn Gustavsson <[email protected]>2016-06-29 11:39:15 +0200
commit04e9514bca9434676f6ee9548febb8d4d1a1a847 (patch)
treeba70a8d9f06c620d0643135a376f22de43e7d8b6 /erts/emulator/utils
parent1e0ef3f2285eae3bd00047c4f10c4a44084e1aa9 (diff)
parentb23b3f903e2cfac2f9b9faac7c7fa19c0ec8f625 (diff)
downloadotp-04e9514bca9434676f6ee9548febb8d4d1a1a847.tar.gz
otp-04e9514bca9434676f6ee9548febb8d4d1a1a847.tar.bz2
otp-04e9514bca9434676f6ee9548febb8d4d1a1a847.zip
Merge branch 'bjorn/gc-bifs'
* bjorn/gc-bifs: compiler: Eliminate num_bif_SUITE erl_internal: Eliminate duplication of guard tests beam_debug: Improve the disassembly of gc_bif instructions Simplify creation of new GC BIFs make_tables: Remove broken automatic BIF aliasing
Diffstat (limited to 'erts/emulator/utils')
-rwxr-xr-xerts/emulator/utils/make_tables53
1 files changed, 31 insertions, 22 deletions
diff --git a/erts/emulator/utils/make_tables b/erts/emulator/utils/make_tables
index c158778f43..fc0500d77f 100755
--- a/erts/emulator/utils/make_tables
+++ b/erts/emulator/utils/make_tables
@@ -36,7 +36,6 @@ use File::Basename;
# <-src>/erl_am.c
# <-src>/erl_bif_table.c
# <-src>/erl_bif_wrap.c
-# <-src>/erl_pbifs.c
# <-include>/erl_atom_table.h
# <-include>/erl_bif_table.h
#
@@ -54,8 +53,7 @@ my %aliases;
my $auto_alias_num = 0;
my @bif;
-my @implementation;
-my @pbif;
+my @bif_type;
while (@ARGV && $ARGV[0] =~ /^-(\w+)/) {
my $opt = shift;
@@ -79,8 +77,11 @@ while (<>) {
my($type, @args) = split;
if ($type eq 'atom') {
save_atoms(@args);
- } elsif ($type eq 'bif' or $type eq 'ubif') {
- my($bif,$alias,$alias2) = (@args);
+ } elsif ($type eq 'bif' or $type eq 'ubif' or $type eq 'gcbif') {
+ if (@args > 2) {
+ error("$type only allows two arguments");
+ }
+ my($bif,$alias) = (@args);
$bif =~ m@^([a-z_.'0-9]+):(.*)/(\d)$@ or error("invalid BIF");
my($mod,$name,$arity) = ($1,$2,$3);
save_atoms($mod, $name);
@@ -94,8 +95,7 @@ while (<>) {
$wrapper = $alias if $type eq 'ubif';
push(@bif, ["am_$atom_alias{$mod}","am_$atom_alias{$name}",$arity,
$alias,$wrapper]);
- push(@pbif, $bif =~ m/^'/ && $alias =~ m/^ebif_/);
- push(@implementation, $alias2);
+ push(@bif_type, $type);
} else {
error("invalid line");
}
@@ -166,8 +166,14 @@ typedef struct bif_entry {
BifFunction traced;
} BifEntry;
+typedef struct erts_gc_bif {
+ BifFunction bif;
+ BifFunction gc_bif;
+} ErtsGcBif;
+
extern BifEntry bif_table[];
extern Export* bif_export[];
+extern const ErtsGcBif erts_gc_bifs[];
#define BIF_SIZE $bif_size
@@ -182,8 +188,12 @@ print "\n";
for ($i = 0; $i < @bif; $i++) {
my $args = join(', ', 'Process*', 'Eterm*');
- print "Eterm $bif[$i]->[3]($args);\n";
- print "Eterm wrap_$bif[$i]->[3]($args, UWord *I);\n";
+ my $name = $bif[$i]->[3];
+ print "Eterm $name($args);\n";
+ print "Eterm wrap_$name($args, UWord *I);\n";
+ print "Eterm erts_gc_$name(Process* p, Eterm* reg, Uint live);\n"
+ if $bif_type[$i] eq 'gcbif';
+ print "\n";
}
print "#endif\n";
@@ -225,27 +235,26 @@ for ($i = 0; $i < @bif; $i++) {
}
#
-# Generate the package bif file.
+# Generate erl_gc_bifs.c.
#
-open_file("$src/erl_pbifs.c");
+open_file("$src/erl_gc_bifs.c");
my $i;
includes("export.h", "sys.h", "erl_vm.h", "global.h", "erl_process.h", "bif.h",
- "erl_bif_table.h", "erl_atom_table.h");
+ "erl_bif_table.h");
+print "const ErtsGcBif erts_gc_bifs[] = {\n";
for ($i = 0; $i < @bif; $i++) {
+ next unless $bif_type[$i] eq 'gcbif';
my $arity = $bif[$i]->[2];
my $func = $bif[$i]->[3];
- my $arg;
- next unless $pbif[$i];
- next unless $func =~ m/^ebif_(.*)/;
- my $orig_func = $1;
- $orig_func = $implementation[$i] if $implementation[$i];
- print "Eterm\n";
- print "$func(Process* p, Eterm* BIF__ARGS)\n";
- print "{\n";
- print " return $orig_func(p, BIF__ARGS);\n";
- print "}\n\n";
+ print " {$func, erts_gc_$func},\n";
}
+print " {0, 0}\n";
+print "};\n";
+
+#
+# Utilities follow.
+#
sub open_file { # or die
my($name) = @_;