diff options
author | Sverker Eriksson <[email protected]> | 2012-01-11 21:15:39 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2012-02-21 12:22:57 +0100 |
commit | 9df5bbccee7f50e11969ed41035ee8bc4bf5f42a (patch) | |
tree | d0c95a7b8544f799a65b56d07ff084984f81a24c | |
parent | 272a61ce4cfa7e92a037fbf71bc79ec0456f8b2b (diff) | |
download | otp-9df5bbccee7f50e11969ed41035ee8bc4bf5f42a.tar.gz otp-9df5bbccee7f50e11969ed41035ee8bc4bf5f42a.tar.bz2 otp-9df5bbccee7f50e11969ed41035ee8bc4bf5f42a.zip |
erts: Make use of def_lambdas optimization during loading
The default array was defined but not used.
-rw-r--r-- | erts/emulator/beam/beam_load.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/erts/emulator/beam/beam_load.c b/erts/emulator/beam/beam_load.c index 3040a2b7cd..27a5e72113 100644 --- a/erts/emulator/beam/beam_load.c +++ b/erts/emulator/beam/beam_load.c @@ -1409,9 +1409,12 @@ read_lambda_table(LoaderState* stp) int i; GetInt(stp, 4, stp->num_lambdas); - stp->lambdas_allocated = stp->num_lambdas; - stp->lambdas = (Lambda *) erts_alloc(ERTS_ALC_T_LOADER_TMP, - stp->num_lambdas * sizeof(Lambda)); + if (stp->num_lambdas > stp->lambdas_allocated) { + ASSERT(stp->lambdas == stp->def_lambdas); + stp->lambdas_allocated = stp->num_lambdas; + stp->lambdas = (Lambda *) erts_alloc(ERTS_ALC_T_LOADER_TMP, + stp->num_lambdas * sizeof(Lambda)); + } for (i = 0; i < stp->num_lambdas; i++) { Uint n; Uint32 Index; |