Hello Matthias, Matthias Trute <mtr...@web.de> writes:
> Hi Enoch, > > >> How can I reclaim the Flash memory of the crc8_msb_table word itself? >> >> (1) Our Tools Ext don't include FORGET. >> >> (2) I could use Core Ext MARKER if we had a deferred facility of >> sort. I.e., create a deferred table and fill it using a transient >> crc8_msb_table (which MARKER would afterwards help to remove). > > There is no simple way. I did not actually test it, but I'd > start as follows. First define the dictionary header for the data > (create), allocate the flash room for it (dp 128 + to dp), now the > marker and finally all the words that you want to dispose after filling > the data flash area (use !i, not , ). Hmm. sounds not only difficult, it > is indeed. > >> Among Forth main strengths is the ability to change itself at run-time >> (aka "reflection"). Can we apply it without the penalty of accumulating >> redundant code? > > The major problem (and the reason why I dropped FORGET) is > fragmentation. The current memory "management" is the trivial > append/remove approach. The last time FORGET worked for the > dictionary was until the introduction of wordlists. A flash > memory manager that can deal with fragmentation is unlikly > to earn its own size (your CRC table could be pre-computed > on the host side as well and only the resulting table goes > to the controller. Just like the magic numbers in lib/sinus.frt). Indeed, your suggested use of MARKER is what I anticipated but I have to agree with you, it would be too difficult/dangerous for an average programmer to try. Hence, let us revisit FORGET. I agree with you again that with Flash memory "de-fragmemetation" is not an option. However, there is a solution if you agree to modify the dictionary structure just a bit. I believe that you are familiar with the various "dynamic storage allocation" algorithms (Knuth, Vol 1, Fundamental Algorithms, 2.5 Dynamic Storage Allocation). What if we introduce one bit for each definition which means "FREE" or "IN-USE". FORGET would become: (1) Mark the definition as FREE (2) if possible, merge this newly freed Flash space with adjacent Flash free definitions. For the purpose of this algorithm the "unused dictionary space" would be just another free definition space on our linked list. When compiling, we can compile into the largest free definition space or choose another strategy. By the way, I don't agree with Forth-RC1 comment on FORGET which says as follows: "This word is obsolescent and is included as a concession to existing implementations." Because: (1) In Flash restricted situations what other solution there is for the program to change itself while running... (2) How else can one implement "Dynamic Software Updating" <http://en.wikipedia.org/wiki/Dynamic_Software_Updating>. As I am not a Forth expert (yet), did any other flash based Forth introduce FORGET? Regards, Enoch. > > Matthias > PS: how long last the pastebin files? They look good. Thanks, 4 more weeks but I promised to improve upon it. > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_feb ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_feb _______________________________________________ Amforth-devel mailing list for http://amforth.sf.net/ Amforth-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amforth-devel