aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/beam_load.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2011-11-22 15:34:24 +0100
committerBjörn Gustavsson <[email protected]>2012-01-11 16:43:38 +0100
commitb07e9f5652106a4b07335b51763192421b1671c8 (patch)
treedaa7654a8246d8429c0d5db689ee2fb4471f9172 /erts/emulator/beam/beam_load.c
parentbb312f5fb5748fef90f57ccb387f1c32a729f086 (diff)
downloadotp-b07e9f5652106a4b07335b51763192421b1671c8.tar.gz
otp-b07e9f5652106a4b07335b51763192421b1671c8.tar.bz2
otp-b07e9f5652106a4b07335b51763192421b1671c8.zip
beam_load.c: apply/2 does not need a special case
It is wrongly assumed in the BEAM loader that apply/2 is a BIF and must be treated specially. Also make it clearer in ops.tab that apply/3 is a BIF, but apply/2 is not.
Diffstat (limited to 'erts/emulator/beam/beam_load.c')
-rw-r--r--erts/emulator/beam/beam_load.c25
1 files changed, 4 insertions, 21 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c
index dd788df6e4..a510632220 100644
--- a/erts/emulator/beam/beam_load.c
+++ b/erts/emulator/beam/beam_load.c
@@ -1315,15 +1315,6 @@ load_import_table(LoaderState* stp)
static int
read_export_table(LoaderState* stp)
{
- static struct {
- Eterm mod;
- Eterm func;
- int arity;
- } allow_redef[] = {
- /* The BIFs that are allowed to be redefined by Erlang code */
- {am_erlang,am_apply,2},
- {am_erlang,am_apply,3},
- };
int i;
GetInt(stp, 4, stp->num_exps);
@@ -1361,21 +1352,13 @@ read_export_table(LoaderState* stp)
stp->export[i].address = stp->code + value;
/*
- * Check that we are not redefining a BIF (except the ones allowed to
- * redefine).
+ * Check that we are not redefining a BIF (except erlang:apply/3).
*/
if ((e = erts_find_export_entry(stp->module, func, arity)) != NULL) {
if (e->code[3] == (BeamInstr) em_apply_bif) {
- int j;
-
- for (j = 0; j < sizeof(allow_redef)/sizeof(allow_redef[0]); j++) {
- if (stp->module == allow_redef[j].mod &&
- func == allow_redef[j].func &&
- arity == allow_redef[j].arity) {
- break;
- }
- }
- if (j == sizeof(allow_redef)/sizeof(allow_redef[0])) {
+ if (stp->module != am_erlang ||
+ func != am_apply ||
+ arity != 3) {
LoadError2(stp, "exported function %T/%d redefines BIF",
func, arity);
}