Article View: comp.lang.prolog
Article #122Re: Unsafe variables
From: Mats Carlsson
Date: Tue, 28 Jul 1992 07:25
Date: Tue, 28 Jul 1992 07:25
29 lines
2036 bytes
2036 bytes
In article <1992Jul27.065551.3053@cs.kuleuven.ac.be> bimbart@cs.kuleuven.ac.be (Bart Demoen) writes: [...] Two more remarks: I want to make a link with BinProlog (by the way, the relation between BinProlog and BIMProlog as not the same as between Nu-Prolog and Mu-Prolog !) or a continuation based implementation of Prolog: continuations on the heap actually means also environments on the heap, so that it in fact puts uninitialized 'permanent' variables on the heap. Still, it trails as much as a WAM implementation with unsafe variables. And it is difficult to get rid of the extra dereference every time the variable is accessed. I don't know how other WAM based Prologs do it, but in SICStus Prolog, the compiler ensures that all permanent variables are initialized at the first 'call' instruction of every clause. The variables are initialized by 'put_variable' if they are not otherwise initialized already. This is done to prevent there from being random bit patterns in the permanent variables in the event of a garbage collection. Some other changes to the instruction set are also necessary to prevent similar trouble in the event of garbage collection after backtracking. I don't have any figures, but I suspect that variables created by this mechanism would significantly contribute to the heap growth if one gets rid of unsafe variables. -- Mats Carlsson SICS, PO Box 1263, S-164 28 KISTA, Sweden Internet: matsc@sics.se Tel: +46 8 7521543 Ttx: 812 6154 7010 SICS Fax: +46 8 7517230
Technical Details
Message-ID:
<1992Jul28.072501.6238@sics.se>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!sics.se!sics.se!matscReferences:
<1992Jul27.065551.3053@cs.kuleuven.ac.be>Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.prolog Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sunic!sics.se!sics.se!matsc From: matsc@sics.se (Mats Carlsson) Subject: Re: Unsafe variables In-Reply-To: bimbart@cs.kuleuven.ac.be's message of Mon, 27 Jul 1992 06:55:51 GMT Message-ID: <1992Jul28.072501.6238@sics.se> Sender: news@sics.se Organization: Swedish Institute of Computer Science, Kista References: <1992Jul27.065551.3053@cs.kuleuven.ac.be> Date: Tue, 28 Jul 1992 07:25:01 GMT Lines: 29