Ticket #1062 (closed patch: fixed)

Opened 5 years ago

Last modified 5 years ago

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?

Attachments

obj_alive.patch Download (33.4 KB) - added by NotFound 5 years ago.

Change History

Changed 5 years ago by NotFound

Changed 5 years ago by NotFound

  • owner set to NotFound
  • status changed from new to assigned
  • patch set to applied

After hearing favorable comments on irc, committed in r41447, I'll close the ticket in few days if no one objects.

Changed 5 years ago by chromatic

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.