Ticket #1062 (closed patch: fixed)
Type safe mark alive
Reported by: | NotFound | Owned by: | NotFound |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | GC | Version: | 1.6.0 |
Severity: | low | Keywords: | |
Cc: | Language: | ||
Patch status: | applied | Platform: |
Description
Some weeks ago einstein located a point where a pointer to non-PObj was used to call Parrot_mark_PObj_alive. Those failures are not catched by the compiler because in most cases we are marking STRING* and PMC*, and thus using a casting to PObj.
A solution is to add two new functions, one for PMC and one for STRING, use that functions in most places and drop the casts. That way most mistakes will be easily catched by the compilers.
The attached patch does that. In addition the functions allow for NULL and PMCNULL arguments, shortening the code that uses them.
The real functions are hidden by a macro and are used only in non optimized builds. In optimized the macro calls Parrot_mark_PObj_alive with the appropiate typecast and nullness check.
Someone has some objection against that?