[Vm-dev] VM Maker: BytecodeSets.spur-eem.47.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Apr 8 17:46:26 UTC 2016
Eliot Miranda uploaded a new version of BytecodeSets to project VM Maker:
http://source.squeak.org/VMMaker/BytecodeSets.spur-eem.47.mcz
==================== Summary ====================
Name: BytecodeSets.spur-eem.47
Author: eem
Time: 8 April 2016, 10:46:17.277262 am
UUID: 911152d8-d4d0-46f6-a3dd-82ee5fb5148e
Ancestors: BytecodeSets.spur-eem.46
Add the FullBlockClosure nfib example to FullBlockClosure's class comment (& provide a bit of a comment).
=============== Diff against BytecodeSets.spur-eem.46 ===============
Item was changed:
BlockClosure variableSubclass: #FullBlockClosure
instanceVariableNames: 'receiver'
classVariableNames: ''
poolDictionaries: ''
category: 'BytecodeSets-SistaV1'!
+
+ !FullBlockClosure commentStamp: 'eem 4/8/2016 10:45' prior: 0!
+ A FullBlockClosure is a closure that can be indepdendent of any outerContext if desired. It has its own method (currently reusing the startpc inst var) and its own receiver. outerContext can be either a MethodContext/Context or nil.
+
+ Instance Variables
+ receiver: <Object>
+
+ Here's an example (a chunk designed to be typed into the spurreader image with this class filed in, e.g. in the simulator), circa early 2016 for creating the recursive nfib example (|nfib|nfib:=nil.nfib:=[:n|n<=1ifTrue:[1]ifFalse:[(nfib value:n-1)+(nfib value:n-2)+1]].(1to:12)collect:nfib) using FullBlockClosure:
+
+ | method closure |
+ method := (AssemblerMethod new
+ methodClass: Object;
+ selector: #nfib:;
+ numArgs: 1;
+ numTemps: 2;
+ literal: #ifTrue:ifFalse:;
+ pushTemporaryVariable: 0;
+ pushSpecialConstant: 1;
+ send: #<= super: false numArgs: 1;
+ jump: 'L1' if: false;
+ pushSpecialConstant: 1;
+ jump: 'L2';
+ label: 'L1';
+ pushRemoteTemp: 0 inVectorAt: 1;
+ pushTemporaryVariable: 0;
+ pushSpecialConstant: 1;
+ send: #- super: false numArgs: 1;
+ send: #value: super: false numArgs: 1;
+ pushRemoteTemp: 0 inVectorAt: 1;
+ pushTemporaryVariable: 0;
+ pushSpecialConstant: 2;
+ send: #- super: false numArgs: 1;
+ send: #value: super: false numArgs: 1;
+ send: #+ super: false numArgs: 1;
+ pushSpecialConstant: 1;
+ send: #+ super: false numArgs: 1;
+ label: 'L2';
+ blockReturnTop;
+ yourself) assemble.
+ closure := FullBlockClosure new: 1.
+ closure
+ outerContext: nil;
+ compiledBlock: method;
+ numArgs: 1;
+ receiver: nil.
+ closure at: 1 put: (Array with: closure).
+ (1 to: 12) collect: closure!!!
More information about the Vm-dev
mailing list