[project] Implementing Block Closure Semantics

lsci6mxq0g6rg7c001 at sneakemail.com lsci6mxq0g6rg7c001 at sneakemail.com
Wed Mar 7 04:19:52 UTC 2001


Stephan wrote:
>BTW: I have just looked at minnow for making a project entry there;
>- 'All projects' page doesn't work for me;
>- there is a very outdated page
>	http://minnow.cc.gatech.edu/squeak/749
>, which declares 'Block Closures' as a (external) SqC project. It also
>contains many names of well known Squeakers and the 
>	Estimated completion date: October 1, 1999
>(therefore I call it outdated)...

Yes, the work on that pretty much went into stasis.  I don't have much in 
the way of notes saved from that, other than this proposal for two new 
bytecodes that are required to access the new lexical levels:

----
Access to the home context is still done through the existing temp access 
opcodes:

		 16 to: 31  pushTemporaryVariableBytecode
		104 to: 111 storeAndPopTemporaryVariableBytecode
		128         extendedPushBytecode
		129         extendedStoreBytecode
		130         extendedStoreAndPopBytecode


Access to lexical levels is done through 2 new bytecodes:


-------------------------------
Bytecode 126 (currently unused)

extendedLexicalAccessBytecode
     "this 2-byte code performs access to temporary variables in enclosing
     lexical levels.  The 2nd byte consists of a 2-bit operation type, a
     2-bit lexical level, and a 4-bit temporary variable index"

     | descriptor opType lexicalLevel variableIndex |
     descriptor := self fetchByte.
     opType := (descriptor >> 6) bitAnd: 16r3.
     lexicalLevel := (descriptor >> 4) bitAnd: 16r3.
     variableIndex := descriptor bitAnd: 16rF.

     opType caseOf: {
          [0] -> [self pushTemporary: variableIndex level: lexicalLevel].
          [1] -> [self storeTemporary: variableIndex level: lexicalLevel].
          [2] -> [self storePopTemporary: variableIndex level: 
lexicalLevel].
     } otherwise: [self unknownBytecode].


-------------------------------
Bytecode 127 (currently unused)

doubleExtendedLexicalAccessBytecode
     "this 3-byte code performs access to temporary variables in enclosing
     lexical levels.  The 2nd byte consists of a 2-bit operation type and
     a 6-bit lexical level.  The 3rd byte is the variable index"

     | descriptor opType lexicalLevel variableIndex |
     descriptor := self fetchByte.
     opType := (descriptor >> 6) bitAnd: 16r3.
     lexicalLevel := descriptor bitAnd: 16r3F.
     variableIndex := self fetchByte.

     opType caseOf: {
          [0] -> [self pushTemporary: variableIndex level: lexicalLevel].
          [1] -> [self storeTemporary: variableIndex level: lexicalLevel].
          [2] -> [self storePopTemporary: variableIndex level: 
lexicalLevel].
     } otherwise: [self unknownBytecode].


--------------------------------

A value of 0 for the lexicalLevel signifies access to the current level, 
1 for the next enclosing level, etc.

     -- Tim Olson








More information about the Squeak-dev mailing list