1. poke({base,offset},x) form (Phix)
- Posted by petelomax Jan 29, 2015
- 1516 views
I am thinking of adding a poke({base,offset},x) form to Phix that performs additional safety checks, and wondered if the idea had any merit in OpenEuphoria.
If base did not originate from an allocate() call, it will immediately claim that memory corruption has occurred1. Otherwise, without keeping some huge "safe list", it can quickly check the sentinels are intact and that the requested operation lies within the permitted size. For all but the most critical inner loops it would have a sufficiently negligible overhead that it could be left in permanently. I am also toying with the idea of a three-parameter form to avoid the sequence construction overhead, which would require a specific but fairly trivial parse-time hack. Obviously the existing atom address form would be kept, for legacy code, those tight inner loops, and any OS-supplied memory blocks.
Thoughts, anyone? Clearly if OpenEuphoria currently does not have any kind of size/sentinel on allocate()'d blocks (I have no idea), it is a bit of a non starter (for you lot).
Pete
1 or crash trying to read non-existent sentinels, to pretty much the same effect.
2. Re: poke({base,offset},x) form (Phix)
- Posted by Ekhnat0n Jan 29, 2015
- 1434 views
I am thinking of adding a poke({base,offset},x) form to Phix that performs additional safety checks, and wondered if the idea had any merit in OpenEuphoria.
Thoughts, anyone? Clearly if OpenEuphoria currently does not have any kind of size/sentinel on allocate()'d blocks (I have no idea), it is a bit of a non starter (for you lot).
Pete
1 or crash trying to read non-existent sentinels, to pretty much the same effect.
What IF
1)base was a valid variable OR constant,
2)offset derived from the variable-table itself and
3)x a valid value that could
4)Phix things??
3. Re: poke({base,offset},x) form (Phix)
- Posted by mattlewis (admin) Jan 29, 2015
- 1406 views
I am thinking of adding a poke({base,offset},x) form to Phix that performs additional safety checks, and wondered if the idea had any merit in OpenEuphoria.
This sounds like possibly a variation on std/safe.e.
Matt
4. Re: poke({base,offset},x) form (Phix)
- Posted by petelomax Jan 30, 2015
- 1387 views
This sounds like possibly a variation on std/safe.e.
Yes, but without the exponential performance degradation, and with the ability both to apply it to a suspect block of (new) code only, and/or leave the checking in place in the production release.
Pete