diff options
author | Sverker Eriksson <[email protected]> | 2017-09-06 20:38:52 +0200 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2017-11-15 20:10:33 +0100 |
commit | 42dadd12ac6b6977513a6edd73ff6137488c4a4a (patch) | |
tree | 85d39d1c09cc3b5a5408708fb3c9e903d50f92f4 | |
parent | 38c70e35b6da2571c7bc90442108fe5d5ddbfad1 (diff) | |
download | otp-42dadd12ac6b6977513a6edd73ff6137488c4a4a.tar.gz otp-42dadd12ac6b6977513a6edd73ff6137488c4a4a.tar.bz2 otp-42dadd12ac6b6977513a6edd73ff6137488c4a4a.zip |
erts: Ensure enc_term_int() always do progress
even when reds <= 1
Removed micro optimization for first fun variable
to make things simpler.
-rw-r--r-- | erts/emulator/beam/external.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c index bfac48580c..8408d7dd12 100644 --- a/erts/emulator/beam/external.c +++ b/erts/emulator/beam/external.c @@ -2554,8 +2554,6 @@ enc_term_int(TTBEncodeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj, byte* ep, break; } - L_jump_start: - if (ctx && --r <= 0) { *reds = 0; ctx->obj = obj; @@ -2563,6 +2561,8 @@ enc_term_int(TTBEncodeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj, byte* ep, WSTACK_SAVE(s, &ctx->wstack); return -1; } + + L_jump_start: switch(tag_val_def(obj)) { case NIL_DEF: *ep++ = NIL_EXT; @@ -2945,13 +2945,9 @@ enc_term_int(TTBEncodeContext* ctx, ErtsAtomCacheMap *acmp, Eterm obj, byte* ep, ep = enc_term(acmp, make_small(funp->fe->old_uniq), ep, dflags, off_heap); ep = enc_pid(acmp, funp->creator, ep, dflags); - for (ei = funp->num_free-1; ei > 0; ei--) { + for (ei = funp->num_free-1; ei >= 0; ei--) { WSTACK_PUSH2(s, ENC_TERM, (UWord) funp->env[ei]); } - if (funp->num_free != 0) { - obj = funp->env[0]; - goto L_jump_start; - } } break; } |