diff options
author | Björn Gustavsson <[email protected]> | 2016-06-20 13:02:59 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2016-06-22 13:06:56 +0200 |
commit | f0f4e72c8ec5c08993ff84d4eac5c48897a09657 (patch) | |
tree | bcf5e888317eb4b274d6cf3fa3a4e411173fa160 /erts/emulator/beam/beam_emu.c | |
parent | 09b73b39dde3f2c8924947fc5512281b83c939ca (diff) | |
download | otp-f0f4e72c8ec5c08993ff84d4eac5c48897a09657.tar.gz otp-f0f4e72c8ec5c08993ff84d4eac5c48897a09657.tar.bz2 otp-f0f4e72c8ec5c08993ff84d4eac5c48897a09657.zip |
Simplify creation of new GC BIFs
Add the BIF type "gcbif" in bif.tab for defining GC BIFs. That will
eliminate some of the hand-written administrative code for handling
GC BIFs, saving the developer's time.
Diffstat (limited to 'erts/emulator/beam/beam_emu.c')
-rw-r--r-- | erts/emulator/beam/beam_emu.c | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c index 4716460a6b..c9fb5a3022 100644 --- a/erts/emulator/beam/beam_emu.c +++ b/erts/emulator/beam/beam_emu.c @@ -5428,31 +5428,14 @@ void erts_dirty_process_main(ErtsSchedulerData *esdp) static BifFunction translate_gc_bif(void* gcf) { - if (gcf == erts_gc_length_1) { - return length_1; - } else if (gcf == erts_gc_size_1) { - return size_1; - } else if (gcf == erts_gc_bit_size_1) { - return bit_size_1; - } else if (gcf == erts_gc_byte_size_1) { - return byte_size_1; - } else if (gcf == erts_gc_map_size_1) { - return map_size_1; - } else if (gcf == erts_gc_abs_1) { - return abs_1; - } else if (gcf == erts_gc_float_1) { - return float_1; - } else if (gcf == erts_gc_round_1) { - return round_1; - } else if (gcf == erts_gc_trunc_1) { - return round_1; - } else if (gcf == erts_gc_binary_part_2) { - return binary_part_2; - } else if (gcf == erts_gc_binary_part_3) { - return binary_part_3; - } else { - erts_exit(ERTS_ERROR_EXIT, "bad gc bif"); + const ErtsGcBif* p; + + for (p = erts_gc_bifs; p->bif != 0; p++) { + if (p->gc_bif == gcf) { + return p->bif; + } } + erts_exit(ERTS_ERROR_EXIT, "bad gc bif"); } /* |