Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1355.mcz ==================== Summary ==================== Name: Kernel-eem.1355 Author: eem Time: 28 October 2020, 6:16:21.972202 pm UUID: 14e40036-578b-4645-88e4-77be34a6d96b Ancestors: Kernel-eem.1354 Speed-up cull:[cull:*] by supplying the primitive to handle teh case where the number of block arguments matches the number of arguments to cull:[cull:]. Nuke the obsolete pre-closure simulation code for block closure activation. =============== Diff against Kernel-eem.1354 =============== Item was changed: ----- Method: BlockClosure>>cull: (in category 'evaluating') ----- cull: firstArg "Activate the receiver, with one or zero arguments." + <primitive: 202> "Handle the one argument case primitively" - numArgs >= 1 ifTrue: [ ^self value: firstArg ]. ^self value! Item was changed: ----- Method: BlockClosure>>cull:cull: (in category 'evaluating') ----- cull: firstArg cull: secondArg "Activate the receiver, with two or less arguments." + <primitive: 203> "Handle the two argument case primitively" - numArgs >= 2 ifTrue: [ ^self value: firstArg value: secondArg ]. numArgs = 1 ifTrue: [ ^self value: firstArg ]. ^self value! Item was changed: ----- Method: BlockClosure>>cull:cull:cull: (in category 'evaluating') ----- cull: firstArg cull: secondArg cull: thirdArg "Activate the receiver, with three or less arguments." + <primitive: 204> "Handle the two argument case primitively" - numArgs >= 2 ifTrue: [ numArgs >= 3 ifTrue: [ ^self value: firstArg value: secondArg value: thirdArg ]. ^self value: firstArg value: secondArg ]. numArgs = 1 ifTrue: [ ^self value: firstArg ]. ^self value! Item was changed: ----- Method: BlockClosure>>cull:cull:cull:cull: (in category 'evaluating') ----- cull: firstArg cull: secondArg cull: thirdArg cull: fourthArg "Activate the receiver, with four or less arguments." + <primitive: 205> "Handle the two argument case primitively" - numArgs >= 3 ifTrue: [ numArgs >= 4 ifTrue: [ ^self value: firstArg value: secondArg value: thirdArg value: fourthArg ]. ^self value: firstArg value: secondArg value: thirdArg ]. numArgs = 2 ifTrue: [ ^self value: firstArg value: secondArg ]. numArgs = 1 ifTrue: [ ^self value: firstArg ]. ^self value! Item was changed: ----- Method: BlockClosure>>value (in category 'evaluating') ----- value "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the copied values to the activation as its copied temps. Primitive. Essential." <primitive: 201> - | newContext | numArgs ~= 0 ifTrue: [self numArgsError: 0]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: BlockClosure>>value: (in category 'evaluating') ----- value: firstArg "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the argument and copied values to the activation as its argument and copied temps. Primitive. Essential." <primitive: 202> - | newContext | numArgs ~= 1 ifTrue: [self numArgsError: 1]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: BlockClosure>>value:value: (in category 'evaluating') ----- value: firstArg value: secondArg "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 203> - | newContext | numArgs ~= 2 ifTrue: [self numArgsError: 2]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: BlockClosure>>value:value:value: (in category 'evaluating') ----- value: firstArg value: secondArg value: thirdArg "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 204> - | newContext | numArgs ~= 3 ifTrue: [self numArgsError: 3]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - newContext at: 3 put: thirdArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: BlockClosure>>value:value:value:value: (in category 'evaluating') ----- value: firstArg value: secondArg value: thirdArg value: fourthArg "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 205> - | newContext | numArgs ~= 4 ifTrue: [self numArgsError: 4]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - newContext at: 3 put: thirdArg. - newContext at: 4 put: fourthArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: BlockClosure>>value:value:value:value:value: (in category 'evaluating') ----- value: firstArg value: secondArg value: thirdArg value: fourthArg value: fifthArg "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 205> - | newContext | numArgs ~= 5 ifTrue: [self numArgsError: 5]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - newContext at: 3 put: thirdArg. - newContext at: 4 put: fourthArg. - newContext at: 5 put: fifthArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: BlockClosure>>valueWithArguments: (in category 'evaluating') ----- valueWithArguments: anArray "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments in an anArray and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 206> - | newContext | numArgs ~= anArray size ifTrue: [self numArgsError: anArray size]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - 1 to: numArgs do: - [:i| newContext at: i put: (anArray at: i)]. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was added: + ----- Method: FullBlockClosure>>cull: (in category 'evaluating') ----- + cull: firstArg + "Activate the receiver, with one or zero arguments." + <primitive: 207> "Handle the one argument case primitively" + numArgs >= 1 ifTrue: [ ^self value: firstArg ]. + ^self value! Item was added: + ----- Method: FullBlockClosure>>cull:cull: (in category 'evaluating') ----- + cull: firstArg cull: secondArg + "Activate the receiver, with two or less arguments." + <primitive: 207> "Handle the two argument case primitively" + numArgs >= 2 ifTrue: [ ^self value: firstArg value: secondArg ]. + numArgs = 1 ifTrue: [ ^self value: firstArg ]. + ^self value! Item was added: + ----- Method: FullBlockClosure>>cull:cull:cull: (in category 'evaluating') ----- + cull: firstArg cull: secondArg cull: thirdArg + "Activate the receiver, with three or less arguments." + <primitive: 207> "Handle the three argument case primitively" + numArgs >= 2 ifTrue: + [numArgs >= 3 ifTrue: + [^self value: firstArg value: secondArg value: thirdArg]. + ^self value: firstArg value: secondArg]. + numArgs = 1 ifTrue: + [^self value: firstArg]. + ^self value! Item was added: + ----- Method: FullBlockClosure>>cull:cull:cull:cull: (in category 'evaluating') ----- + cull: firstArg cull: secondArg cull: thirdArg cull: fourthArg + "Activate the receiver, with four or less arguments." + <primitive: 207> "Handle the four argument case primitively" + numArgs >= 3 ifTrue: + [numArgs >= 4 ifTrue: + [^self value: firstArg value: secondArg value: thirdArg value: fourthArg]. + ^self value: firstArg value: secondArg value: thirdArg]. + numArgs = 2 ifTrue: + [^self value: firstArg value: secondArg]. + numArgs = 1 ifTrue: + [^self value: firstArg]. + ^self value! Item was changed: ----- Method: FullBlockClosure>>value (in category 'evaluating') ----- value "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the copied values to the activation as its copied temps. Primitive. Essential." <primitive: 207> - | newContext | numArgs ~= 0 ifTrue: [self numArgsError: 0]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: FullBlockClosure>>value: (in category 'evaluating') ----- value: firstArg "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the argument and copied values to the activation as its argument and copied temps. Primitive. Essential." <primitive: 207> - | newContext | numArgs ~= 1 ifTrue: [self numArgsError: 1]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: FullBlockClosure>>value:value: (in category 'evaluating') ----- value: firstArg value: secondArg "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 207> - | newContext | numArgs ~= 2 ifTrue: [self numArgsError: 2]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: FullBlockClosure>>value:value:value: (in category 'evaluating') ----- value: firstArg value: secondArg value: thirdArg "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 207> - | newContext | numArgs ~= 3 ifTrue: [self numArgsError: 3]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - newContext at: 3 put: thirdArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: FullBlockClosure>>value:value:value:value: (in category 'evaluating') ----- value: firstArg value: secondArg value: thirdArg value: fourthArg "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 207> - | newContext | numArgs ~= 4 ifTrue: [self numArgsError: 4]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - newContext at: 3 put: thirdArg. - newContext at: 4 put: fourthArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: FullBlockClosure>>value:value:value:value:value: (in category 'evaluating') ----- value: firstArg value: secondArg value: thirdArg value: fourthArg value: fifthArg "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 207> - | newContext | numArgs ~= 5 ifTrue: [self numArgsError: 5]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - newContext at: 3 put: thirdArg. - newContext at: 4 put: fourthArg. - newContext at: 5 put: fifthArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: FullBlockClosure>>valueWithArguments: (in category 'evaluating') ----- valueWithArguments: anArray "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments in an anArray and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 208> - | newContext | numArgs ~= anArray size ifTrue: [self numArgsError: anArray size]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - 1 to: numArgs do: - [:i| newContext at: i put: (anArray at: i)]. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! |
Great idea! As a side-effect, there will also be less noise when debugging some block invocation. :-) Why did you choose numArgs = 2 for the fast lane, was this a random choice only, or did you do some measurements to find out which number of arguments is most commonly passed? Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
Gesendet: Donnerstag, 29. Oktober 2020 03:13:04 An: [hidden email]; [hidden email] Betreff: [squeak-dev] The Trunk: Kernel-eem.1355.mcz Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.1355.mcz ==================== Summary ==================== Name: Kernel-eem.1355 Author: eem Time: 28 October 2020, 6:16:21.972202 pm UUID: 14e40036-578b-4645-88e4-77be34a6d96b Ancestors: Kernel-eem.1354 Speed-up cull:[cull:*] by supplying the primitive to handle teh case where the number of block arguments matches the number of arguments to cull:[cull:]. Nuke the obsolete pre-closure simulation code for block closure activation. =============== Diff against Kernel-eem.1354 =============== Item was changed: ----- Method: BlockClosure>>cull: (in category 'evaluating') ----- cull: firstArg "Activate the receiver, with one or zero arguments." + <primitive: 202> "Handle the one argument case primitively" - numArgs >= 1 ifTrue: [ ^self value: firstArg ]. ^self value! Item was changed: ----- Method: BlockClosure>>cull:cull: (in category 'evaluating') ----- cull: firstArg cull: secondArg "Activate the receiver, with two or less arguments." + <primitive: 203> "Handle the two argument case primitively" - numArgs >= 2 ifTrue: [ ^self value: firstArg value: secondArg ]. numArgs = 1 ifTrue: [ ^self value: firstArg ]. ^self value! Item was changed: ----- Method: BlockClosure>>cull:cull:cull: (in category 'evaluating') ----- cull: firstArg cull: secondArg cull: thirdArg "Activate the receiver, with three or less arguments." + <primitive: 204> "Handle the two argument case primitively" - numArgs >= 2 ifTrue: [ numArgs >= 3 ifTrue: [ ^self value: firstArg value: secondArg value: thirdArg ]. ^self value: firstArg value: secondArg ]. numArgs = 1 ifTrue: [ ^self value: firstArg ]. ^self value! Item was changed: ----- Method: BlockClosure>>cull:cull:cull:cull: (in category 'evaluating') ----- cull: firstArg cull: secondArg cull: thirdArg cull: fourthArg "Activate the receiver, with four or less arguments." + <primitive: 205> "Handle the two argument case primitively" - numArgs >= 3 ifTrue: [ numArgs >= 4 ifTrue: [ ^self value: firstArg value: secondArg value: thirdArg value: fourthArg ]. ^self value: firstArg value: secondArg value: thirdArg ]. numArgs = 2 ifTrue: [ ^self value: firstArg value: secondArg ]. numArgs = 1 ifTrue: [ ^self value: firstArg ]. ^self value! Item was changed: ----- Method: BlockClosure>>value (in category 'evaluating') ----- value "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the copied values to the activation as its copied temps. Primitive. Essential." <primitive: 201> - | newContext | numArgs ~= 0 ifTrue: [self numArgsError: 0]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: BlockClosure>>value: (in category 'evaluating') ----- value: firstArg "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the argument and copied values to the activation as its argument and copied temps. Primitive. Essential." <primitive: 202> - | newContext | numArgs ~= 1 ifTrue: [self numArgsError: 1]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: BlockClosure>>value:value: (in category 'evaluating') ----- value: firstArg value: secondArg "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 203> - | newContext | numArgs ~= 2 ifTrue: [self numArgsError: 2]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: BlockClosure>>value:value:value: (in category 'evaluating') ----- value: firstArg value: secondArg value: thirdArg "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 204> - | newContext | numArgs ~= 3 ifTrue: [self numArgsError: 3]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - newContext at: 3 put: thirdArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: BlockClosure>>value:value:value:value: (in category 'evaluating') ----- value: firstArg value: secondArg value: thirdArg value: fourthArg "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 205> - | newContext | numArgs ~= 4 ifTrue: [self numArgsError: 4]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - newContext at: 3 put: thirdArg. - newContext at: 4 put: fourthArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: BlockClosure>>value:value:value:value:value: (in category 'evaluating') ----- value: firstArg value: secondArg value: thirdArg value: fourthArg value: fifthArg "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 205> - | newContext | numArgs ~= 5 ifTrue: [self numArgsError: 5]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - newContext at: 3 put: thirdArg. - newContext at: 4 put: fourthArg. - newContext at: 5 put: fifthArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: BlockClosure>>valueWithArguments: (in category 'evaluating') ----- valueWithArguments: anArray "Activate the receiver, creating a closure activation (Context) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments in an anArray and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 206> - | newContext | numArgs ~= anArray size ifTrue: [self numArgsError: anArray size]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - 1 to: numArgs do: - [:i| newContext at: i put: (anArray at: i)]. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was added: + ----- Method: FullBlockClosure>>cull: (in category 'evaluating') ----- + cull: firstArg + "Activate the receiver, with one or zero arguments." + <primitive: 207> "Handle the one argument case primitively" + numArgs >= 1 ifTrue: [ ^self value: firstArg ]. + ^self value! Item was added: + ----- Method: FullBlockClosure>>cull:cull: (in category 'evaluating') ----- + cull: firstArg cull: secondArg + "Activate the receiver, with two or less arguments." + <primitive: 207> "Handle the two argument case primitively" + numArgs >= 2 ifTrue: [ ^self value: firstArg value: secondArg ]. + numArgs = 1 ifTrue: [ ^self value: firstArg ]. + ^self value! Item was added: + ----- Method: FullBlockClosure>>cull:cull:cull: (in category 'evaluating') ----- + cull: firstArg cull: secondArg cull: thirdArg + "Activate the receiver, with three or less arguments." + <primitive: 207> "Handle the three argument case primitively" + numArgs >= 2 ifTrue: + [numArgs >= 3 ifTrue: + [^self value: firstArg value: secondArg value: thirdArg]. + ^self value: firstArg value: secondArg]. + numArgs = 1 ifTrue: + [^self value: firstArg]. + ^self value! Item was added: + ----- Method: FullBlockClosure>>cull:cull:cull:cull: (in category 'evaluating') ----- + cull: firstArg cull: secondArg cull: thirdArg cull: fourthArg + "Activate the receiver, with four or less arguments." + <primitive: 207> "Handle the four argument case primitively" + numArgs >= 3 ifTrue: + [numArgs >= 4 ifTrue: + [^self value: firstArg value: secondArg value: thirdArg value: fourthArg]. + ^self value: firstArg value: secondArg value: thirdArg]. + numArgs = 2 ifTrue: + [^self value: firstArg value: secondArg]. + numArgs = 1 ifTrue: + [^self value: firstArg]. + ^self value! Item was changed: ----- Method: FullBlockClosure>>value (in category 'evaluating') ----- value "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the copied values to the activation as its copied temps. Primitive. Essential." <primitive: 207> - | newContext | numArgs ~= 0 ifTrue: [self numArgsError: 0]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: FullBlockClosure>>value: (in category 'evaluating') ----- value: firstArg "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the argument and copied values to the activation as its argument and copied temps. Primitive. Essential." <primitive: 207> - | newContext | numArgs ~= 1 ifTrue: [self numArgsError: 1]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: FullBlockClosure>>value:value: (in category 'evaluating') ----- value: firstArg value: secondArg "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 207> - | newContext | numArgs ~= 2 ifTrue: [self numArgsError: 2]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: FullBlockClosure>>value:value:value: (in category 'evaluating') ----- value: firstArg value: secondArg value: thirdArg "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 207> - | newContext | numArgs ~= 3 ifTrue: [self numArgsError: 3]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - newContext at: 3 put: thirdArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: FullBlockClosure>>value:value:value:value: (in category 'evaluating') ----- value: firstArg value: secondArg value: thirdArg value: fourthArg "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 207> - | newContext | numArgs ~= 4 ifTrue: [self numArgsError: 4]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - newContext at: 3 put: thirdArg. - newContext at: 4 put: fourthArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: FullBlockClosure>>value:value:value:value:value: (in category 'evaluating') ----- value: firstArg value: secondArg value: thirdArg value: fourthArg value: fifthArg "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 207> - | newContext | numArgs ~= 5 ifTrue: [self numArgsError: 5]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - newContext at: 1 put: firstArg. - newContext at: 2 put: secondArg. - newContext at: 3 put: thirdArg. - newContext at: 4 put: fourthArg. - newContext at: 5 put: fifthArg. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]! Item was changed: ----- Method: FullBlockClosure>>valueWithArguments: (in category 'evaluating') ----- valueWithArguments: anArray "Activate the receiver, creating a closure activation (MethodContext) whose closure is the receiver and whose caller is the sender of this message. Supply the arguments in an anArray and copied values to the activation as its arguments and copied temps. Primitive. Essential." <primitive: 208> - | newContext | numArgs ~= anArray size ifTrue: [self numArgsError: anArray size]. + ^self primitiveFailed! - false - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." - [newContext := self asContextWithSender: thisContext sender. - 1 to: numArgs do: - [:i| newContext at: i put: (anArray at: i)]. - thisContext privSender: newContext] - ifFalse: [self primitiveFailed]!
Carpe Squeak!
|
Hi Christoph,
On Thu, 29 Oct 2020, Thiede, Christoph wrote: > > Great idea! As a side-effect, there will also be less noise when debugging some block invocation. :-) > > Why did you choose numArgs = 2 for the fast lane, was this a random choice only, or did you do some measurements to find out which number of arguments is most commonly passed? If you mean the comments for primitive 204 and 205 saying "Handle the two argument case primitively", "two" is just a copy-paste error. The correct words are "three" and "four", respectively. Levente > > > Best, > Christoph > > __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ > Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]> > Gesendet: Donnerstag, 29. Oktober 2020 03:13:04 > An: [hidden email]; [hidden email] > Betreff: [squeak-dev] The Trunk: Kernel-eem.1355.mcz > Eliot Miranda uploaded a new version of Kernel to project The Trunk: > http://source.squeak.org/trunk/Kernel-eem.1355.mcz > > ==================== Summary ==================== > > Name: Kernel-eem.1355 > Author: eem > Time: 28 October 2020, 6:16:21.972202 pm > UUID: 14e40036-578b-4645-88e4-77be34a6d96b > Ancestors: Kernel-eem.1354 > > Speed-up cull:[cull:*] by supplying the primitive to handle teh case where the number of block arguments matches the number of arguments to cull:[cull:]. > Nuke the obsolete pre-closure simulation code for block closure activation. > > =============== Diff against Kernel-eem.1354 =============== > > Item was changed: > ----- Method: BlockClosure>>cull: (in category 'evaluating') ----- > cull: firstArg > "Activate the receiver, with one or zero arguments." > + <primitive: 202> "Handle the one argument case primitively" > - > numArgs >= 1 ifTrue: [ ^self value: firstArg ]. > ^self value! > > Item was changed: > ----- Method: BlockClosure>>cull:cull: (in category 'evaluating') ----- > cull: firstArg cull: secondArg > "Activate the receiver, with two or less arguments." > + <primitive: 203> "Handle the two argument case primitively" > - > numArgs >= 2 ifTrue: [ ^self value: firstArg value: secondArg ]. > numArgs = 1 ifTrue: [ ^self value: firstArg ]. > ^self value! > > Item was changed: > ----- Method: BlockClosure>>cull:cull:cull: (in category 'evaluating') ----- > cull: firstArg cull: secondArg cull: thirdArg > "Activate the receiver, with three or less arguments." > + <primitive: 204> "Handle the two argument case primitively" > - > numArgs >= 2 ifTrue: [ > numArgs >= 3 ifTrue: [ ^self value: firstArg value: secondArg value: thirdArg ]. > ^self value: firstArg value: secondArg ]. > numArgs = 1 ifTrue: [ ^self value: firstArg ]. > ^self value! > > Item was changed: > ----- Method: BlockClosure>>cull:cull:cull:cull: (in category 'evaluating') ----- > cull: firstArg cull: secondArg cull: thirdArg cull: fourthArg > "Activate the receiver, with four or less arguments." > + <primitive: 205> "Handle the two argument case primitively" > - > numArgs >= 3 ifTrue: [ > numArgs >= 4 ifTrue: [ > ^self value: firstArg value: secondArg value: thirdArg value: fourthArg ]. > ^self value: firstArg value: secondArg value: thirdArg ]. > numArgs = 2 ifTrue: [ ^self value: firstArg value: secondArg ]. > numArgs = 1 ifTrue: [ ^self value: firstArg ]. > ^self value! > > Item was changed: > ----- Method: BlockClosure>>value (in category 'evaluating') ----- > value > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the copied values to the activation as its copied > temps. Primitive. Essential." > <primitive: 201> > - | newContext | > numArgs ~= 0 ifTrue: > [self numArgsError: 0]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: BlockClosure>>value: (in category 'evaluating') ----- > value: firstArg > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the argument and copied values to the activation > as its argument and copied temps. Primitive. Essential." > <primitive: 202> > - | newContext | > numArgs ~= 1 ifTrue: > [self numArgsError: 1]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: BlockClosure>>value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 203> > - | newContext | > numArgs ~= 2 ifTrue: > [self numArgsError: 2]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: BlockClosure>>value:value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg value: thirdArg > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 204> > - | newContext | > numArgs ~= 3 ifTrue: > [self numArgsError: 3]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - newContext at: 3 put: thirdArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: BlockClosure>>value:value:value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg value: thirdArg value: fourthArg > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 205> > - | newContext | > numArgs ~= 4 ifTrue: > [self numArgsError: 4]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - newContext at: 3 put: thirdArg. > - newContext at: 4 put: fourthArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: BlockClosure>>value:value:value:value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg value: thirdArg value: fourthArg value: fifthArg > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 205> > - | newContext | > numArgs ~= 5 ifTrue: > [self numArgsError: 5]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - newContext at: 3 put: thirdArg. > - newContext at: 4 put: fourthArg. > - newContext at: 5 put: fifthArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: BlockClosure>>valueWithArguments: (in category 'evaluating') ----- > valueWithArguments: anArray > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments in an anArray and copied values to > the activation as its arguments and copied temps. Primitive. Essential." > <primitive: 206> > - | newContext | > numArgs ~= anArray size ifTrue: > [self numArgsError: anArray size]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - 1 to: numArgs do: > - [:i| newContext at: i put: (anArray at: i)]. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was added: > + ----- Method: FullBlockClosure>>cull: (in category 'evaluating') ----- > + cull: firstArg > + "Activate the receiver, with one or zero arguments." > + <primitive: 207> "Handle the one argument case primitively" > + numArgs >= 1 ifTrue: [ ^self value: firstArg ]. > + ^self value! > > Item was added: > + ----- Method: FullBlockClosure>>cull:cull: (in category 'evaluating') ----- > + cull: firstArg cull: secondArg > + "Activate the receiver, with two or less arguments." > + <primitive: 207> "Handle the two argument case primitively" > + numArgs >= 2 ifTrue: [ ^self value: firstArg value: secondArg ]. > + numArgs = 1 ifTrue: [ ^self value: firstArg ]. > + ^self value! > > Item was added: > + ----- Method: FullBlockClosure>>cull:cull:cull: (in category 'evaluating') ----- > + cull: firstArg cull: secondArg cull: thirdArg > + "Activate the receiver, with three or less arguments." > + <primitive: 207> "Handle the three argument case primitively" > + numArgs >= 2 ifTrue: > + [numArgs >= 3 ifTrue: > + [^self value: firstArg value: secondArg value: thirdArg]. > + ^self value: firstArg value: secondArg]. > + numArgs = 1 ifTrue: > + [^self value: firstArg]. > + ^self value! > > Item was added: > + ----- Method: FullBlockClosure>>cull:cull:cull:cull: (in category 'evaluating') ----- > + cull: firstArg cull: secondArg cull: thirdArg cull: fourthArg > + "Activate the receiver, with four or less arguments." > + <primitive: 207> "Handle the four argument case primitively" > + numArgs >= 3 ifTrue: > + [numArgs >= 4 ifTrue: > + [^self value: firstArg value: secondArg value: thirdArg value: fourthArg]. > + ^self value: firstArg value: secondArg value: thirdArg]. > + numArgs = 2 ifTrue: > + [^self value: firstArg value: secondArg]. > + numArgs = 1 ifTrue: > + [^self value: firstArg]. > + ^self value! > > Item was changed: > ----- Method: FullBlockClosure>>value (in category 'evaluating') ----- > value > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the copied values to the activation as its copied > temps. Primitive. Essential." > <primitive: 207> > - | newContext | > numArgs ~= 0 ifTrue: > [self numArgsError: 0]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: FullBlockClosure>>value: (in category 'evaluating') ----- > value: firstArg > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the argument and copied values to the activation > as its argument and copied temps. Primitive. Essential." > <primitive: 207> > - | newContext | > numArgs ~= 1 ifTrue: > [self numArgsError: 1]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: FullBlockClosure>>value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 207> > - | newContext | > numArgs ~= 2 ifTrue: > [self numArgsError: 2]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: FullBlockClosure>>value:value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg value: thirdArg > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 207> > - | newContext | > numArgs ~= 3 ifTrue: > [self numArgsError: 3]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - newContext at: 3 put: thirdArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: FullBlockClosure>>value:value:value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg value: thirdArg value: fourthArg > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 207> > - | newContext | > numArgs ~= 4 ifTrue: > [self numArgsError: 4]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - newContext at: 3 put: thirdArg. > - newContext at: 4 put: fourthArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: FullBlockClosure>>value:value:value:value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg value: thirdArg value: fourthArg value: fifthArg > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 207> > - | newContext | > numArgs ~= 5 ifTrue: > [self numArgsError: 5]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - newContext at: 3 put: thirdArg. > - newContext at: 4 put: fourthArg. > - newContext at: 5 put: fifthArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: FullBlockClosure>>valueWithArguments: (in category 'evaluating') ----- > valueWithArguments: anArray > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments in an anArray and copied values to > the activation as its arguments and copied temps. Primitive. Essential." > <primitive: 208> > - | newContext | > numArgs ~= anArray size ifTrue: > [self numArgsError: anArray size]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - 1 to: numArgs do: > - [:i| newContext at: i put: (anArray at: i)]. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > > > |
Alright. :-) Still, might it be an optimization to try with a smaller number of arguments first? I don't know which case occurs more commonly.
Best, Christoph Von: Squeak-dev <[hidden email]> im Auftrag von Levente Uzonyi <[hidden email]>
Gesendet: Donnerstag, 29. Oktober 2020 14:24:49 An: The general-purpose Squeak developers list Cc: [hidden email] Betreff: Re: [squeak-dev] The Trunk: Kernel-eem.1355.mcz Hi Christoph,
On Thu, 29 Oct 2020, Thiede, Christoph wrote: > > Great idea! As a side-effect, there will also be less noise when debugging some block invocation. :-) > > Why did you choose numArgs = 2 for the fast lane, was this a random choice only, or did you do some measurements to find out which number of arguments is most commonly passed? If you mean the comments for primitive 204 and 205 saying "Handle the two argument case primitively", "two" is just a copy-paste error. The correct words are "three" and "four", respectively. Levente > > > Best, > Christoph > > __________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________ > Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]> > Gesendet: Donnerstag, 29. Oktober 2020 03:13:04 > An: [hidden email]; [hidden email] > Betreff: [squeak-dev] The Trunk: Kernel-eem.1355.mcz > Eliot Miranda uploaded a new version of Kernel to project The Trunk: > http://source.squeak.org/trunk/Kernel-eem.1355.mcz > > ==================== Summary ==================== > > Name: Kernel-eem.1355 > Author: eem > Time: 28 October 2020, 6:16:21.972202 pm > UUID: 14e40036-578b-4645-88e4-77be34a6d96b > Ancestors: Kernel-eem.1354 > > Speed-up cull:[cull:*] by supplying the primitive to handle teh case where the number of block arguments matches the number of arguments to cull:[cull:]. > Nuke the obsolete pre-closure simulation code for block closure activation. > > =============== Diff against Kernel-eem.1354 =============== > > Item was changed: > ----- Method: BlockClosure>>cull: (in category 'evaluating') ----- > cull: firstArg > "Activate the receiver, with one or zero arguments." > + <primitive: 202> "Handle the one argument case primitively" > - > numArgs >= 1 ifTrue: [ ^self value: firstArg ]. > ^self value! > > Item was changed: > ----- Method: BlockClosure>>cull:cull: (in category 'evaluating') ----- > cull: firstArg cull: secondArg > "Activate the receiver, with two or less arguments." > + <primitive: 203> "Handle the two argument case primitively" > - > numArgs >= 2 ifTrue: [ ^self value: firstArg value: secondArg ]. > numArgs = 1 ifTrue: [ ^self value: firstArg ]. > ^self value! > > Item was changed: > ----- Method: BlockClosure>>cull:cull:cull: (in category 'evaluating') ----- > cull: firstArg cull: secondArg cull: thirdArg > "Activate the receiver, with three or less arguments." > + <primitive: 204> "Handle the two argument case primitively" > - > numArgs >= 2 ifTrue: [ > numArgs >= 3 ifTrue: [ ^self value: firstArg value: secondArg value: thirdArg ]. > ^self value: firstArg value: secondArg ]. > numArgs = 1 ifTrue: [ ^self value: firstArg ]. > ^self value! > > Item was changed: > ----- Method: BlockClosure>>cull:cull:cull:cull: (in category 'evaluating') ----- > cull: firstArg cull: secondArg cull: thirdArg cull: fourthArg > "Activate the receiver, with four or less arguments." > + <primitive: 205> "Handle the two argument case primitively" > - > numArgs >= 3 ifTrue: [ > numArgs >= 4 ifTrue: [ > ^self value: firstArg value: secondArg value: thirdArg value: fourthArg ]. > ^self value: firstArg value: secondArg value: thirdArg ]. > numArgs = 2 ifTrue: [ ^self value: firstArg value: secondArg ]. > numArgs = 1 ifTrue: [ ^self value: firstArg ]. > ^self value! > > Item was changed: > ----- Method: BlockClosure>>value (in category 'evaluating') ----- > value > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the copied values to the activation as its copied > temps. Primitive. Essential." > <primitive: 201> > - | newContext | > numArgs ~= 0 ifTrue: > [self numArgsError: 0]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: BlockClosure>>value: (in category 'evaluating') ----- > value: firstArg > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the argument and copied values to the activation > as its argument and copied temps. Primitive. Essential." > <primitive: 202> > - | newContext | > numArgs ~= 1 ifTrue: > [self numArgsError: 1]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: BlockClosure>>value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 203> > - | newContext | > numArgs ~= 2 ifTrue: > [self numArgsError: 2]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: BlockClosure>>value:value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg value: thirdArg > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 204> > - | newContext | > numArgs ~= 3 ifTrue: > [self numArgsError: 3]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - newContext at: 3 put: thirdArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: BlockClosure>>value:value:value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg value: thirdArg value: fourthArg > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 205> > - | newContext | > numArgs ~= 4 ifTrue: > [self numArgsError: 4]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - newContext at: 3 put: thirdArg. > - newContext at: 4 put: fourthArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: BlockClosure>>value:value:value:value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg value: thirdArg value: fourthArg value: fifthArg > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 205> > - | newContext | > numArgs ~= 5 ifTrue: > [self numArgsError: 5]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - newContext at: 3 put: thirdArg. > - newContext at: 4 put: fourthArg. > - newContext at: 5 put: fifthArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: BlockClosure>>valueWithArguments: (in category 'evaluating') ----- > valueWithArguments: anArray > "Activate the receiver, creating a closure activation (Context) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments in an anArray and copied values to > the activation as its arguments and copied temps. Primitive. Essential." > <primitive: 206> > - | newContext | > numArgs ~= anArray size ifTrue: > [self numArgsError: anArray size]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - 1 to: numArgs do: > - [:i| newContext at: i put: (anArray at: i)]. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was added: > + ----- Method: FullBlockClosure>>cull: (in category 'evaluating') ----- > + cull: firstArg > + "Activate the receiver, with one or zero arguments." > + <primitive: 207> "Handle the one argument case primitively" > + numArgs >= 1 ifTrue: [ ^self value: firstArg ]. > + ^self value! > > Item was added: > + ----- Method: FullBlockClosure>>cull:cull: (in category 'evaluating') ----- > + cull: firstArg cull: secondArg > + "Activate the receiver, with two or less arguments." > + <primitive: 207> "Handle the two argument case primitively" > + numArgs >= 2 ifTrue: [ ^self value: firstArg value: secondArg ]. > + numArgs = 1 ifTrue: [ ^self value: firstArg ]. > + ^self value! > > Item was added: > + ----- Method: FullBlockClosure>>cull:cull:cull: (in category 'evaluating') ----- > + cull: firstArg cull: secondArg cull: thirdArg > + "Activate the receiver, with three or less arguments." > + <primitive: 207> "Handle the three argument case primitively" > + numArgs >= 2 ifTrue: > + [numArgs >= 3 ifTrue: > + [^self value: firstArg value: secondArg value: thirdArg]. > + ^self value: firstArg value: secondArg]. > + numArgs = 1 ifTrue: > + [^self value: firstArg]. > + ^self value! > > Item was added: > + ----- Method: FullBlockClosure>>cull:cull:cull:cull: (in category 'evaluating') ----- > + cull: firstArg cull: secondArg cull: thirdArg cull: fourthArg > + "Activate the receiver, with four or less arguments." > + <primitive: 207> "Handle the four argument case primitively" > + numArgs >= 3 ifTrue: > + [numArgs >= 4 ifTrue: > + [^self value: firstArg value: secondArg value: thirdArg value: fourthArg]. > + ^self value: firstArg value: secondArg value: thirdArg]. > + numArgs = 2 ifTrue: > + [^self value: firstArg value: secondArg]. > + numArgs = 1 ifTrue: > + [^self value: firstArg]. > + ^self value! > > Item was changed: > ----- Method: FullBlockClosure>>value (in category 'evaluating') ----- > value > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the copied values to the activation as its copied > temps. Primitive. Essential." > <primitive: 207> > - | newContext | > numArgs ~= 0 ifTrue: > [self numArgsError: 0]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: FullBlockClosure>>value: (in category 'evaluating') ----- > value: firstArg > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the argument and copied values to the activation > as its argument and copied temps. Primitive. Essential." > <primitive: 207> > - | newContext | > numArgs ~= 1 ifTrue: > [self numArgsError: 1]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: FullBlockClosure>>value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 207> > - | newContext | > numArgs ~= 2 ifTrue: > [self numArgsError: 2]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: FullBlockClosure>>value:value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg value: thirdArg > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 207> > - | newContext | > numArgs ~= 3 ifTrue: > [self numArgsError: 3]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - newContext at: 3 put: thirdArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: FullBlockClosure>>value:value:value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg value: thirdArg value: fourthArg > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 207> > - | newContext | > numArgs ~= 4 ifTrue: > [self numArgsError: 4]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - newContext at: 3 put: thirdArg. > - newContext at: 4 put: fourthArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: FullBlockClosure>>value:value:value:value:value: (in category 'evaluating') ----- > value: firstArg value: secondArg value: thirdArg value: fourthArg value: fifthArg > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments and copied values to the activation > as its arguments and copied temps. Primitive. Essential." > <primitive: 207> > - | newContext | > numArgs ~= 5 ifTrue: > [self numArgsError: 5]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - newContext at: 1 put: firstArg. > - newContext at: 2 put: secondArg. > - newContext at: 3 put: thirdArg. > - newContext at: 4 put: fourthArg. > - newContext at: 5 put: fifthArg. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > Item was changed: > ----- Method: FullBlockClosure>>valueWithArguments: (in category 'evaluating') ----- > valueWithArguments: anArray > "Activate the receiver, creating a closure activation (MethodContext) > whose closure is the receiver and whose caller is the sender of this > message. Supply the arguments in an anArray and copied values to > the activation as its arguments and copied temps. Primitive. Essential." > <primitive: 208> > - | newContext | > numArgs ~= anArray size ifTrue: > [self numArgsError: anArray size]. > + ^self primitiveFailed! > - false > - ifTrue: "Old code to simulate the closure value primitive on VMs that lack it." > - [newContext := self asContextWithSender: thisContext sender. > - 1 to: numArgs do: > - [:i| newContext at: i put: (anArray at: i)]. > - thisContext privSender: newContext] > - ifFalse: [self primitiveFailed]! > > > >
Carpe Squeak!
|
Free forum by Nabble | Edit this page |