[Vm-dev] VM Maker: VMMaker.oscog-rmacnak.1595.mcz

Eliot Miranda eliot.miranda at gmail.com
Tue Dec 15 18:50:19 UTC 2015


Hi Ryan,

On Mon, Dec 14, 2015 at 7:32 PM, <commits at source.squeak.org> wrote:

>
> Ryan Macnak uploaded a new version of VMMaker to project VM Maker:
> http://source.squeak.org/VMMaker/VMMaker.oscog-rmacnak.1595.mcz
>
> ==================== Summary ====================
>
> Name: VMMaker.oscog-rmacnak.1595
> Author: rmacnak
> Time: 14 December 2015, 7:29:18.283 pm
> UUID: 3aac3671-b1ff-45b9-8ed0-f3ecc5bca0b3
> Ancestors: VMMaker.oscog-eem.1594
>
> MIPS: Complete simulation of the Newspeak test suite! (~30 billion
> instructions) (Modulo Aliens, which don't work under the IA32 simulation
> either.)
>

Can you say a little bit more about this?  How long did the simulation
take?  What machine(s) did you run it on?  I *love* that you caught the MNU
in followForwardingPointersInScheduler. I want to set this up for Squeak
but never had the patience/.resources before.



> Fix off-by-8 in patching I-type branches. Bug had the effect of skipping
> loading the cPIC address for a cPIC miss if the cPIC was created for an MNU
> case.
>
> Handle PushCw in storeLiteral:beforeFollowingAddress:.
>
> Add the GC's variant of rewriteInlineCacheTag:at:.
>
> Fix MNU in followForwardingPointersInScheduler.
>
> =============== Diff against VMMaker.oscog-eem.1594 ===============
>
> Item was changed:
>   ----- Method: CogMIPSELCompiler>>rewriteITypeBranchAtAddress:target: (in
> category 'inline cacheing') -----
>   rewriteITypeBranchAtAddress: mcpc target: newTarget
> +       | newDisplacement oldInstruction newInstruction |
> +       newDisplacement := newTarget - (mcpc + 4). "Displacement is
> relative to delay slot."
> +       newDisplacement := newDisplacement >> 2. "Displacement is in
> words."
> -       | newDisplacement oldInstruction newInstruction |
> -       newDisplacement := newTarget - (mcpc - 4). "Displacement relative
> to delay slot"
> -       newDisplacement := newDisplacement >> 2.
>
>         self assert: (newDisplacement between: -16r8000 and: 16r7FFF).
>         newDisplacement < 0
>                 ifTrue: [newDisplacement := newDisplacement + 16r10000]
>                 ifFalse: [newDisplacement := newDisplacement].
>         self assert: (newDisplacement between: 0 and: 16rFFFF).
>
>         oldInstruction := objectMemory longAt: mcpc.
>         newInstruction := (oldInstruction bitAnd: 16rFFFF0000) bitOr:
> newDisplacement.
>
>         objectMemory longAt: mcpc put: newInstruction.!
>
> Item was added:
> + ----- Method: CogMIPSELCompiler>>rewriteInlineCacheTag:at: (in category
> 'inline cacheing') -----
> + rewriteInlineCacheTag: cacheTag at: callSiteReturnAddress
> +       "Rewrite an inline cache with a new tag.  This variant is used
> +        by the garbage collector."
> +
> +       "MoveCwR ClassReg selectorIndex/expectedClass
> +        Call: unlinked send stub/expectedTarget
> +        Push ReceiverResult <-- callSiteReturnAddress"
> +
> +       "lui s3, selector/tagHigh
> +        ori s3, s3, selector/tagLow
> +        lui t9, stub/targetHigh
> +        ori t9, t9, stub/targetLow
> +        jalr t9
> +        nop (delay slot)
> +        ...  <-- callSiteReturnAddress"
> +
> +       <var: #callSiteReturnAddress type: #usqInt>
> +       <var: #callTargetAddress type: #usqInt>
> +       self assert: (self opcodeAtAddress: callSiteReturnAddress - 24) =
> LUI.
> +       self assert: (self opcodeAtAddress: callSiteReturnAddress - 20) =
> ORI.
> +       self assert: (self opcodeAtAddress: callSiteReturnAddress - 16) =
> LUI.
> +       self assert: (self opcodeAtAddress: callSiteReturnAddress - 12) =
> ORI.
> +       self assert: (self opcodeAtAddress: callSiteReturnAddress - 8) =
> SPECIAL.
> +       self assert: (self functionAtAddress: callSiteReturnAddress - 8) =
> JALR.
> +       self assert: (objectMemory longAt: callSiteReturnAddress - 4) =
> self nop.
> +       "cogit disassembleFrom: callSiteReturnAddress - 24 to:
> callSiteReturnAddress."
> +
> +       self literalAtAddress: callSiteReturnAddress - 20 put: cacheTag.
> +
> +       self assert: (self opcodeAtAddress: callSiteReturnAddress - 24) =
> LUI.
> +       self assert: (self opcodeAtAddress: callSiteReturnAddress - 20) =
> ORI.
> +       self assert: (self opcodeAtAddress: callSiteReturnAddress - 16) =
> LUI.
> +       self assert: (self opcodeAtAddress: callSiteReturnAddress - 12) =
> ORI.
> +       self assert: (self opcodeAtAddress: callSiteReturnAddress - 8) =
> SPECIAL.
> +       self assert: (self functionAtAddress: callSiteReturnAddress - 8) =
> JALR.
> +       self assert: (objectMemory longAt: callSiteReturnAddress - 4) =
> self nop.
> +       "cogit disassembleFrom: callSiteReturnAddress - 24 to:
> callSiteReturnAddress."!
>
> Item was changed:
>   ----- Method: CogMIPSELCompiler>>storeLiteral:beforeFollowingAddress:
> (in category 'inline cacheing') -----
>   storeLiteral: literal beforeFollowingAddress: followingAddress
>         "Rewrite the long constant loaded by a MoveCwR or PushCwR before
> the given address"
> -       | lastOpcode lastFunction oriAddress |
>         self flag: #bogus. "The caller ought to know what it is patching,
> and this should be split into separate methods with stricter checking."
>
> +       "Cmp/MoveCwR
> +        pc-8   lui rx, uper
> +        pc-4   ori rx, rx, lower"
> +       (self opcodeAtAddress: followingAddress - 4) = ORI ifTrue:
> +               [^self literalAtAddress: followingAddress - 4 put:
> literal].
> +
> +       "PushCw
> +        pc-16  lui at, upper
> +        pc-12  ori at, at, lower
> +        pc-8   addiu sp, sp, -4
> +        pc-4   sw at, 0(sp)"
> +       ((self opcodeAtAddress: followingAddress - 4) = SW and:
> +               [(self opcodeAtAddress: followingAddress - 8) = ADDIU])
> ifTrue:
> +                       [^self literalAtAddress: followingAddress - 12
> put: literal].
> +
> +       self unreachable.
> +       ^0!
> -       lastOpcode := self opcodeAtAddress: followingAddress - 4.
> -       lastFunction := self functionAtAddress: followingAddress - 4.
> -       oriAddress := 0.
> -       lastOpcode = ORI ifTrue: [oriAddress := followingAddress - 4].
> -       lastOpcode = ADDIU ifTrue: [oriAddress := followingAddress - 16].
> -       lastOpcode = SPECIAL ifTrue: [lastFunction = SUBU ifTrue:
> [oriAddress := followingAddress - 8]].
> -       self assert: oriAddress ~= 0.
> -       ^self literalAtAddress: oriAddress put: literal!
>
> Item was changed:
>   ----- Method: StackInterpreter>>followForwardingPointersInScheduler (in
> category 'object memory support') -----
>   followForwardingPointersInScheduler
>         | schedAssoc sched procLists |
>         schedAssoc := objectMemory splObj: SchedulerAssociation.
>         "the GC follows pointers in the special objects array for us."
>         self assert: (objectMemory isForwarded: schedAssoc) not.
>
>         "Make sure the active process has been followed."
> +       objectMemory followForwardedObjectFields: schedAssoc toDepth: 1.
> -       self followForwardedObjectFields: schedAssoc toDepth: 1.
>
>         sched := objectMemory fetchPointer: ValueIndex ofObject:
> schedAssoc.
>
>         procLists := objectMemory followObjField: ProcessListsIndex
> ofObject: sched.
>
>         "Follow all links in the process list to ensure the lists are
> valid."
>         0 to: (objectMemory numSlotsOf: procLists) - 1 do:
>                 [:i| | list first last next |
>                 list := objectMemory followObjField: i ofObject: procLists.
>                 first := objectMemory followObjField: FirstLinkIndex
> ofObject: list.
>                 last := objectMemory followObjField: LastLinkIndex
> ofObject: list.
>                 [first ~= last] whileTrue:
>                         [next := objectMemory followObjField:
> NextLinkIndex ofObject: first.
>                          first := next]]
>   !
>
>


-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20151215/a8682a14/attachment-0001.htm


More information about the Vm-dev mailing list