Note that these tests cause multiple failures in a recent VM at the time of writing:<br>
<br>
- #testPrimitive100/{'not a selector'. {}. Object}: The VM sends #doesNotUnderstand: to the receiver with an invalid selector whereas the simulator has the primitive failed as expected in Object>>perform:withArguments:inSuperclass:. What behavior do we want? (I would opt for the latter one.)<br>
- #testPrimitive118/{6. 'not a primitive'. {7}},{6. 9. 'not an array'}: The VM returns an error code of -3 whereas the simulator returns no error code (nil). I have adjust this behavior in the simulator via Kernel-ct.1420.<br>
- #testPrimitive118/{6. 118. {9. {7. 13}}}: The VM does not check the number of arguments but ignores the first one whereas the simulator has the primitive failed with #'bad number of arguments'. What behavior do we want? (I would opt for the latter one.)<br>
- #testPrimitive118/2: Context>>receiver:tryPrimitive:withArgs: seems pretty buggy; not all arguments are popped from the stack and there occur several serious stack invalidations.<br>
<br>
In my opinion most of these issues need to be addressed in the VM; if a new release wasn't just around the corner, it would be my pleasure to use these failures as some good starter entrypoints into the VMMaker project during Christmas or so. But if we are in a hurry, probably someone else wants to fix these issues earlier. Or we just mark the relevant tests as expected failures for now.<br>
<br>
PS: Please don't ask me why the diff was not sent to the list this time. There should not be any special characters!<br>
<br>
<br>
<b>==================== Summary ====================</b><br>
<br>
Name: KernelTests-ct.409<br>
Author: ct<br>
Time: 10 November 2021, 1:45:40.105242 am<br>
UUID: ab3db7b1-d980-5b4b-80a2-8c08bef9b23b<br>
Ancestors: KernelTests-mt.407<br>
<br>
Adds new simulation tests for the reflection primitives 117 (primitiveExternalCall), 118 (primitiveDoPrimitiveWithArgs), and 218 (primitiveDoNamedPrimitiveWithArgs) and revises existing tests for the primitives 83 (primitivePerform), 84 (primitivePerformWithArgs), and 100 (primitivePerformInSuperclass) which do not need to be dispatched via primitive 118.<br>
<br>
<b>=============== Diff against KernelTests-mt.407 ===============</b><br>
<br>
<b>ContextTest>>testPrimitive100 {tests} · ct 11/10/2021 00:38 (changed)</b><br>
testPrimitive100<br>
<br>
    {<br>
        {#isNil. {}. Object}. "valid 0-arg message"<br>
        {#=. {true}. UndefinedObject}. "valid unary message"<br>
        {#ifNil:ifNotNil:. {[2]. [:x | x]}. Object}. "valid binary message"<br>
        {{}. #=. {true}. SequenceableCollection}. "mirror primitive"<br>
<s><font color="#0000FF">-         {#isNil}. "missing arguments"<br>
-         {#isNil. 'not an array'}. "invalid arguments"<br>
-         {#isNil. {}}. "missing lookupClass"<br>
</font></s><font color="#FF0000">+         {'not a selector'. {}. Object}. "invalid selector"<br>
+         {#isNil. 'not an array'. Object}. "invalid arguments"<br>
</font>        {#isNil. {'excess arg'}. Object}. "too many arguments"<br>
        {#=. {}. UndefinedObject}. "missing argument"<br>
<font color="#FF0000">+         {#isNil. {}. 'not a class'}. "invalid lookupClass"<br>
</font>        {#isNil. {}. Boolean}. "lookupClass not in inheritance chain"<br>
<s><font color="#0000FF">-     } do: [:args |<br>
</font></s><font color="#FF0000">+     } do: [:args | | block |<br>
+         block := [[nil<br>
+             perform: args first<br>
+             withArguments: args second<br>
+             inSuperclass: args third]<br>
+                 on: Error do: [:ex | ex messageText]].<br>
</font>        self<br>
<s><font color="#0000FF">-             assert: (nil tryPrimitive: 100 withArgs: args)<br>
-             equals: (Context runSimulated: [nil tryPrimitive: 100 withArgs: args])].<br>
</font></s><font color="#FF0000">+             assert: block value<br>
+             equals: (Context runSimulated: block).<br>
+         <br>
+         block := [[thisContext<br>
+             object: nil<br>
+             perform: args first<br>
+             withArguments: args second<br>
+             inClass: args third]<br>
+                 on: Error do: [:ex | ex messageText]].<br>
+         self<br>
+             assert: block value<br>
+             equals: (Context runSimulated: block)].</font><br>
<br>
<b>ContextTest>>testPrimitive117 {tests} · ct 11/10/2021 00:10</b><br>
<font color="#FF0000">+ testPrimitive117<br>
+ <br>
+     | input1 input2 |<br>
+     "valid 0-arg primitive"<br>
+     self<br>
+         assert: #isNil size<br>
+         equals: (Context runSimulated: [#isNil size]).<br>
+     <br>
+     "valid unary primitive"<br>
+     self<br>
+         assert: 6 + 9<br>
+         equals: (Context runSimulated: [6 + 9]).<br>
+     <br>
+     "superfluous arguments"<br>
+     self "cascade!"<br>
+         assert: 6 + 9<br>
+             equals: (Context runSimulated: [6 + 9]);<br>
+         assert: true.<br>
+     <br>
+     self<br>
+         assert: ((input1 := {1. 2. 3}) at: 2 put: 4)<br>
+             equals: (Context runSimulated: [(input2 := {1. 2. 3}) at: 2 put: 4]);<br>
+         assert: input1<br>
+             equals: input2.</font><br>
<br>
<b>ContextTest>>testPrimitive118 {tests} · ct 11/10/2021 00:56</b><br>
<font color="#FF0000">+ testPrimitive118<br>
+ <br>
+     self testPrimitive118: [:receiver :primitiveIndex :arguments |<br>
+         receiver tryPrimitive: primitiveIndex withArgs: arguments].<br>
+     <br>
+     self testPrimitive118: [:receiver :primitiveIndex :arguments |<br>
+         thisContext receiver: receiver tryPrimitive: primitiveIndex withArgs: arguments].</font><br>
<br>
<b>ContextTest>>testPrimitive118: {tests} · ct 11/10/2021 01:23</b><br>
<font color="#FF0000">+ testPrimitive118: primitiveBlock<br>
+ <br>
+     | input1 input2 |<br>
+     {<br>
+         {#isNil. 62. {}}. "valid 0-arg primitive"<br>
+         {6. 9. {7}}. "valid unary primitive"<br>
+         {6. 62. {7}}. "failing primitive"<br>
+         {6. 'not a primitive'. {7}}. "invalid primitive"<br>
+         {6. 9. 'not an array'}. "invalid arguments"<br>
+         {#isNil. 62. {1}}. "too many arguments"<br>
+         {6. 9. {}}. "missing argument"<br>
+         <br>
+         {nil. 83. {#=. true}}. "primitivePerform"<br>
+         {nil. 83. {#isNil. 'excess arg'}}. "primitivePerform - too many arguments"<br>
+         {nil. 84. {#=. {true}}}. "primitivePerformWithArgs"<br>
+         {nil. 84. {#isNil. 'excess arg'}}. "primitivePerformWithArgs - invalid arguments"<br>
+         {nil. 100. {#=. true. Object}}. "primitivePerformInSuperclass"<br>
+         {nil. 100. {#isNil. {'excess arg'}. Object}}. "primitivePerformInSuperclass - too many arguments"<br>
+         <br>
+         {6. 118. {9. {7}}}. "primitiveDoPrimitiveWithArgs"<br>
+         {6. 118. {9. {7. 13}}}. "primitiveDoPrimitiveWithArgs - superfluous arguments"<br>
+         {6. 118. {118. {9. {7}}}}. "primitiveDoPrimitiveWithArgs - M3"<br>
+         {thisContext. 218. {Float32Array >> #sum. Float32Array withAll: {2.0. 3.0}. {}}}. "primitiveDoNamedPrimitiveWithArgs"<br>
+         {thisContext. 218. {Float32Array >> #sum. Float32Array withAll: {2.0. 3.0}. {4.0}}}. "primitiveDoNamedPrimitiveWithArgs - superfluous arguments"<br>
+     } do: [:args | | block |<br>
+         block := [primitiveBlock valueWithArguments: args].<br>
+         self<br>
+             assert: block value<br>
+             equals: (Context runSimulated: block)].<br>
+     <br>
+     self<br>
+         assert: (primitiveBlock value: (input1 := {1. 2. 3}) value: 61 value: {2. 4})<br>
+             equals: (Context runSimulated: [primitiveBlock value: (input2 := {1. 2. 3}) value: 61 value: {2. 4}]);<br>
+         assert: input1<br>
+             equals: input2.</font><br>
<br>
<b>ContextTest>>testPrimitive218 {tests} · ct 11/10/2021 00:13</b><br>
<font color="#FF0000">+ testPrimitive218<br>
+ <br>
+     "valid 0-arg primitive"<br>
+     self<br>
+         assert: (Float32Array withAll: {2.0. 3.0}) sum<br>
+         equals: (Context runSimulated: [(Float32Array withAll: {2.0. 3.0}) sum]).<br>
+     <br>
+     "valid unary primitive"<br>
+     self<br>
+         assert: 'wiffy' = 'wiffy' copy<br>
+             equals: (Context runSimulated: ['wiffy' = 'wiffy' copy]);<br>
+         assert: 'wiffy' = 'ziffy'<br>
+             equals: (Context runSimulated: ['wiffy' = 'ziffy']).<br>
+     <br>
+     "superfluous arguments"<br>
+     self "cascade!"<br>
+         assert: 'wiffy' = 'wiffy' copy<br>
+             equals: (Context runSimulated: ['wiffy' = 'wiffy' copy]);<br>
+         assert: true.</font><br>
<br>
<b>ContextTest>>testPrimitive83 {tests} · ct 11/10/2021 00:24 (changed)</b><br>
testPrimitive83<br>
<br>
    {<br>
<s><font color="#0000FF">-         {#isNil}. "valid 0-arg message"<br>
-         {#=. true}. "valid unary message"<br>
-         {#ifNil:ifNotNil:. [2]. [:x | x]}. "valid binary message"<br>
-         {#isNil. 'excess arg'}. "too many arguments"<br>
-         {#=}. "missing argument"<br>
-     } do: [:args |<br>
</font></s><font color="#FF0000">+         [nil perform: #isNil]. "valid 0-arg message"<br>
+         [nil perform: #= with: true]. "valid unary message"<br>
+         [nil perform: #ifNil:ifNotNil: with: [2] with: [:x | x]]. "valid binary message"<br>
+         [nil perform: #isNil with: 'excess arg']. "too many arguments"<br>
+         [nil perform: #=]<br>
+     } do: [:block |<br>
</font>        self<br>
<s><font color="#0000FF">-             assert: (nil tryPrimitive: 83 withArgs: args)<br>
-             equals: (Context runSimulated: [nil tryPrimitive: 83 withArgs: args])].<br>
</font></s><font color="#FF0000">+             assert: (block on: Error do: [:ex | ex messageText])<br>
+             equals: (Context runSimulated: [block on: Error do: [:ex | ex messageText]])].</font><br>
<br>
<b>ContextTest>>testPrimitive84 {tests} · ct 11/10/2021 00:21 (changed)</b><br>
testPrimitive84<br>
<br>
    {<br>
        {#isNil. {}}. "valid 0-arg message"<br>
        {#=. {true}}. "valid unary message"<br>
        {#ifNil:ifNotNil:. {[2]. [:x | x]}}. "valid binary message"<br>
<s><font color="#0000FF">-         {#isNil}. "missing arguments"<br>
</font></s>        {#isNil. 'not an array'}. "invalid arguments"<br>
        {#isNil. {'excess arg'}}. "too many arguments"<br>
        {#=. {}}. "missing argument"<br>
    } do: [:args |<br>
        self<br>
<s><font color="#0000FF">-             assert: (nil tryPrimitive: 84 withArgs: args)<br>
-             equals: (Context runSimulated: [nil tryPrimitive: 84 withArgs: args])].<br>
</font></s><font color="#FF0000">+             assert: ([nil perform: args first withArguments: args second] on: Error do: [:ex | ex messageText])<br>
+             equals: (Context runSimulated: [[nil perform: args first withArguments: args second] on: Error do: [:ex | ex messageText]])].<br>
<br>
</font><font color="#808080">---<br>
</font><font color="#808080"><i>Sent from </i></font><font color="#808080"><i><a href="https://github.com/hpi-swa-lab/squeak-inbox-talk"><u><font color="#808080">Squeak Inbox Talk</font></u></a></i></font>