Skip to content

Instantly share code, notes, and snippets.

@bacek
Created May 9, 2011 02:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bacek/961919 to your computer and use it in GitHub Desktop.
Save bacek/961919 to your computer and use it in GitHub Desktop.
Alternative patch for gms
diff --git a/src/gc/gc_gms.c b/src/gc/gc_gms.c
index 88b9956..48d2e28 100644
--- a/src/gc/gc_gms.c
+++ b/src/gc/gc_gms.c
@@ -1511,6 +1511,8 @@ establish if *ptr is.owned
*/
+#define INVALID_PTR_MASK (PTR_SIZE - 1)
+
static int
gc_gms_is_pmc_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
{
@@ -1521,7 +1523,7 @@ gc_gms_is_pmc_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
size_t i;
/* Not aligned pointers aren't pointers */
- if (!obj || !item || ((int)obj & 3) || ((int)item & 3))
+ if (!obj || !item || ((int)obj & INVALID_PTR_MASK) || ((int)item & INVALID_PTR_MASK))
return 0;
if (!Parrot_gc_pool_is_maybe_owned(interp, self->pmc_allocator, item))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment