mirror of git://gcc.gnu.org/git/gcc.git
ggc-page.c (ggc_allocated_p): Rename to ...
2017-04-20 Richard Biener <rguenther@suse.de> * ggc-page.c (ggc_allocated_p): Rename to ... (safe_lookup_page_table_entry): ... this and return the lookup result. (gt_ggc_m_S): Use safe_lookup_page_table_entry. From-SVN: r247025
This commit is contained in:
parent
8ee1b0a013
commit
acb14262e1
|
|
@ -1,3 +1,10 @@
|
||||||
|
2017-04-20 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
|
* ggc-page.c (ggc_allocated_p): Rename to ...
|
||||||
|
(safe_lookup_page_table_entry): ... this and return the lookup
|
||||||
|
result.
|
||||||
|
(gt_ggc_m_S): Use safe_lookup_page_table_entry.
|
||||||
|
|
||||||
2017-04-20 Richard Biener <rguenther@suse.de>
|
2017-04-20 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
PR tree-optimization/80453
|
PR tree-optimization/80453
|
||||||
|
|
|
||||||
|
|
@ -522,7 +522,6 @@ static bool in_gc = false;
|
||||||
/* Initial guess as to how many page table entries we might need. */
|
/* Initial guess as to how many page table entries we might need. */
|
||||||
#define INITIAL_PTE_COUNT 128
|
#define INITIAL_PTE_COUNT 128
|
||||||
|
|
||||||
static int ggc_allocated_p (const void *);
|
|
||||||
static page_entry *lookup_page_table_entry (const void *);
|
static page_entry *lookup_page_table_entry (const void *);
|
||||||
static void set_page_table_entry (void *, page_entry *);
|
static void set_page_table_entry (void *, page_entry *);
|
||||||
#ifdef USING_MMAP
|
#ifdef USING_MMAP
|
||||||
|
|
@ -587,10 +586,11 @@ push_by_depth (page_entry *p, unsigned long *s)
|
||||||
#define save_in_use_p(__p) \
|
#define save_in_use_p(__p) \
|
||||||
(save_in_use_p_i (__p->index_by_depth))
|
(save_in_use_p_i (__p->index_by_depth))
|
||||||
|
|
||||||
/* Returns nonzero if P was allocated in GC'able memory. */
|
/* Traverse the page table and find the entry for a page.
|
||||||
|
If the object wasn't allocated in GC return NULL. */
|
||||||
|
|
||||||
static inline int
|
static inline page_entry *
|
||||||
ggc_allocated_p (const void *p)
|
safe_lookup_page_table_entry (const void *p)
|
||||||
{
|
{
|
||||||
page_entry ***base;
|
page_entry ***base;
|
||||||
size_t L1, L2;
|
size_t L1, L2;
|
||||||
|
|
@ -603,7 +603,7 @@ ggc_allocated_p (const void *p)
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
if (table == NULL)
|
if (table == NULL)
|
||||||
return 0;
|
return NULL;
|
||||||
if (table->high_bits == high_bits)
|
if (table->high_bits == high_bits)
|
||||||
break;
|
break;
|
||||||
table = table->next;
|
table = table->next;
|
||||||
|
|
@ -614,8 +614,10 @@ ggc_allocated_p (const void *p)
|
||||||
/* Extract the level 1 and 2 indices. */
|
/* Extract the level 1 and 2 indices. */
|
||||||
L1 = LOOKUP_L1 (p);
|
L1 = LOOKUP_L1 (p);
|
||||||
L2 = LOOKUP_L2 (p);
|
L2 = LOOKUP_L2 (p);
|
||||||
|
if (! base[L1])
|
||||||
|
return NULL;
|
||||||
|
|
||||||
return base[L1] && base[L1][L2];
|
return base[L1][L2];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Traverse the page table and find the entry for a page.
|
/* Traverse the page table and find the entry for a page.
|
||||||
|
|
@ -1455,12 +1457,14 @@ gt_ggc_m_S (const void *p)
|
||||||
unsigned long mask;
|
unsigned long mask;
|
||||||
unsigned long offset;
|
unsigned long offset;
|
||||||
|
|
||||||
if (!p || !ggc_allocated_p (p))
|
if (!p)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Look up the page on which the object is alloced. . */
|
/* Look up the page on which the object is alloced. If it was not
|
||||||
entry = lookup_page_table_entry (p);
|
GC allocated, gracefully bail out. */
|
||||||
gcc_assert (entry);
|
entry = safe_lookup_page_table_entry (p);
|
||||||
|
if (!entry)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Calculate the index of the object on the page; this is its bit
|
/* Calculate the index of the object on the page; this is its bit
|
||||||
position in the in_use_p bitmap. Note that because a char* might
|
position in the in_use_p bitmap. Note that because a char* might
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue