[erlang-questions] Extending term external format to support shared substructures
Tue Mar 31 12:41:13 CEST 2009
On Tue, Mar 31, 2009 at 12:00 PM, Matthew Dempsky <> wrote:
> Here's what I get with my patched R13A:
> > binary_to_term(<<131,104,2,108,0,0,0,0,106,100,0,1,97>>).
> Do you get something different? Is this not what you think it should be?
My fault. I did not apply the patch correctly (I manually applied only the
correction for this issue, because I didn't want the rest of the patch).
Your correction works fine and I will use your correction (my correction
used a goto).
>> To make sure that all terms are properly nested. We try to do as much error
>> checking as possible while calculating the size.
> Sorry, I still don't see the benefit. E.g., what better error
> checking do you have right now than if in the clause for
> SMALL_TUPLE_EXT you were to replace
> ESTACK_PUSH(s, terms);
> terms = *ep++;
> heap_size += terms + 1;
> n = *ep++;
> terms += n;
> heap_size += n + 1;
> ? With the exception of overflowing the 'terms' counter (which can be
> easily resolved by changing it to a 64-bit integer), I don't see how
> the former ends up being any stricter than the latter.
You are probably right. I applied your change and ran a test suite with contains
many examples of corrupt external format. It did not fail.
I will have to think more about it. If I can't find any reason for the
popping, I will change it in R13B.
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-questions