**Step 7. After updating with (string) value of 678 of obj with id 00FA - S07:**
Enter a string *678 in Value field and object id 00FA in the ID filed and press update button.
The update can update the object in place since it is shorter and leaves enough of unused in-place space for putting the admin info there.
No change in the object pointers, only length and object data, and not anymore used fraction. Same sized objects are also updated in place.
@ 0022..0029 - updated object
@ 0022: 00 - (string) object type - UNCHANGED
@ 0023..0024: 05 - new length information
@ 0025..0026: 00FA - object ptr / id - UNCHANGED
@ 0027..0029: 6 7 8 - updated object value
@ 002A..0030 - 'new' unused object as 'built' from the not anymore used in place space
@ 002A: 80 - indicator of a new unused object (space)
@ 002B..002C: 0004 - length of unused object (space) - Note: no object id / ptr there
@ 003D..0030: 4 bytes from the old object data - UNCHANGED
@ 00FA..00FB: 0022 - object data addr at obj ptr / id - UNCHANGED
**Step 8. After updating with (string) value of 1234 of obj with id 00FA - S08:**
Enter a string *1234 in Value field and object id 00FA in the ID filed and press update button.
The update cannot update the object in place anymore since it longer. The old object space is marked as unused,
a new space is claimed, and the object data addr at the object pointer / id is updated.
@ 0031..0039 - updated object
@ 0022..0029 - old object value marked as deleted / garbage collectible
@ 00FA..00FB: 0031 - new object data addr at obj ptr / id
Step 9. After garbage collection - S09:
Press gc button
All unused object space are purge by moving remaining active object next to each other, and the object data pointers are updated.
Another needed feature I did not implement yet is the data type 01: *keyed* or named (string) objects. Because after a reset, the application has to be able to retrieve object ids in order to re-access them. This feature can be implemented in a first step by storing an array of object ids in a (string) object as the very first object, because the id of this TOC (table of content) (string) object's id is always size of the memory - 2.
So much for now. Some more doc will follow / updated.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
**Step 7. After updating with (string) value of 678 of obj with id 00FA - S07:**
Enter a string *678 in Value field and object id 00FA in the ID filed and press update button.
The update can update the object in place since it is shorter and leaves enough of unused in-place space for putting the admin info there.
No change in the object pointers, only length and object data, and not anymore used fraction. Same sized objects are also updated in place.
@ 0022..0029 - updated object
@ 0022: 00 - (string) object type - UNCHANGED
@ 0023..0024: 05 - new length information
@ 0025..0026: 00FA - object ptr / id - UNCHANGED
@ 0027..0029: 6 7 8 - updated object value
@ 002A..0030 - 'new' unused object as 'built' from the not anymore used in place space
@ 002A: 80 - indicator of a new unused object (space)
@ 002B..002C: 0004 - length of unused object (space) - Note: no object id / ptr there
@ 003D..0030: 4 bytes from the old object data - UNCHANGED
@ 00FA..00FB: 0022 - object data addr at obj ptr / id - UNCHANGED
**Step 8. After updating with (string) value of 1234 of obj with id 00FA - S08:**
Enter a string *1234 in Value field and object id 00FA in the ID filed and press update button.
The update cannot update the object in place anymore since it longer. The old object space is marked as unused,
a new space is claimed, and the object data addr at the object pointer / id is updated.
@ 0031..0039 - updated object
@ 0022..0029 - old object value marked as deleted / garbage collectible
@ 00FA..00FB: 0031 - new object data addr at obj ptr / id
Step 9. After garbage collection - S09:
Press gc button
All unused object space are purge by moving remaining active object next to each other, and the object data pointers are updated.
Another needed feature I did not implement yet is the data type 01: *keyed* or named (string) objects. Because after a reset, the application has to be able to retrieve object ids in order to re-access them. This feature can be implemented in a first step by storing an array of object ids in a (string) object as the very first object, because the id of this TOC (table of content) (string) object's id is always size of the memory - 2.
So much for now. Some more doc will follow / updated.
3 Attachments