js/public/GCAnnotations.h
author Wes Kocher <wkocher@mozilla.com>
Tue, 31 May 2016 11:15:41 -0700
changeset 299786 69518db96a4dd3e483a679a0e8e628184c7c218a
parent 299773 95107c3ad9cf5a173a17aee4fcd8635defbf0eb4
child 299805 4fac61d360ab51b4a9f908af5e0a285a102434fd
permissions -rw-r--r--
Backed out 22 changesets (bug 1259850) for GC crashes in various tests CLOSED TREE Backed out changeset ef5cdcca45d9 (bug 1259850) Backed out changeset c95bdd426ced (bug 1259850) Backed out changeset a73f74f718e7 (bug 1259850) Backed out changeset 95107c3ad9cf (bug 1259850) Backed out changeset 788ac18818c9 (bug 1259850) Backed out changeset 19c13aa9b5ad (bug 1259850) Backed out changeset 0b9dedcf7163 (bug 1259850) Backed out changeset b641d01138ab (bug 1259850) Backed out changeset aa434447a11b (bug 1259850) Backed out changeset 4c7373c6c29e (bug 1259850) Backed out changeset 457cb29cad55 (bug 1259850) Backed out changeset 5762a8fba027 (bug 1259850) Backed out changeset 129559d4ac62 (bug 1259850) Backed out changeset d00b9c8a7984 (bug 1259850) Backed out changeset 266befcb8acd (bug 1259850) Backed out changeset c6615c7b0083 (bug 1259850) Backed out changeset 196ac1f813f9 (bug 1259850) Backed out changeset b6108a65dc38 (bug 1259850) Backed out changeset 0d58f8529b86 (bug 1259850) Backed out changeset a8d2730ada95 (bug 1259850) Backed out changeset e8544b072ee6 (bug 1259850) Backed out changeset 15de0d1d0b05 (bug 1259850)

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 * vim: set ts=8 sts=4 et sw=4 tw=99:
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef js_GCAnnotations_h
#define js_GCAnnotations_h

// Set of annotations for the rooting hazard analysis, used to categorize types
// and functions.
#ifdef XGILL_PLUGIN

// Mark a type as being a GC thing (eg js::gc::Cell has this annotation).
# define JS_HAZ_GC_THING __attribute__((tag("GC Thing")))

// Mark a type as holding a pointer to a GC thing (eg JS::Value has this
// annotation.)
# define JS_HAZ_GC_POINTER __attribute__((tag("GC Pointer")))

// Mark a type as a rooted pointer, suitable for use on the stack (eg all
// Rooted<T> instantiations should have this.)
# define JS_HAZ_ROOTED __attribute__((tag("Rooted Pointer")))

// Mark a type as something that should not be held live across a GC, but which
// is itself not a GC pointer.
# define JS_HAZ_GC_INVALIDATED __attribute__((tag("Invalidated by GC")))

// Mark a type that would otherwise be considered a GC Pointer (eg because it
// contains a JS::Value field) as a non-GC pointer. It is handled almost the
// same in the analysis as a rooted pointer, except it will not be reported as
// an unnecessary root if used across a GC call. This should rarely be used,
// but makes sense for something like ErrorResult, which only contains a GC
// pointer when it holds an exception (and it does its own rooting,
// conditionally.)
# define JS_HAZ_NON_GC_POINTER __attribute__((tag("Suppressed GC Pointer")))

// Mark a function as something that runs a garbage collection, potentially
// invalidating GC pointers.
# define JS_HAZ_GC_CALL __attribute__((tag("GC Call")))

#else

# define JS_HAZ_GC_THING
# define JS_HAZ_GC_POINTER
# define JS_HAZ_ROOTED
# define JS_HAZ_GC_INVALIDATED
# define JS_HAZ_NON_GC_POINTER
# define JS_HAZ_GC_CALL

#endif

#endif /* js_GCAnnotations_h */