mozart / mozart2

Mozart Programming System v2
http://mozart.github.io/
BSD 2-Clause "Simplified" License
564 stars 96 forks source link

GC bug #330

Open layus opened 3 years ago

layus commented 3 years ago

Hi guys !

What about a funny issue to enlighten your confinement ?

%****************************************************************
%**
%** Error: unhandled exception
%**
%** typeError('BitArray' <GRedToUnstable>)
%**--------------------------------------------------------------

%****************************************************************
%**
%** Error: unhandled exception
%**
%** typeError('BitArray' <GRedToUnstable>)
%**--------------------------------------------------------------
%%% feeding file /home/layus/projects/mozart2/lib/main/base/Base.oz
layus commented 3 years ago

With some context:

Scanning dependencies of target library_stage_1
[ 28%] (stage 1) /home/gmaudoux/projets/mozart2/build/lib/stage1/Base.ozf

%****************************************************************
%**
%** Error: unhandled exception
%**
%** typeError('BitArray' <GRedToUnstable>)
%**--------------------------------------------------------------

%****************************************************************
%**
%** Error: unhandled exception
%**
%** typeError('BitArray' <GRedToUnstable>)
%**--------------------------------------------------------------
%%% feeding file /home/gmaudoux/projets/mozart2/lib/main/base/Base.oz
%** ------------------ crashed
make[2]: *** [lib/CMakeFiles/library_stage_1.dir/build.make:82: lib/stage1/Base.ozf] Error 1
make[1]: *** [CMakeFiles/Makefile2:1106: lib/CMakeFiles/library_stage_1.dir/all] Error 2
make: *** [Makefile:182: all] Error 2
layus commented 3 years ago

@sjrd Any idea what an GRedToUnstable is ? And why it appears instead of a plain, honnest BitArray ?

sjrd commented 3 years ago

GRedToStable and GRedToUnstable, IIRC, are special nodes that are supposed to only be used in a transient state during GC (or more generally GR, not sure what that stands for anymore ^^). When we copy a node A from the old space to the new space, we replace its original Node with a GRedToStable (resp. GRedToUnstable) that points to its new node if it is a StableNode (resp. UnstableNode). That way, when the copy finds the same node again through a different path, it knows that it should not create another copy of the value, but simply use the new location.

I don't know why a GRedToUnstable remains observable, but it's clearly a GC bug. In-between GCs, the graph of objects should contain no GRedToStable nor GRedToUnstable.