New Cog VMs available

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

New Cog VMs available

Eliot Miranda-2
...at http://www.mirandabanda.org/files/Cog/VM/VM.r3041/.


The principal changes are fixing a performance regression in the 3040 VMs, fixing some Spur bugs in primitiveClone/shallowCopy, and radically simplifying the Spur become implementation,
trading the elimination of lots of post-become class table scanning for adding read barriers to class hierarchy method lookup.


CogVM source as per VMMaker.oscog-eem.820/r3041

Put the handling of the cloning of cogged methods in the clone: implementations,
removing it from the primitive.  Add it to the pinning clone too.

Specialize the store check trampoline generation.
Move it down to the relevant object representations.

Move setting of isRemembered flag to true into SpurGenerationScavenger>>
remember:.  Inline possibleRootStoreInto: (given that remember: is /not/
inlined.  Call remember directly from the ceStoreCheckTrampoline, and
hence have remember: answer its argument.

Fix localization bug.  Variables in initialize methods were not considered
references (cuz there are excluded).  This caused VMMaker.oscog-eem.816's
extraction of zero/false vars to StackInterpreter>>#initialize to cause
nextPollUsecs to be localized to checkForEventsMayContextSwitch:.

Spur:
Fix bug in scanClassPostBecome:effects: with new lazy
selector following policy by... throwing it all away.

The read barriers on method lookup (of the methodClass association in super
sends, of the superclass link, of method dictionaries, method dictionary arrays,
selectors and methods is cheap.  So replace scanning classes and method
dictionaries in the class table post become with read marriewrs on methodClass,
superclass and method dictionary etc on lookup.

The read barrier on an object from which we are going to fetch state (such as a
class or method dictionary) is essentially free on modern machines because the
class index and the state very likely share a cache line, and the register code
for testing is so cheap compared to memory access.  Further the read barrier on
selectors is cheap because the method lookup cache is effective in reducing the
number of message lookups and because nil entries need no check.

So nuke all the followNecessaryForwardingInMethod: machinery including the
cmUsesMethodClass hack.  Nuke scanClassPostBecome:effects:.

Rip out the forwardingCount: measurement code.  It causes
bad performance regressions (due to failing inlines?)

Clean up, e.g. replace followNonImmediateField:ofObject:
uses with followObjField:ofObject:.

canPinObjects can be inlined.


--
best,
Eliot
Reply | Threaded
Open this post in threaded view
|

Re: New Cog VMs available

stepharo
Hi eliot

Thanks!
I'm really eager to read about the new become implementation.
I could not fully understand the following but this is exciting to know
that you removed complexity.

Stef

"The read barriers on method lookup (of the methodClass association in super
sends, of the superclass link, of method dictionaries, method dictionary
arrays,
selectors and methods is cheap.  So replace scanning classes and method
dictionaries in the class table post become with read marriewrs on
methodClass,
superclass and method dictionary etc on lookup.

The read barrier on an object from which we are going to fetch state
(such as a
class or method dictionary) is essentially free on modern machines
because the
class index and the state very likely share a cache line, and the
register code
for testing is so cheap compared to memory access.  Further the read
barrier on
selectors is cheap because the method lookup cache is effective in
reducing the
number of message lookups and because nil entries need no check.

So nuke all the followNecessaryForwardingInMethod: machinery including the
cmUsesMethodClass hack.  Nuke scanClassPostBecome:effects:."




On 15/7/14 21:58, Eliot Miranda wrote:

> ...at http://www.mirandabanda.org/files/Cog/VM/VM.r3041/.
>
>
> The principal changes are fixing a performance regression in the 3040
> VMs, fixing some Spur bugs in primitiveClone/shallowCopy, and
> radically simplifying the Spur become implementation,
> trading the elimination of lots of post-become class table scanning
> for adding read barriers to class hierarchy method lookup.
>
>
> CogVM source as per VMMaker.oscog-eem.820/r3041
>
> Put the handling of the cloning of cogged methods in the clone:
> implementations,
> removing it from the primitive.  Add it to the pinning clone too.
>
> Specialize the store check trampoline generation.
> Move it down to the relevant object representations.
>
> Move setting of isRemembered flag to true into SpurGenerationScavenger>>
> remember:.  Inline possibleRootStoreInto: (given that remember: is /not/
> inlined.  Call remember directly from the ceStoreCheckTrampoline, and
> hence have remember: answer its argument.
>
> Fix localization bug.  Variables in initialize methods were not considered
> references (cuz there are excluded).  This caused VMMaker.oscog-eem.816's
> extraction of zero/false vars to StackInterpreter>>#initialize to cause
> nextPollUsecs to be localized to checkForEventsMayContextSwitch:.
>
> Spur:
> Fix bug in scanClassPostBecome:effects: with new lazy
> selector following policy by... throwing it all away.
>
> The read barriers on method lookup (of the methodClass association in
> super
> sends, of the superclass link, of method dictionaries, method
> dictionary arrays,
> selectors and methods is cheap.  So replace scanning classes and method
> dictionaries in the class table post become with read marriewrs on
> methodClass,
> superclass and method dictionary etc on lookup.
>
> The read barrier on an object from which we are going to fetch state
> (such as a
> class or method dictionary) is essentially free on modern machines
> because the
> class index and the state very likely share a cache line, and the
> register code
> for testing is so cheap compared to memory access.  Further the read
> barrier on
> selectors is cheap because the method lookup cache is effective in
> reducing the
> number of message lookups and because nil entries need no check.
>
> So nuke all the followNecessaryForwardingInMethod: machinery including the
> cmUsesMethodClass hack.  Nuke scanClassPostBecome:effects:.
>
> Rip out the forwardingCount: measurement code.  It causes
> bad performance regressions (due to failing inlines?)
>
> Clean up, e.g. replace followNonImmediateField:ofObject:
> uses with followObjField:ofObject:.
>
> canPinObjects can be inlined.
>
>
> --
> best,
> Eliot


Reply | Threaded
Open this post in threaded view
|

Re: New Cog VMs available

Ben Coman
stepharo wrote:
> Hi eliot
>
> Thanks!
> I'm really eager to read about the new become implementation.

There is this...
http://www.mirandabanda.org/cogblog/2013/09/13/lazy-become-and-a-partial-read-barrier/
cheers -ben

> I could not fully understand the following but this is exciting to
> know that you removed complexity.
>
> Stef
>
> "The read barriers on method lookup (of the methodClass association in
> super
> sends, of the superclass link, of method dictionaries, method
> dictionary arrays,
> selectors and methods is cheap.  So replace scanning classes and method
> dictionaries in the class table post become with read marriewrs on
> methodClass,
> superclass and method dictionary etc on lookup.
>
> The read barrier on an object from which we are going to fetch state
> (such as a
> class or method dictionary) is essentially free on modern machines
> because the
> class index and the state very likely share a cache line, and the
> register code
> for testing is so cheap compared to memory access.  Further the read
> barrier on
> selectors is cheap because the method lookup cache is effective in
> reducing the
> number of message lookups and because nil entries need no check.
>
> So nuke all the followNecessaryForwardingInMethod: machinery including
> the
> cmUsesMethodClass hack.  Nuke scanClassPostBecome:effects:."
>
>
>
>
> On 15/7/14 21:58, Eliot Miranda wrote:
>> ...at http://www.mirandabanda.org/files/Cog/VM/VM.r3041/.
>>
>>
>> The principal changes are fixing a performance regression in the 3040
>> VMs, fixing some Spur bugs in primitiveClone/shallowCopy, and
>> radically simplifying the Spur become implementation,
>> trading the elimination of lots of post-become class table scanning
>> for adding read barriers to class hierarchy method lookup.
>>
>>
>> CogVM source as per VMMaker.oscog-eem.820/r3041
>>
>> Put the handling of the cloning of cogged methods in the clone:
>> implementations,
>> removing it from the primitive.  Add it to the pinning clone too.
>>
>> Specialize the store check trampoline generation.
>> Move it down to the relevant object representations.
>>
>> Move setting of isRemembered flag to true into SpurGenerationScavenger>>
>> remember:.  Inline possibleRootStoreInto: (given that remember: is /not/
>> inlined.  Call remember directly from the ceStoreCheckTrampoline, and
>> hence have remember: answer its argument.
>>
>> Fix localization bug.  Variables in initialize methods were not
>> considered
>> references (cuz there are excluded).  This caused
>> VMMaker.oscog-eem.816's
>> extraction of zero/false vars to StackInterpreter>>#initialize to cause
>> nextPollUsecs to be localized to checkForEventsMayContextSwitch:.
>>
>> Spur:
>> Fix bug in scanClassPostBecome:effects: with new lazy
>> selector following policy by... throwing it all away.
>>
>> The read barriers on method lookup (of the methodClass association in
>> super
>> sends, of the superclass link, of method dictionaries, method
>> dictionary arrays,
>> selectors and methods is cheap.  So replace scanning classes and method
>> dictionaries in the class table post become with read marriewrs on
>> methodClass,
>> superclass and method dictionary etc on lookup.
>>
>> The read barrier on an object from which we are going to fetch state
>> (such as a
>> class or method dictionary) is essentially free on modern machines
>> because the
>> class index and the state very likely share a cache line, and the
>> register code
>> for testing is so cheap compared to memory access.  Further the read
>> barrier on
>> selectors is cheap because the method lookup cache is effective in
>> reducing the
>> number of message lookups and because nil entries need no check.
>>
>> So nuke all the followNecessaryForwardingInMethod: machinery
>> including the
>> cmUsesMethodClass hack.  Nuke scanClassPostBecome:effects:.
>>
>> Rip out the forwardingCount: measurement code.  It causes
>> bad performance regressions (due to failing inlines?)
>>
>> Clean up, e.g. replace followNonImmediateField:ofObject:
>> uses with followObjField:ofObject:.
>>
>> canPinObjects can be inlined.
>>
>>
>> --
>> best,
>> Eliot
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: New Cog VMs available

Eliot Miranda-2
Hi Ben, Steph,


On Wed, Jul 16, 2014 at 4:31 AM, Ben Coman <[hidden email]> wrote:
stepharo wrote:
Hi eliot

Thanks!
I'm really eager to read about the new become implementation.

There is this...
http://www.mirandabanda.org/cogblog/2013/09/13/lazy-become-and-a-partial-read-barrier/

yes, but I've removed all the scanning of the class table post become.  So that post is inaccurate now.
Steph, I plan to update the SpurMemoryManager class comment and that post soon to reflect the current design.


cheers -ben


I could not fully understand the following but this is exciting to know that you removed complexity.

Stef

"The read barriers on method lookup (of the methodClass association in super
sends, of the superclass link, of method dictionaries, method dictionary arrays,
selectors and methods is cheap.  So replace scanning classes and method
dictionaries in the class table post become with read marriewrs on methodClass,
superclass and method dictionary etc on lookup.

The read barrier on an object from which we are going to fetch state (such as a
class or method dictionary) is essentially free on modern machines because the
class index and the state very likely share a cache line, and the register code
for testing is so cheap compared to memory access.  Further the read barrier on
selectors is cheap because the method lookup cache is effective in reducing the
number of message lookups and because nil entries need no check.

So nuke all the followNecessaryForwardingInMethod: machinery including the
cmUsesMethodClass hack.  Nuke scanClassPostBecome:effects:."




On 15/7/14 21:58, Eliot Miranda wrote:
...at http://www.mirandabanda.org/files/Cog/VM/VM.r3041/.


The principal changes are fixing a performance regression in the 3040 VMs, fixing some Spur bugs in primitiveClone/shallowCopy, and radically simplifying the Spur become implementation,
trading the elimination of lots of post-become class table scanning for adding read barriers to class hierarchy method lookup.


CogVM source as per VMMaker.oscog-eem.820/r3041

Put the handling of the cloning of cogged methods in the clone: implementations,
removing it from the primitive.  Add it to the pinning clone too.

Specialize the store check trampoline generation.
Move it down to the relevant object representations.

Move setting of isRemembered flag to true into SpurGenerationScavenger>>
remember:.  Inline possibleRootStoreInto: (given that remember: is /not/
inlined.  Call remember directly from the ceStoreCheckTrampoline, and
hence have remember: answer its argument.

Fix localization bug.  Variables in initialize methods were not considered
references (cuz there are excluded).  This caused VMMaker.oscog-eem.816's
extraction of zero/false vars to StackInterpreter>>#initialize to cause
nextPollUsecs to be localized to checkForEventsMayContextSwitch:.

Spur:
Fix bug in scanClassPostBecome:effects: with new lazy
selector following policy by... throwing it all away.

The read barriers on method lookup (of the methodClass association in super
sends, of the superclass link, of method dictionaries, method dictionary arrays,
selectors and methods is cheap.  So replace scanning classes and method
dictionaries in the class table post become with read marriewrs on methodClass,
superclass and method dictionary etc on lookup.

The read barrier on an object from which we are going to fetch state (such as a
class or method dictionary) is essentially free on modern machines because the
class index and the state very likely share a cache line, and the register code
for testing is so cheap compared to memory access.  Further the read barrier on
selectors is cheap because the method lookup cache is effective in reducing the
number of message lookups and because nil entries need no check.

So nuke all the followNecessaryForwardingInMethod: machinery including the
cmUsesMethodClass hack.  Nuke scanClassPostBecome:effects:.

Rip out the forwardingCount: measurement code.  It causes
bad performance regressions (due to failing inlines?)

Clean up, e.g. replace followNonImmediateField:ofObject:
uses with followObjField:ofObject:.

canPinObjects can be inlined.


--
best,
Eliot








--
best,
Eliot