Call stxCompiledCodeObjectOBJVectorModified() when an object vector section is modified
authorJan Vrany <jan.vrany@fit.cvut.cz>
Sun, 12 Jun 2016 12:12:51 +0100
changeset 20 7f2660be9066
parent 19 51a3540a2a10
child 21 7d99b51b4784
Call stxCompiledCodeObjectOBJVectorModified() when an object vector section is modified This is necessary to tell the VM that data changed so it can update its internal housekeeping data. References to from object vector sections have to be updated when a GC moves object around.
CompiledCodeObjectSection.st
--- a/CompiledCodeObjectSection.st	Thu Apr 21 09:58:19 2016 +0100
+++ b/CompiledCodeObjectSection.st	Sun Jun 12 12:12:51 2016 +0100
@@ -160,16 +160,20 @@
         goto error;    
     }
     _format = __intVal(__INST(format));
-
-    switch ( __intVal( __INST(format) ) ) {
+    switch ( _format ) {
         case SectionFormatOBJVector:
             {
                 if ( (_index < 0) || ( _index >= (_size / sizeof(OBJ)) ) )  {
                     failureReason = @symbol(BadArg1OutOfBounds);
                     goto error;
                 }
+                if ( ! __isExternalAddress(__INST(object)) ) {
+                    failureReason = @symbol(BadObject);
+                    goto error;                
+                }
                 OBJ *vector = (OBJ*)(__externalAddressVal(self));                
                 vector[_index] = value;
+                stxCompiledCodeObjectOBJVectorModified(__externalAddressVal(__INST(object)));
                 RETURN ( value );
             }
             break;