Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong behaviour of set/update on small ecirca #31

Closed
si14 opened this issue Sep 13, 2011 · 7 comments
Closed

Wrong behaviour of set/update on small ecirca #31

si14 opened this issue Sep 13, 2011 · 7 comments
Labels

Comments

@si14
Copy link
Member

si14 commented Sep 13, 2011

Strange atoms are returned as an old value in set/update of small ecirca.

@si14
Copy link
Member Author

si14 commented Sep 13, 2011

Temporary workaround: small ecirca = medium ecirca for now.

@si14
Copy link
Member Author

si14 commented Sep 14, 2011

It's not helping at all (too much changes to get things work right with this fix). Here is some informations for those who want to help:

[si14@si14-laptop temp]$ git clone git://github.com/band115/ecirca.git && cd ecirca
Cloning into ecirca...
...
[si14@si14-laptop ecirca]$ rebar get-deps compile
==> ecirca (get-deps)
...
==> ecirca (compile)
...
Compiling c_src/ecirca_large.c
Compiling c_src/ecirca_medium.c
Compiling c_src/ecirca_small.c
[si14@si14-laptop ecirca]$ ./start-dev.sh 
Erlang R14B03 (erts-5.8.4) [source] [64-bit halfword] [smp:4:4] [rq:4] [async-threads:10] [kernel-poll:true]
...
=PROGRESS REPORT==== 14-Sep-2011::21:46:37 ===
         application: sasl
          started_at: circa_dev@localhost
Eshell V5.8.4  (abort with ^G)

(circa_dev@localhost)1> {ok, T1} = ecirca:new(5, last, small).
{ok,{ecirca,#Ref<0.0.0.57>,<<>>,<0.48.0>,small}}
(circa_dev@localhost)2> {ok, T2} = ecirca:new(5, last, medium).
{ok,{ecirca,#Ref<0.0.0.63>,<<>>,<0.48.0>,medium}}
(circa_dev@localhost)3> ecirca:slice(T1, 1, 5).
{ok,[empty,empty,empty,empty,empty]}
(circa_dev@localhost)4> ecirca:slice(T2, 1, 5).
{ok,[empty,empty,empty,empty,empty]}
(circa_dev@localhost)5> ecirca:set(T1, 1, 2).
{ok,{signal,2}}  <-- this 'signal' should be 'empty'!
(circa_dev@localhost)6> ecirca:set(T2, 1, 2).
{ok,{empty,2}}
(circa_dev@localhost)7> ecirca:slice(T1, 1, 5).
{ok,[2,empty,empty,empty,empty]}
(circa_dev@localhost)8> ecirca:slice(T2, 1, 5).
{ok,[2,empty,empty,empty,empty]}
(circa_dev@localhost)9> ecirca:set(T1, 1, empty).
{ok,{2,signal}} <-- here again

As you can see, ecirca:slice shows right atoms, ecirca:set shows very strange behaviour. As one can see uncommenting printfs here

/* printf("DEBUG: %d %d %p %p %d\r\n", atom_idx, ctx->atoms[atom_idx],
, all arguments and returned atom (being casted to number) are identical in the case of slice and set, so one can suppose there should be identical atoms, but they are different.

@si14
Copy link
Member Author

si14 commented Sep 14, 2011

There is a report that this issue won't reproduce without halfword emulator. Checking now.

@si14
Copy link
Member Author

si14 commented Sep 14, 2011

Recompiled Erlang without halfword, bug is still here:

Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:10] [hipe] [kernel-poll:true]

(circa_dev@localhost)1> {ok, T} = ecirca:new(5, last, small).
{ok,{ecirca,#Ref<0.0.0.69>,<<>>,<0.52.0>,small}}
(circa_dev@localhost)2> ecirca:set(T, 1, 2).                 
{ok,{sinh,2}}
(circa_dev@localhost)3> ecirca:slice(T, 1, 5).
{ok,[2,empty,empty,empty,empty]}
(circa_dev@localhost)4> ecirca:set(T, 1, empty).
{ok,{2,sinh}}

@si14
Copy link
Member Author

si14 commented Sep 14, 2011

Looks like bug is not present on x32 machines: http://paste.org/pastebin/view/38420

@si14
Copy link
Member Author

si14 commented Sep 14, 2011

R14B02 is affected:

Erlang R14B02 (erts-5.8.3) [source] [64-bit] [smp:4:4] [rq:4] [async-threads:10] [hipe] [kernel-poll:true]
...
Eshell V5.8.3  (abort with ^G)
(circa_dev@localhost)1> {ok, T} = ecirca:new(5, last, small).
{ok,{ecirca,#Ref<0.0.0.56>,<<>>,<0.48.0>,small}}
(circa_dev@localhost)2> ecirca:set(T, 1, 2).
{ok,{resume_process,2}}
(circa_dev@localhost)3> ecirca:set(T, 1, empty).
{ok,{2,resume_process}}

@si14
Copy link
Member Author

si14 commented Sep 15, 2011

fixed in d681df1

@si14 si14 closed this as completed Sep 15, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant