poke({base,offset},x) form (Phix)

new topic     » topic index » view thread      » older message » newer message

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.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu