Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004839 [Squeak] Kernel minor always 09-09-06 18:05 09-09-06 18:05
Reporter Krivanek View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 3.10
Summary 0004839: [KernelImageOverride] ContextPart doPrimitive:method:receiver:args:
Description ContextPart >> doPrimitive:method:receiver:args:


original:

doPrimitive: primitiveIndex method: meth receiver: receiver args: arguments
    "Simulate a primitive method whose index is primitiveIndex. The
    simulated receiver and arguments are given as arguments to this message."

    | value |
    <primitive: 19> "Simulation guard"
    "If successful, push result and return resuming context,
        else ^ PrimitiveFailToken"
    (primitiveIndex = 19) ifTrue:[
        ToolSet
            debugContext: self
            label:'Code simulation error'
            contents: nil].

    (primitiveIndex = 80 and: [receiver isKindOf: ContextPart])
        ifTrue: [^self push: ((BlockContext newForMethod: receiver home method)
                        home: receiver home
                        startpc: pc + 2
                        nargs: (arguments at: 1))].
    (primitiveIndex = 81 and: [receiver isMemberOf: BlockContext])
        ifTrue: [^receiver pushArgs: arguments from: self].
    primitiveIndex = 83 "afr 9/11/1998 19:50"
        ifTrue: [^ self send: arguments first to: receiver
                    with: arguments allButFirst
                    super: false].
    primitiveIndex = 84 "afr 9/11/1998 19:50"
        ifTrue: [^ self send: arguments first to: receiver
                    with: (arguments at: 2)
                    super: false].
    primitiveIndex = 186 ifTrue: [ "closure value"
        | m |
        m _ receiver method.
        arguments size = m numArgs ifFalse: [^ PrimitiveFailToken].
        ^ self activateMethod: m
            withArgs: arguments
            receiver: receiver
            class: receiver class].
    primitiveIndex = 187 ifTrue: [ "closure valueWithArguments:"
        | m args |
        m _ receiver method.
        args _ arguments first.
        args size = m numArgs ifFalse: [^ PrimitiveFailToken].
        ^ self activateMethod: m
            withArgs: args
            receiver: receiver
            class: receiver class].
    primitiveIndex = 188 ifTrue: [ "object withArgs:executeMethod:"
        | m args |
        args _ arguments first.
        m _ arguments second.
        args size = m numArgs ifFalse: [^ PrimitiveFailToken].
        ^ self activateMethod: m
            withArgs: args
            receiver: receiver
            class: receiver class].
    arguments size > 6 ifTrue: [^ PrimitiveFailToken].
    primitiveIndex = 117
        ifTrue:[value _ self tryNamedPrimitiveIn: meth for: receiver withArgs: arguments]
        ifFalse:[value _ receiver tryPrimitive: primitiveIndex withArgs: arguments].
    value == PrimitiveFailToken
        ifTrue: [^ PrimitiveFailToken]
        ifFalse: [^ self push: value]

override:

doPrimitive: primitiveIndex method: meth receiver: receiver args: arguments
    "Simulate a primitive method whose index is primitiveIndex. The
    simulated receiver and arguments are given as arguments to this message."

    | value |
    <primitive: 19> "Simulation guard"
    "If successful, push result and return resuming context,
        else ^ PrimitiveFailToken"
    (primitiveIndex = 19) ifTrue:[
        UIManager default
            debugContext: self
            label: 'Code simulation error'
            contents: nil].

    (primitiveIndex = 80 and: [receiver isKindOf: ContextPart])
        ifTrue: [^self push: ((BlockContext newForMethod: receiver home method)
                        home: receiver home
                        startpc: pc + 2
                        nargs: (arguments at: 1))].
    (primitiveIndex = 81 and: [receiver isMemberOf: BlockContext])
        ifTrue: [^receiver pushArgs: arguments from: self].
    primitiveIndex = 83 "afr 9/11/1998 19:50"
        ifTrue: [^ self send: arguments first to: receiver
                    with: arguments allButFirst
                    super: false].
    primitiveIndex = 84 "afr 9/11/1998 19:50"
        ifTrue: [^ self send: arguments first to: receiver
                    with: (arguments at: 2)
                    super: false].
    primitiveIndex = 186 ifTrue: [ "closure value"
        | m |
        m := receiver method.
        arguments size = m numArgs ifFalse: [^ PrimitiveFailToken].
        ^ self activateMethod: m
            withArgs: arguments
            receiver: receiver
            class: receiver class].
    primitiveIndex = 187 ifTrue: [ "closure valueWithArguments:"
        | m args |
        m := receiver method.
        args := arguments first.
        args size = m numArgs ifFalse: [^ PrimitiveFailToken].
        ^ self activateMethod: m
            withArgs: args
            receiver: receiver
            class: receiver class].
    primitiveIndex = 188 ifTrue: [ "object withArgs:executeMethod:"
        | m args |
        args := arguments first.
        m := arguments second.
        args size = m numArgs ifFalse: [^ PrimitiveFailToken].
        ^ self activateMethod: m
            withArgs: args
            receiver: receiver
            class: receiver class].
    arguments size > 6 ifTrue: [^ PrimitiveFailToken].
    primitiveIndex = 117
        ifTrue:[value := self tryNamedPrimitiveIn: meth for: receiver withArgs: arguments]
        ifFalse:[value := receiver tryPrimitive: primitiveIndex withArgs: arguments].
    value == PrimitiveFailToken
        ifTrue: [^ PrimitiveFailToken]
        ifFalse: [^ self push: value]

UI dependent code replaced with the UIManager message
Additional Information
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
09-09-06 18:05 Krivanek New Issue


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
27 total queries executed.
24 unique queries executed.
Powered by Mantis Bugtracker