Wow.  Great, John!   Thanks.  This should keep me at bay for a good while.
 From: mrj...@gmail.com
Date: Thu, 16 Aug 2012 08:10:31 -0700
To: factor-talk@lists.sourceforge.net
Subject: Re: [Factor-talk] Any way of making sense of what's in the boot        
image?

In the listener, if you run this code:
    IN: scratchpad clear    IN: scratchpad "value" "key" associate
Then step over to [ set-at ] keep


If at this point you just keep stepping "into" things, you should do a deep 
dive into all the parts, including the 4 slot { array } declare which should 
give you something like { ~tombstone~ ~tombstone~ ~tombstone~ ~tombstone~ } (an 
array full of "tombstone" elements which indicate no key or value is present).  
A hashtable with deleted elements will have "~empty~".  A hashtable with 
key/value will have { "key" "value" } at some point in the array.  The array is 
flattened key/value pairs, so a 4 bucket hashtable will have an 8 element array 
storing key/value side-by-side starting at the even indices.


I'm not sure what the 26-slot hash table is that you are looking at, so I put a 
clear in the code above to make sure your data stack is empty before walking.  
It is also possible that you are tracing some code which is traversing the 
namespaces (a vector of hashtables containing symbolic variables used in parts 
of the code, with names like the ones you mention).


A hashtable has 3 slots (the 0 slot is a numeric value), see:
```IN: scratchpad \ hashtable "slots" word-prop .{    T{ slot-spec

        { name "count" }        { offset 2 }        { class array-capacity }    
    { initial 0 }    }    T{ slot-spec        { name "deleted" }

        { offset 3 }        { class array-capacity }        { initial 0 }    }  
  T{ slot-spec        { name "array" }        { offset 4 }

        { class array }        { initial { } }    }}```
You might also like to try "describe", and poke around at the various word 
properties (see "props" below):


```IN: scratchpad \ hashtable describeIN: hashtables SYMBOL: hashtablehashcode  
    251442479911733628name          "hashtable"vocabulary    "hashtables"

def           [ \ hashtable ]props         H{ { "help-parent" "hashtables" } { 
"slots" ~array~ } { ...pic-def       fpic-tail-def  fsub-primitive f

```

On Thu, Aug 16, 2012 at 6:01 AM, Michael Clagett <mclag...@hotmail.com> wrote:






Hi --
 
Okay.  I'm going to ask for my first lifeline. :)  I'm tracing through some 
arcane stuff indeed.  Everything is going along swimmingly.  I get to the word 
"new-key@", which at its start wants to execute [ array>> 2dup hash@ 0 f 
(new-key@) ] with the "keep" combinator.  All good so far.  "array>>" resolves 
to [ 4 slot { array } declare ], which I believe should mean "get the 4th slot 
of the object on top of stack and declare to Factor that you know for sure it 
is an array".  The object on the top of the stack, according to the Inspector, 
is a 26-slot hash table that includes such keys as "architecture", "auto-use?", 
"bootstrap-syntax", "bootsrapping?", etc.


 
Now comes the part that baffles me.  When I get to executing "slot" (whether I 
try to step past it or descend into it), the Walker simply moves me all the way 
to the end of the qotation (past "declare") and I see the hash-table and index 
from the top of the data stack replaced with a 128-element array that has the 
26 key-value pairs from the former hash table spread out through the array 
interspersed by tombstone objects; each of these key-value pairs that appear 
occupy two adjacent array slots.  But I'm completely mystified as to how the 
contents of the hash-table got mapped to the array slots they now occupy (there 
doesn't seem to be any rhyme or reason).  And I have little insight into the 
code that accomplished this.  Moreover I apparently can't see the 4th slot of 
the original object in the Inspector, as it only shows me three slots on the 
data stack trace, but organizes them alphabetically when I double-click to open 
the Inspector window.


 
Don't know if any of this was intelligble.  But maybe one of you compiler guys 
can give me a clue as to how I can understand this.  I'm having to reverse 
engineer my understanding of all of this, so a break in the logical chain 
presents difficulties.


Sorry for the long post.
 
Regards,
 
Mike
 
> Date: Wed, 15 Aug 2012 08:30:10 -0700
> From: doug.cole...@gmail.com


> To: factor-talk@lists.sourceforge.net
> Subject: Re: [Factor-talk] Any way of making sense of what's in the boot      
> image?


> 
> 1) Factor loads a ~/.factor-rc file every time it starts. You can put
> things there:
> 
> USE: tools.scaffold
> scaffold-factor-rc
> 
> Click it, edit it and add:
> 


> USING: prettyprint.config namespaces ;
> 16 number-base set-global
> 
> 
> 
> 2) Alternately, there's a boot rc file that gets loaded after bootstrap:
> 
> USE: tools.scaffold


> scaffold-factor-boot-rc
> 
> Click it, edit it and add:
> 
> USING: prettyprint.config namespaces ;
> 16 number-base set-global
> 
> To load it without bootstrapping, call 'run-bootstrap-init' and then


> 'save' your image.
> 
> 
> Doug
> 
> 
> On Wed, Aug 15, 2012 at 8:22 AM, Michael Clagett <mclag...@hotmail.com> wrote:


> > Thanks.  I knew it had to be something like that.  And if I want it to be
> > the default every time I load the Listener, I'm sure there must be a way to
> > set that up?
> >
> > Sent from my iPhone


> >
> > On Aug 15, 2012, at 11:01 AM, "John Benediktsson" <mrj...@gmail.com> wrote:
> >
> > If you want all numbers to print in hex, the easiest way is:


> >
> > ```
> > IN: scratchpad 16 number-base set-global
> > ```
> >
> >
> > On Wed, Aug 15, 2012 at 4:04 AM, Michael Clagett <mclag...@hotmail.com>


> > wrote:
> >>
> >> Quick question.   Any way of having the data and retain stack panes of the
> >> Walker display values in hex?
> >>
> >> > Date: Mon, 13 Aug 2012 12:21:52 -0400


> >> > From: arc...@gmail.com
> >> > To: factor-talk@lists.sourceforge.net


> >> > Subject: Re: [Factor-talk] Any way of making sense of what's in the boot
> >> > image?
> >> >
> >> > On Mon, Aug 13, 2012 at 11:52 AM, Michael Clagett <mclag...@hotmail.com>


> >> > wrote:
> >> > > Here's an obscure question that is of interest to me in my current
> >> > > quest,
> >> > > but probably not to anyone else. So if there is a better forum for me


> >> > > to
> >> > > ask such things, I would love to be instructed; until I hear
> >> > > otherwise,
> >> > > however, I will continue to use this list.


> >> > >
> >> > > Is there any place where I can penetrate the meaning of the following
> >> > > constants:
> >> > >
> >> > > CONSTANT: rt-dlsym 0


> >> > > CONSTANT: rt-entry-point 1
> >> > > CONSTANT: rt-entry-point-pic 2
> >> > > CONSTANT: rt-entry-point-pic-tail 3
> >> > > CONSTANT: rt-here 4


> >> > > CONSTANT: rt-this 5
> >> > > CONSTANT: rt-literal 6
> >> > > CONSTANT: rt-untagged 7
> >> > > CONSTANT: rt-megamorphic-cache-hits 8
> >> > > CONSTANT: rt-vm 9


> >> > > CONSTANT: rt-cards-offset 10
> >> > > CONSTANT: rt-decks-offset 11
> >> > > CONSTANT: rt-exception-handler 12
> >> > > CONSTANT: rt-dlsym-toc 13


> >> > > CONSTANT: rt-inline-cache-miss 14
> >> > > CONSTANT: rt-safepoint 15
> >> > >
> >> > > So far I've only encountered rt-here and I've only seen it encoded


> >> > > into a
> >> > > relocation entry and not really used anywhere yet. But this strikes me
> >> > > as
> >> > > the kind of thing it would be useful to know as I am slogging through


> >> > > this
> >> > > stuff.
> >> > >
> >> > > Not a hugely pressing question, as I'm sure I'll muddle through it.
> >> > > But if


> >> > > anyone has a moment to illuminate, it would be nice.
> >> >
> >> > Those are relocation record types. When the compiler generates code
> >> > for a word, it also needs to generate relocation entries every time it


> >> > references another word in a jump or call statement, much like a
> >> > native C compiler needs to do for symbols in other modules.
> >> > The VM uses these relocation entries to update the operands of jump


> >> > and call instructions when code is written to the code heap, when the
> >> > code heap is compacted, or if code is moved in memory for any reason.
> >> > The different rt-* constants are used to describe what kind of object


> >> > a relocation refers to, such as a foreign function in a DLL (dlsym), a
> >> > word entry point (entry-point-*), the current address (here), etc.
> >> >
> >> > -Joe


> >> >
> >> >
> >> > ------------------------------------------------------------------------------
> >> > Live Security Virtual Conference
> >> > Exclusive live event will cover all the ways today's security and


> >> > threat landscape has changed and how IT managers can respond.
> >> > Discussions
> >> > will include endpoint security, mobile security and the latest in
> >> > malware


> >> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> >> > _______________________________________________


> >> > Factor-talk mailing list
> >> > Factor-talk@lists.sourceforge.net
> >> > https://lists.sourceforge.net/lists/listinfo/factor-talk


> >>
> >>
> >> ------------------------------------------------------------------------------
> >> Live Security Virtual Conference
> >> Exclusive live event will cover all the ways today's security and


> >> threat landscape has changed and how IT managers can respond. Discussions
> >> will include endpoint security, mobile security and the latest in malware
> >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


> >> _______________________________________________
> >> Factor-talk mailing list
> >> Factor-talk@lists.sourceforge.net


> >> https://lists.sourceforge.net/lists/listinfo/factor-talk
> >>
> >
> > ------------------------------------------------------------------------------


> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and
> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware


> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> >
> > _______________________________________________


> > Factor-talk mailing list
> > Factor-talk@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/factor-talk


> >
> >
> > ------------------------------------------------------------------------------
> > Live Security Virtual Conference
> > Exclusive live event will cover all the ways today's security and


> > threat landscape has changed and how IT managers can respond. Discussions
> > will include endpoint security, mobile security and the latest in malware
> > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


> > _______________________________________________
> > Factor-talk mailing list
> > Factor-talk@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/factor-talk


> >
> 
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 


> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/


> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk


                                          

------------------------------------------------------------------------------

Live Security Virtual Conference

Exclusive live event will cover all the ways today's security and

threat landscape has changed and how IT managers can respond. Discussions

will include endpoint security, mobile security and the latest in malware

threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________

Factor-talk mailing list

Factor-talk@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/factor-talk





------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk                        
                  
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to