<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>Hi Clément,<br></div><div><br>On Jan 6, 2016, at 7:28 AM, Clément Bera &lt;<a href="mailto:bera.clement@gmail.com">bera.clement@gmail.com</a>&gt; wrote:<br><br></div><blockquote type="cite"><div><span></span></div></blockquote><blockquote type="cite"><div><div dir="ltr">Ok.<div><br></div><div>According to my attempts, Stack and Cog Simulators are working fine (both Spur and SqueakV3). However the VM compiled to C crashes while trying to assign a block into an instance variable.</div><div><br></div><div>So something is still wrong.&nbsp;<br></div></div></div></blockquote><div><br></div><span style="background-color: rgba(255, 255, 255, 0);">Is the crash with immutability enabled or disabled? &nbsp;One thing I can think of trying is to</span><div><span style="background-color: rgba(255, 255, 255, 0);"><br></span></div><div><span style="background-color: rgba(255, 255, 255, 0);">a) revert the package to pre immutability, simulate a REPL image until it prompts for input and copy the contents of the code zone to a byte array</span></div><div><span style="background-color: rgba(255, 255, 255, 0);">b) revert the package back to immutability, with IMMUTABILITY disabled, simulate to the same point and look for differences in the code zone</span></div><div><span style="background-color: rgba(255, 255, 255, 0);"><br>_,,,^..^,,,_ (phone)</span><div><br><blockquote type="cite"><div><div class="gmail_extra"><br><div class="gmail_quote">2016-01-06 14:46 GMT+01:00  <span dir="ltr">&lt;<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:<br>
<a href="http://source.squeak.org/VMMaker/VMMaker.oscog-cb.1617.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/VMMaker/VMMaker.oscog-cb.1617.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: VMMaker.oscog-cb.1617<br>
Author: cb<br>
Time: 6 January 2016, 2:46:27.798 pm<br>
UUID: 81fe5b89-69de-45b8-9b65-f2f4a8bd187d<br>
Ancestors: VMMaker.oscog-rmacnak.1616<br>
<br>
As Eliot ntoed, I made a dumb mistake breking instance variable stores in the interpreter.<br>
<br>
This commit fixes the mistake. In addition, storing into an immutable object in a primitive now signals a no modification error instead of inappropriate error.<br>
<br>
I checked and the StackVMSimulator is working fine after this commit. Unfortunately, the CogVMSimulator does not work in my machine, likely due to other bugs. I am going to check that it works and that compilation to C works right now.<br>
<br>
=============== Diff against VMMaker.oscog-rmacnak.1616 ===============<br>
<br>
Item was changed:<br>
&nbsp; ----- Method: CoInterpreterPrimitives&gt;&gt;primitiveObjectAtPut (in category 'object access primitives') -----<br>
&nbsp; primitiveObjectAtPut<br>
&nbsp; &nbsp; &nbsp; &nbsp; "Store a literal into a CompiledMethod at the given index. Defined for CompiledMethods only."<br>
&nbsp; &nbsp; &nbsp; &nbsp; | thisReceiver rawHeader realHeader index newValue |<br>
&nbsp; &nbsp; &nbsp; &nbsp; newValue := self stackValue: 0.<br>
&nbsp; &nbsp; &nbsp; &nbsp; index := self stackValue: 1.<br>
&nbsp; &nbsp; &nbsp; &nbsp; (objectMemory isNonIntegerObject: index) ifTrue:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrBadArgument].<br>
&nbsp; &nbsp; &nbsp; &nbsp; index := objectMemory integerValueOf: index.<br>
&nbsp; &nbsp; &nbsp; &nbsp; thisReceiver := self stackValue: 2.<br>
&nbsp; &nbsp; &nbsp; &nbsp; self cppIf: IMMUTABILITY<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (objectMemory isImmutable: thisReceiver) ifTrue: [ ^self primitiveFailFor: PrimErrNoModification ] ].<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (objectMemory isImmutable: thisReceiver) ifTrue: [ ^self primitiveFailFor: PrimErrInappropriate ] ].<br>
&nbsp; &nbsp; &nbsp; &nbsp; rawHeader := self rawHeaderOf: thisReceiver.<br>
&nbsp; &nbsp; &nbsp; &nbsp; realHeader := (self isCogMethodReference: rawHeader)<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ifTrue: [(self cCoerceSimple: rawHeader to: #'CogMethod *') methodHeader]<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ifFalse: [rawHeader].<br>
&nbsp; &nbsp; &nbsp; &nbsp; (index &gt; 0<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;and: [index &lt;= ((objectMemory literalCountOfMethodHeader: realHeader) + LiteralStart)]) ifFalse:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrBadIndex].<br>
&nbsp; &nbsp; &nbsp; &nbsp; index = 1<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ifTrue:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [((objectMemory isNonIntegerObject: newValue)<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;or: [(objectMemory literalCountOfMethodHeader: newValue) ~= (objectMemory literalCountOfMethodHeader: realHeader)]) ifTrue:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrBadArgument].<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(self isCogMethodReference: rawHeader)<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ifTrue: [(self cCoerceSimple: rawHeader to: #'CogMethod *') methodHeader: newValue]<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ifFalse: [objectMemory storePointerUnchecked: 0 ofObject: thisReceiver withValue: newValue]]<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ifFalse:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [objectMemory storePointer: index - 1 ofObject: thisReceiver withValue: newValue].<br>
&nbsp; &nbsp; &nbsp; &nbsp; self pop: 3 thenPush: newValue!<br>
<br>
Item was changed:<br>
&nbsp; ----- Method: InterpreterPrimitives&gt;&gt;primitiveFloatAtPut (in category 'indexing primitives') -----<br>
&nbsp; primitiveFloatAtPut<br>
&nbsp; &nbsp; &nbsp; &nbsp; "Provide platform-independent access to 32-bit words comprising<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;a Float.&nbsp; Map index 1 onto the most significant word and index 2<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;onto the least significant word."<br>
&nbsp; &nbsp; &nbsp; &nbsp; | rcvr index oopToStore valueToStore |<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;var: #valueToStore type: #usqInt&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; oopToStore := self stackTop.<br>
&nbsp; &nbsp; &nbsp; &nbsp; valueToStore := self positive32BitValueOf: oopToStore.<br>
&nbsp; &nbsp; &nbsp; &nbsp; self successful ifFalse:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrBadArgument].<br>
&nbsp; &nbsp; &nbsp; &nbsp; rcvr := self stackValue: 2.<br>
&nbsp; &nbsp; &nbsp; &nbsp; index := self stackValue: 1.<br>
&nbsp; &nbsp; &nbsp; &nbsp; (objectMemory isImmediateFloat: rcvr) ifTrue:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrBadReceiver].<br>
&nbsp; &nbsp; &nbsp; &nbsp; self cppIf: IMMUTABILITY<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (objectMemory isImmutable: rcvr) ifTrue: [^self primitiveFailFor: PrimErrNoModification] ].<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (objectMemory isImmutable: rcvr) ifTrue: [^self primitiveFailFor: PrimErrBadReceiver] ].<br>
&nbsp; &nbsp; &nbsp; &nbsp; index = ConstOne ifTrue:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [objectMemory storeLong32: (VMBIGENDIAN ifTrue: [0] ifFalse: [1])<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ofObject: rcvr<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; withValue: valueToStore.<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^self pop: 3 thenPush: oopToStore].<br>
&nbsp; &nbsp; &nbsp; &nbsp; index = ConstTwo ifTrue:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [objectMemory storeLong32: (VMBIGENDIAN ifTrue: [1] ifFalse: [0])<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ofObject: rcvr<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; withValue: valueToStore.<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^self pop: 3 thenPush: oopToStore].<br>
&nbsp; &nbsp; &nbsp; &nbsp; self primitiveFailFor: ((objectMemory isIntegerObject: index)<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ifTrue: [PrimErrBadIndex]<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ifFalse: [PrimErrBadArgument])!<br>
<br>
Item was changed:<br>
&nbsp; ----- Method: InterpreterPrimitives&gt;&gt;primitiveIntegerAtPut (in category 'sound primitives') -----<br>
&nbsp; primitiveIntegerAtPut<br>
&nbsp; &nbsp; &nbsp; &nbsp; "Return the 32bit signed integer contents of a words receiver"<br>
&nbsp; &nbsp; &nbsp; &nbsp; | index rcvr sz addr value valueOop |<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;var: 'value' type: 'int'&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; valueOop := self stackValue: 0.<br>
&nbsp; &nbsp; &nbsp; &nbsp; index := self stackIntegerValue: 1.<br>
&nbsp; &nbsp; &nbsp; &nbsp; value := self signed32BitValueOf: valueOop.<br>
&nbsp; &nbsp; &nbsp; &nbsp; self successful ifFalse:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrBadArgument].<br>
&nbsp; &nbsp; &nbsp; &nbsp; rcvr := self stackValue: 2.<br>
&nbsp; &nbsp; &nbsp; &nbsp; (objectMemory isWords: rcvr) ifFalse:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrInappropriate].<br>
&nbsp; &nbsp; &nbsp; &nbsp; self cppIf: IMMUTABILITY "isWords: ensure non immediate"<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (objectMemory isImmutable: rcvr) ifTrue: [ ^self primitiveFailFor: PrimErrNoModification ] ].<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (objectMemory isImmutable: rcvr) ifTrue: [ ^self primitiveFailFor: PrimErrInappropriate ] ].<br>
&nbsp; &nbsp; &nbsp; &nbsp; sz := objectMemory lengthOf: rcvr.&nbsp; "number of fields"<br>
&nbsp; &nbsp; &nbsp; &nbsp; (index &gt;= 1 and: [index &lt;= sz]) ifFalse:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrBadIndex].<br>
&nbsp; &nbsp; &nbsp; &nbsp; "4 = 32 bits / 8"<br>
&nbsp; &nbsp; &nbsp; &nbsp; addr := rcvr + objectMemory baseHeaderSize + (index - 1 * 4). "for zero indexing"<br>
&nbsp; &nbsp; &nbsp; &nbsp; value := objectMemory intAt: addr put: value.<br>
&nbsp; &nbsp; &nbsp; &nbsp; self pop: 3 thenPush: valueOop "pop all; return value"<br>
&nbsp; !<br>
<br>
Item was changed:<br>
&nbsp; ----- Method: InterpreterPrimitives&gt;&gt;primitiveObjectAtPut (in category 'object access primitives') -----<br>
&nbsp; primitiveObjectAtPut<br>
&nbsp; &nbsp; &nbsp; &nbsp; "Store a literal into a CompiledMethod at the given index. Defined for CompiledMethods only."<br>
&nbsp; &nbsp; &nbsp; &nbsp; | thisReceiver index newValue |<br>
&nbsp; &nbsp; &nbsp; &nbsp; newValue := self stackValue: 0.<br>
&nbsp; &nbsp; &nbsp; &nbsp; index := self stackValue: 1.<br>
&nbsp; &nbsp; &nbsp; &nbsp; ((objectMemory isNonIntegerObject: index)<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;or: [index = ConstOne and: [(objectMemory isNonIntegerObject: newValue)]]) ifTrue:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrBadArgument].<br>
&nbsp; &nbsp; &nbsp; &nbsp; index := objectMemory integerValueOf: index.<br>
&nbsp; &nbsp; &nbsp; &nbsp; thisReceiver := self stackValue: 2.<br>
&nbsp; &nbsp; &nbsp; &nbsp; self cppIf: IMMUTABILITY<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (objectMemory isImmutable: thisReceiver) ifTrue: [ ^self primitiveFailFor: PrimErrNoModification ] ].<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (objectMemory isImmutable: thisReceiver) ifTrue: [ ^self primitiveFailFor: PrimErrInappropriate ] ].<br>
&nbsp; &nbsp; &nbsp; &nbsp; (index &gt; 0 and: [index &lt;= ((objectMemory literalCountOf: thisReceiver) + LiteralStart)]) ifFalse:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrBadIndex].<br>
&nbsp; &nbsp; &nbsp; &nbsp; objectMemory storePointer: index - 1 ofObject: thisReceiver withValue: newValue.<br>
&nbsp; &nbsp; &nbsp; &nbsp; self pop: 3 thenPush: newValue!<br>
<br>
Item was changed:<br>
&nbsp; ----- Method: InterpreterPrimitives&gt;&gt;primitiveShortAtPut (in category 'sound primitives') -----<br>
&nbsp; primitiveShortAtPut<br>
&nbsp; &nbsp; &nbsp; &nbsp; "Treat the receiver, which can be indexible by either bytes or words, as an array<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;of signed 16-bit values. Set the contents of the given index to the given value.<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Note that the index specifies the i-th 16-bit entry, not the i-th byte or word."<br>
<br>
&nbsp; &nbsp; &nbsp; &nbsp; | index rcvr value |<br>
&nbsp; &nbsp; &nbsp; &nbsp; value := self stackTop.<br>
&nbsp; &nbsp; &nbsp; &nbsp; index := self stackValue: 1.<br>
&nbsp; &nbsp; &nbsp; &nbsp; ((objectMemory isIntegerObject: value)<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;and: [(objectMemory isIntegerObject: index)<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;and: [value := objectMemory integerValueOf: value.<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (value &gt;= -32768) and: [value &lt;= 32767]]]) ifFalse:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrBadArgument].<br>
&nbsp; &nbsp; &nbsp; &nbsp; rcvr := self stackValue: 2.<br>
&nbsp; &nbsp; &nbsp; &nbsp; (objectMemory isWordsOrBytes: rcvr) ifFalse:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrInappropriate].<br>
&nbsp; &nbsp; &nbsp; &nbsp; self cppIf: IMMUTABILITY "isWordsOrBytes ensure non immediate"<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (objectMemory isImmutable: rcvr) ifTrue: [ ^self primitiveFailFor: PrimErrNoModification ] ].<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (objectMemory isImmutable: rcvr) ifTrue: [ ^self primitiveFailFor: PrimErrInappropriate ] ].<br>
&nbsp; &nbsp; &nbsp; &nbsp; index := objectMemory integerValueOf: index.<br>
&nbsp; &nbsp; &nbsp; &nbsp; (index &gt;= 1 and: [index &lt;= (objectMemory num16BitUnitsOf: rcvr)]) ifFalse:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrBadIndex].<br>
&nbsp; &nbsp; &nbsp; &nbsp; objectMemory storeShort16: index - 1 ofObject: rcvr withValue: value.<br>
&nbsp; &nbsp; &nbsp; &nbsp; self pop: 3 thenPush: (objectMemory integerObjectOf: value)!<br>
<br>
Item was changed:<br>
&nbsp; ----- Method: SpurMemoryManager&gt;&gt;isOopValidBecome: (in category 'become implementation') -----<br>
&nbsp; isOopValidBecome: oop<br>
&nbsp; &nbsp; &nbsp; &nbsp; "Answers 0 if the oop can be become.<br>
&nbsp; &nbsp; &nbsp; &nbsp; Answers an error code in the other case"<br>
&nbsp; &nbsp; &nbsp; &nbsp; (self isImmediate: oop) ifTrue: [^PrimErrInappropriate].<br>
&nbsp; &nbsp; &nbsp; &nbsp; (self isPinned: oop) ifTrue: [^PrimErrObjectIsPinned].<br>
&nbsp; &nbsp; &nbsp; &nbsp; self<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cppIf: IMMUTABILITY<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (self isImmutable: oop) ifTrue: [^PrimErrNoModification] ].<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (self isImmutable: oop) ifTrue: [^PrimErrInappropriate] ].<br>
&nbsp; &nbsp; &nbsp; &nbsp; ^ 0!<br>
<br>
Item was changed:<br>
&nbsp; ----- Method: StackInterpreter&gt;&gt;extendedStoreAndPopBytecode (in category 'stack bytecodes') -----<br>
&nbsp; extendedStoreAndPopBytecode<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;inline: true&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; self extendedStoreBytecodePop: true<br>
+&nbsp; &nbsp; &nbsp; &nbsp;"may not be reached (immutable receiver)"!<br>
- !<br>
<br>
Item was changed:<br>
&nbsp; ----- Method: StackInterpreter&gt;&gt;extendedStoreBytecode (in category 'stack bytecodes') -----<br>
&nbsp; extendedStoreBytecode<br>
&nbsp; &nbsp; &nbsp; &nbsp; &lt;inline: true&gt;<br>
+&nbsp; &nbsp; &nbsp; &nbsp;self extendedStoreBytecodePop: false<br>
+&nbsp; &nbsp; &nbsp; &nbsp;"may not be reached (immutable receiver)"!<br>
-&nbsp; &nbsp; &nbsp; &nbsp;self extendedStoreBytecodePop: false!<br>
<br>
Item was changed:<br>
&nbsp; ----- Method: StackInterpreter&gt;&gt;storeAndPopReceiverVariableBytecode (in category 'stack bytecodes') -----<br>
&nbsp; storeAndPopReceiverVariableBytecode<br>
&nbsp; &nbsp; &nbsp; &nbsp; "Note: This code uses<br>
&nbsp; &nbsp; &nbsp; &nbsp; storePointerUnchecked:ofObject:withValue: and does the<br>
&nbsp; &nbsp; &nbsp; &nbsp; store check explicitely in order to help the translator<br>
&nbsp; &nbsp; &nbsp; &nbsp; produce better code."<br>
&nbsp; &nbsp; &nbsp; &nbsp; | rcvr top |<br>
&nbsp; &nbsp; &nbsp; &nbsp; rcvr := self receiver.<br>
&nbsp; &nbsp; &nbsp; &nbsp; top := self internalStackTop.<br>
&nbsp; &nbsp; &nbsp; &nbsp; self internalPop: 1.<br>
+&nbsp; &nbsp; &nbsp; &nbsp;self<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cCode: "Slang will inline currentBytecode to a constant so this will work in C"<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[self fetchNextBytecode.<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; objectMemory<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;storePointerImmutabilityCheck: (currentBytecode bitAnd: 7)<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ofObject: rcvr<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;withValue: top]<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;inSmalltalk: "But in Smalltalk we must use the currentBytecode's value, not the next.<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;We cant use the following code when generating C code as slang<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;won't inline currentBytecode correctly due to the extra temp."<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[ | instVarIndex |<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; instVarIndex := currentBytecode bitAnd: 7.<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self fetchNextBytecode.<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; objectMemory<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;storePointerImmutabilityCheck: instVarIndex<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ofObject: rcvr<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;withValue: top]!<br>
-&nbsp; &nbsp; &nbsp; &nbsp;self fetchNextBytecode.<br>
-&nbsp; &nbsp; &nbsp; &nbsp;objectMemory storePointerImmutabilityCheck: (currentBytecode bitAnd: 7) ofObject: rcvr withValue: top.!<br>
<br>
Item was changed:<br>
&nbsp; ----- Method: StackInterpreterPrimitives&gt;&gt;primitiveInstVarAtPut (in category 'object access primitives') -----<br>
&nbsp; primitiveInstVarAtPut<br>
&nbsp; &nbsp; &nbsp; &nbsp; | newValue index rcvr hdr fmt totalLength fixedFields |<br>
&nbsp; &nbsp; &nbsp; &nbsp; newValue := self stackTop.<br>
&nbsp; &nbsp; &nbsp; &nbsp; index := self stackValue: 1.<br>
&nbsp; &nbsp; &nbsp; &nbsp; rcvr := self stackValue: 2.<br>
&nbsp; &nbsp; &nbsp; &nbsp; ((objectMemory isNonIntegerObject: index)<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;or: [argumentCount &gt; 2 "e.g. object:instVarAt:put:"<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; and: [objectMemory isOopForwarded: rcvr]]) ifTrue:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrBadArgument].<br>
+&nbsp; &nbsp; &nbsp; &nbsp;(objectMemory isImmediate: rcvr) ifTrue: [ ^ self primitiveFailFor: PrimErrInappropriate].<br>
+&nbsp; &nbsp; &nbsp; &nbsp;self<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;cppIf: IMMUTABILITY<br>
+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (objectMemory isImmutable: rcvr) ifTrue: [ ^ self primitiveFailFor: PrimErrNoModification] ].<br>
-&nbsp; &nbsp; &nbsp; &nbsp;self cppIf: IMMUTABILITY<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifTrue: [ (objectMemory isOopImmutable: rcvr) ifTrue: [^self primitiveFailFor: PrimErrInappropriate] ]<br>
-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ifFalse: [ (objectMemory isImmediate: rcvr) ifTrue: [^self primitiveFailFor: PrimErrInappropriate] ].<br>
&nbsp; &nbsp; &nbsp; &nbsp; index := objectMemory integerValueOf: index.<br>
&nbsp; &nbsp; &nbsp; &nbsp; hdr := objectMemory baseHeader: rcvr.<br>
&nbsp; &nbsp; &nbsp; &nbsp; fmt := objectMemory formatOfHeader: hdr.<br>
&nbsp; &nbsp; &nbsp; &nbsp; totalLength := objectMemory lengthOf: rcvr baseHeader: hdr format: fmt.<br>
&nbsp; &nbsp; &nbsp; &nbsp; fixedFields := objectMemory fixedFieldsOf: rcvr format: fmt length: totalLength.<br>
&nbsp; &nbsp; &nbsp; &nbsp; (index &gt;= 1 and: [index &lt;= fixedFields]) ifFalse:<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [^self primitiveFailFor: PrimErrBadIndex].<br>
&nbsp; &nbsp; &nbsp; &nbsp; (fmt = objectMemory indexablePointersFormat<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;and: [objectMemory isContextHeader: hdr])<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ifTrue: [self externalInstVar: index - 1 ofContext: rcvr put: newValue]<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ifFalse: [self subscript: rcvr with: index storing: newValue format: fmt].<br>
&nbsp; &nbsp; &nbsp; &nbsp; self pop: argumentCount + 1 thenPush: newValue!<br>
<br>
</blockquote></div><br></div>
</div></blockquote></div></div></body></html>