Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #25466

Re: Relocatable Blocks

Path csiph.com!usenet.pasdenom.info!goblin3!goblin1!goblin.stu.neva.ru!news.astraweb.com!border5.a.newsrouter.astraweb.com!border1.hitnews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail
NNTP-Posting-Date Thu, 29 Aug 2013 13:55:33 -0500
User-Agent Microsoft-Entourage/12.27.0.100910
Date Thu, 29 Aug 2013 19:55:28 +0100
Subject Re: Relocatable Blocks
From Ian van Breda <igvb@btopenworld.com>
Newsgroups comp.lang.forth
Message-ID <CE4557B0.3ADC%igvb@btopenworld.com> (permalink)
Thread-Topic Relocatable Blocks
Thread-Index Ac6k6VPDQVn7pYZMRDSM14oRJ0A6Tg==
References <CE4017C0.3A79%igvb@btopenworld.com> <7xioytzdll.fsf@ruckus.brouhaha.com>
Mime-version 1.0
Content-type text/plain; charset="US-ASCII"
Content-transfer-encoding 7bit
Lines 55
X-Usenet-Provider http://www.giganews.com
X-AuthenticatedUsername NoAuthUser
X-Trace sv3-PMJmJf3kRWIGCL+amB3Tdqee4WP8SKc3j1K3ZXdzXfqJIFxO9JxHjcY1+SIvfq+0Lokp5RwMrGYJEUK!284hrfnmsbCctYvxPil96rqIJHXL9kH+lwSw+vWPbUGJ3uo/WoHz6WaDLnYVTJBTiPVc
X-Complaints-To abuse@btinternet.com
X-DMCA-Complaints-To abuse@btinternet.com
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 3755
Xref csiph.com comp.lang.forth:25466

Show key headers only | View raw


Paul Rubin wrote on 25/08/2013 22:04:
> 
> There doesn't seem to be a way specified to access data in a relocatable
> block--are you saying the application should just treat hndl as
> something like an indirect pointer that can change at any time?  How is
> that supposed to interact with multitasking?
> 
> Do you really need dynamic resizing for Forth stacks?  I thought very
> deep stacks weren't really in the Forth spirit.  In any case, since only
> the top few stack elements are directly accessible, resize can be done
> completely behind the scenes, by moving the deeper elements off to some
> other place in memory, keeping the top elements at fixed addresses.

The relocatable blocks are held in a 'heap', a more flexible form of storage
mechanism than in a stack.  Usually, each task may have its own heap,
although that may not be necessary in a particular case.

Typically it is used for storing data objects which have life-times that
last longer than a stack, such as a word processing document or a stellar
spectrum, which needs to be manipulated in various ways.

During the progress of a program, many data objects may be allocated and
freed and may be even resized.  This may happen at any time and in any
order, leaving gaps in the heap.

The term 'handle' was used in both Mac OS, in its 'Classic' form, and in
Windows.  Control of the relocatable blocks was done behind the scenes,
including moving that data internally, e.g. compacting a heap if it proves
to be necessary to make space for new data.

More recently, handles have been replaced by pointers but the idea is the
same.  See 'Crafting a Compiler', p.500-511, 2010, under 'Heap Management'.


Albert van der Horst wrote on 26/08/2013 12:34:

> This all seems pretty useless without words to
> address into the blocks that are allocated.

Point taken!  Obviously you require things like H@ ( hndl offset -- x) and
H! ( x hndl offset -- ) for extracting and storing values in a relocatable
block, given a handle and an offset within a relocatable block.

Also a definition like HDUMP ( handl start u -- ) which dumps part of a
relocatable block, starting at a specified offset and given a number of
bytes to be displayed.

I use a Smalltalk-type Collection, which includes stacks, especially for the
Forth dictionary headers.  Data are placed in a stack frame for transferring
to a relocatable block.  Similarly, data can be extracted from a relocatable
block and placed on the parameter stack in the form of a stack-frame for
subsequent processing.

Ian

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Relocatable Blocks Ian van Breda <igvb@btopenworld.com> - 2013-08-25 20:21 +0100
  Re: Relocatable Blocks Paul Rubin <no.email@nospam.invalid> - 2013-08-25 14:04 -0700
    Re: Relocatable Blocks Ian van Breda <igvb@btopenworld.com> - 2013-08-29 19:55 +0100
  Re: Relocatable Blocks albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-08-26 11:34 +0000
    Re: Relocatable Blocks Hans Bezemer <the.beez.speaks@gmail.com> - 2013-08-26 14:58 +0200
      Re: Relocatable Blocks Hans Bezemer <the.beez.speaks@gmail.com> - 2013-08-26 15:30 +0200
      Re: Relocatable Blocks anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-08-26 14:33 +0000
        Re: Relocatable Blocks Ian van Breda <igvb@btopenworld.com> - 2013-08-29 20:22 +0100
  Re: Relocatable Blocks Mark Wills <markrobertwills@yahoo.co.uk> - 2013-08-26 07:08 -0700

csiph-web