Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
005537df
Commit
005537df
authored
Oct 13, 1999
by
Richard Henderson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified GC interface and other goodies.
From-SVN: r29946
parent
1f1479dc
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
170 additions
and
207 deletions
+170
-207
gcc/Makefile.in
+1
-1
gcc/config.in
+3
-0
gcc/configure
+0
-0
gcc/configure.in
+3
-1
gcc/ggc-common.c
+25
-5
gcc/ggc-none.c
+8
-23
gcc/ggc-page.c
+74
-144
gcc/ggc-simple.c
+0
-0
gcc/ggc.h
+53
-24
gcc/rtl.h
+2
-6
gcc/tree.h
+1
-3
No files found.
gcc/Makefile.in
View file @
005537df
...
@@ -1750,7 +1750,7 @@ s-output : $(md_file) genoutput $(srcdir)/move-if-change
...
@@ -1750,7 +1750,7 @@ s-output : $(md_file) genoutput $(srcdir)/move-if-change
$(SHELL)
$(srcdir)
/move-if-change tmp-output.c insn-output.c
$(SHELL)
$(srcdir)
/move-if-change tmp-output.c insn-output.c
touch s-output
touch s-output
genrtl.o
:
genrtl.c $(CONFIG_H) $(RTL_H) system.h
genrtl.o
:
genrtl.c $(CONFIG_H) $(RTL_H) system.h
ggc.h
genrtl.c genrtl.h
:
s-genrtl
genrtl.c genrtl.h
:
s-genrtl
@
true
# force gnu make to recheck modification times.
@
true
# force gnu make to recheck modification times.
...
...
gcc/config.in
View file @
005537df
...
@@ -324,6 +324,9 @@
...
@@ -324,6 +324,9 @@
/* Define if you have the sysconf function. */
/* Define if you have the sysconf function. */
#undef HAVE_SYSCONF
#undef HAVE_SYSCONF
/* Define if you have the valloc function. */
#undef HAVE_VALLOC
/* Define if you have the <argz.h> header file. */
/* Define if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
#undef HAVE_ARGZ_H
...
...
gcc/configure
View file @
005537df
This diff is collapsed.
Click to expand it.
gcc/configure.in
View file @
005537df
...
@@ -368,7 +368,7 @@ fi
...
@@ -368,7 +368,7 @@ fi
AC_CHECK_FUNCS(strtoul bsearch strerror putenv popen bcopy bzero bcmp \
AC_CHECK_FUNCS(strtoul bsearch strerror putenv popen bcopy bzero bcmp \
index rindex strchr strrchr kill getrlimit setrlimit atoll atoq \
index rindex strchr strrchr kill getrlimit setrlimit atoll atoq \
sysconf isascii gettimeofday strsignal putc_unlocked fputc_unlocked \
sysconf isascii gettimeofday strsignal putc_unlocked fputc_unlocked \
fputs_unlocked getrusage)
fputs_unlocked getrusage
valloc
)
# Make sure wchar_t is available
# Make sure wchar_t is available
#AC_CHECK_TYPE(wchar_t, unsigned int)
#AC_CHECK_TYPE(wchar_t, unsigned int)
...
@@ -4456,6 +4456,8 @@ AC_ARG_WITH(gc,
...
@@ -4456,6 +4456,8 @@ AC_ARG_WITH(gc,
esac],
esac],
[if test $ac_cv_func_mmap_fixed_mapped = yes; then
[if test $ac_cv_func_mmap_fixed_mapped = yes; then
GGC=ggc-page
GGC=ggc-page
elif test $ac_cv_func_valloc = yes; then
GGC=ggc-page
else
else
GGC=ggc-simple
GGC=ggc-simple
fi])
fi])
...
...
gcc/ggc-common.c
View file @
005537df
...
@@ -268,21 +268,18 @@ ggc_mark_rtx_children (r)
...
@@ -268,21 +268,18 @@ ggc_mark_rtx_children (r)
ggc_mark_rtvec
(
XVEC
(
r
,
i
));
ggc_mark_rtvec
(
XVEC
(
r
,
i
));
break
;
break
;
case
'S'
:
case
's'
:
case
'S'
:
case
's'
:
ggc_mark_
string_
if_gcable
(
XSTR
(
r
,
i
));
ggc_mark_if_gcable
(
XSTR
(
r
,
i
));
break
;
break
;
}
}
}
}
}
}
void
void
ggc_mark_rtvec
(
v
)
ggc_mark_rtvec
_children
(
v
)
rtvec
v
;
rtvec
v
;
{
{
int
i
;
int
i
;
if
(
v
==
NULL
||
ggc_set_mark_rtvec
(
v
))
return
;
i
=
GET_NUM_ELEM
(
v
);
i
=
GET_NUM_ELEM
(
v
);
while
(
--
i
>=
0
)
while
(
--
i
>=
0
)
ggc_mark_rtx
(
RTVEC_ELT
(
v
,
i
));
ggc_mark_rtx
(
RTVEC_ELT
(
v
,
i
));
...
@@ -451,3 +448,26 @@ ggc_mark_tree_hash_table (ht)
...
@@ -451,3 +448,26 @@ ggc_mark_tree_hash_table (ht)
hash_traverse
(
ht
,
ggc_mark_tree_hash_table_entry
,
/*info=*/
0
);
hash_traverse
(
ht
,
ggc_mark_tree_hash_table_entry
,
/*info=*/
0
);
}
}
/* Allocation wrappers. */
char
*
ggc_alloc_string
(
contents
,
length
)
const
char
*
contents
;
int
length
;
{
char
*
string
;
if
(
length
<
0
)
{
if
(
contents
==
NULL
)
return
NULL
;
length
=
strlen
(
contents
);
}
string
=
(
char
*
)
ggc_alloc_obj
(
length
+
1
,
0
);
if
(
contents
!=
NULL
)
memcpy
(
string
,
contents
,
length
);
string
[
length
]
=
0
;
return
string
;
}
gcc/ggc-none.c
View file @
005537df
...
@@ -35,28 +35,13 @@
...
@@ -35,28 +35,13 @@
/* For now, keep using the old obstack scheme in the gen* programs. */
/* For now, keep using the old obstack scheme in the gen* programs. */
int
ggc_p
=
0
;
int
ggc_p
=
0
;
rtx
void
*
ggc_alloc_rtx
(
nslots
)
ggc_alloc_obj
(
size
,
zero
)
int
nslots
;
size_t
size
;
int
zero
;
{
{
int
size
=
sizeof
(
struct
rtx_def
)
+
(
nslots
-
1
)
*
sizeof
(
rtunion
);
void
*
p
=
xmalloc
(
size
);
rtx
n
;
if
(
zero
)
memset
(
p
,
0
,
size
);
n
=
(
rtx
)
xmalloc
(
size
);
return
p
;
bzero
((
char
*
)
n
,
size
);
return
n
;
}
rtvec
ggc_alloc_rtvec
(
nelt
)
int
nelt
;
{
int
size
=
sizeof
(
struct
rtvec_def
)
+
(
nelt
-
1
)
*
sizeof
(
rtx
);
rtvec
v
;
v
=
(
rtvec
)
xmalloc
(
size
);
bzero
((
char
*
)
v
,
size
);
return
v
;
}
}
gcc/ggc-page.c
View file @
005537df
...
@@ -27,7 +27,9 @@
...
@@ -27,7 +27,9 @@
#include "flags.h"
#include "flags.h"
#include "ggc.h"
#include "ggc.h"
#ifdef HAVE_MMAP
#include <sys/mman.h>
#include <sys/mman.h>
#endif
/* Stategy:
/* Stategy:
...
@@ -111,10 +113,10 @@ char *empty_string;
...
@@ -111,10 +113,10 @@ char *empty_string;
significant PAGE_L2_BITS and PAGE_L1_BITS are the second and first
significant PAGE_L2_BITS and PAGE_L1_BITS are the second and first
index values in the lookup table, respectively.
index values in the lookup table, respectively.
The topmost leftover bits, if any, are ignored. For 32-bit
For 32-bit architectures and the settings below, there are no
architectures and the settings below, there are no leftover bits.
leftover bits. For architectures with wider pointers, the lookup
For architectures with wider pointers, the lookup tree points to a
tree points to a list of pages, which must be scanned to find the
list of pages, which must be scanned to find the
correct one. */
correct one. */
#define PAGE_L1_BITS (8)
#define PAGE_L1_BITS (8)
#define PAGE_L2_BITS (32 - PAGE_L1_BITS - G.lg_pagesize)
#define PAGE_L2_BITS (32 - PAGE_L1_BITS - G.lg_pagesize)
...
@@ -178,8 +180,8 @@ typedef page_entry **page_table[PAGE_L1_SIZE];
...
@@ -178,8 +180,8 @@ typedef page_entry **page_table[PAGE_L1_SIZE];
#else
#else
/* On 64-bit hosts, we use t
wo level page tables plus a linked list
/* On 64-bit hosts, we use t
he same two level page tables plus a linked
that disambiguates the top 32-bits. There will almost always be
list
that disambiguates the top 32-bits. There will almost always be
exactly one entry in the list. */
exactly one entry in the list. */
typedef
struct
page_table_chain
typedef
struct
page_table_chain
{
{
...
@@ -221,7 +223,7 @@ static struct globals
...
@@ -221,7 +223,7 @@ static struct globals
unsigned
char
context_depth
;
unsigned
char
context_depth
;
/* A file descriptor open to /dev/zero for reading. */
/* A file descriptor open to /dev/zero for reading. */
#if
ndef MAP_ANONYMOUS
#if
defined (HAVE_MMAP) && !defined(MAP_ANONYMOUS)
int
dev_zero_fd
;
int
dev_zero_fd
;
#endif
#endif
...
@@ -258,16 +260,13 @@ static struct globals
...
@@ -258,16 +260,13 @@ static struct globals
#define GGC_MIN_LAST_ALLOCATED (4 * 1024 * 1024)
#define GGC_MIN_LAST_ALLOCATED (4 * 1024 * 1024)
static
page_entry
***
ggc_lookup_page_table
PROTO
((
void
));
static
int
ggc_allocated_p
PROTO
((
const
void
*
));
static
int
ggc_allocated_p
PROTO
((
const
void
*
));
static
page_entry
*
lookup_page_table_entry
PROTO
((
void
*
));
static
page_entry
*
lookup_page_table_entry
PROTO
((
const
void
*
));
static
void
set_page_table_entry
PROTO
((
void
*
,
page_entry
*
));
static
void
set_page_table_entry
PROTO
((
void
*
,
page_entry
*
));
static
char
*
alloc_anon
PROTO
((
char
*
,
size_t
));
static
char
*
alloc_anon
PROTO
((
char
*
,
size_t
));
static
struct
page_entry
*
alloc_page
PROTO
((
unsigned
));
static
struct
page_entry
*
alloc_page
PROTO
((
unsigned
));
static
void
free_page
PROTO
((
struct
page_entry
*
));
static
void
free_page
PROTO
((
struct
page_entry
*
));
static
void
release_pages
PROTO
((
void
));
static
void
release_pages
PROTO
((
void
));
static
void
*
alloc_obj
PROTO
((
size_t
,
int
));
static
int
mark_obj
PROTO
((
void
*
));
static
void
clear_marks
PROTO
((
void
));
static
void
clear_marks
PROTO
((
void
));
static
void
sweep_pages
PROTO
((
void
));
static
void
sweep_pages
PROTO
((
void
));
...
@@ -278,37 +277,31 @@ static void poison_pages PROTO ((void));
...
@@ -278,37 +277,31 @@ static void poison_pages PROTO ((void));
void
debug_print_page_list
PROTO
((
int
));
void
debug_print_page_list
PROTO
((
int
));
/* Returns
the lookup table appropriate for looking up P
. */
/* Returns
non-zero if P was allocated in GC'able memory
. */
static
inline
page_entry
***
static
inline
int
ggc_lookup_page_table
()
ggc_allocated_p
(
p
)
const
void
*
p
;
{
{
page_entry
***
base
;
page_entry
***
base
;
size_t
L1
,
L2
;
#if HOST_BITS_PER_PTR <= 32
#if HOST_BITS_PER_PTR <= 32
base
=
&
G
.
lookup
[
0
];
base
=
&
G
.
lookup
[
0
];
#else
#else
page_table
table
=
G
.
lookup
;
page_table
table
=
G
.
lookup
;
size_t
high_bits
=
(
size_t
)
p
&
~
(
size_t
)
0xffffffff
;
size_t
high_bits
=
(
size_t
)
p
&
~
(
size_t
)
0xffffffff
;
while
(
table
->
high_bits
!=
high_bits
)
while
(
1
)
{
if
(
table
==
NULL
)
return
0
;
if
(
table
->
high_bits
==
high_bits
)
break
;
table
=
table
->
next
;
table
=
table
->
next
;
}
base
=
&
table
->
table
[
0
];
base
=
&
table
->
table
[
0
];
#endif
#endif
return
base
;
}
/* Returns non-zero if P was allocated in GC'able memory. */
static
inline
int
ggc_allocated_p
(
p
)
const
void
*
p
;
{
page_entry
***
base
;
size_t
L1
,
L2
;
base
=
ggc_lookup_page_table
();
/* Extract the level 1 and 2 indicies. */
/* Extract the level 1 and 2 indicies. */
L1
=
LOOKUP_L1
(
p
);
L1
=
LOOKUP_L1
(
p
);
L2
=
LOOKUP_L2
(
p
);
L2
=
LOOKUP_L2
(
p
);
...
@@ -321,12 +314,20 @@ ggc_allocated_p (p)
...
@@ -321,12 +314,20 @@ ggc_allocated_p (p)
static
inline
page_entry
*
static
inline
page_entry
*
lookup_page_table_entry
(
p
)
lookup_page_table_entry
(
p
)
void
*
p
;
const
void
*
p
;
{
{
page_entry
***
base
;
page_entry
***
base
;
size_t
L1
,
L2
;
size_t
L1
,
L2
;
base
=
ggc_lookup_page_table
();
#if HOST_BITS_PER_PTR <= 32
base
=
&
G
.
lookup
[
0
];
#else
page_table
table
=
G
.
lookup
;
size_t
high_bits
=
(
size_t
)
p
&
~
(
size_t
)
0xffffffff
;
while
(
table
->
high_bits
!=
high_bits
)
table
=
table
->
next
;
base
=
&
table
->
table
[
0
];
#endif
/* Extract the level 1 and 2 indicies. */
/* Extract the level 1 and 2 indicies. */
L1
=
LOOKUP_L1
(
p
);
L1
=
LOOKUP_L1
(
p
);
...
@@ -407,11 +408,12 @@ poison (start, len)
...
@@ -407,11 +408,12 @@ poison (start, len)
(if non-null). */
(if non-null). */
static
inline
char
*
static
inline
char
*
alloc_anon
(
pref
,
size
)
alloc_anon
(
pref
,
size
)
char
*
pref
;
char
*
pref
ATTRIBUTE_UNUSED
;
size_t
size
;
size_t
size
;
{
{
char
*
page
;
char
*
page
;
#ifdef HAVE_MMAP
#ifdef MAP_ANONYMOUS
#ifdef MAP_ANONYMOUS
page
=
(
char
*
)
mmap
(
pref
,
size
,
PROT_READ
|
PROT_WRITE
,
page
=
(
char
*
)
mmap
(
pref
,
size
,
PROT_READ
|
PROT_WRITE
,
MAP_PRIVATE
|
MAP_ANONYMOUS
,
-
1
,
0
);
MAP_PRIVATE
|
MAP_ANONYMOUS
,
-
1
,
0
);
...
@@ -424,6 +426,16 @@ alloc_anon (pref, size)
...
@@ -424,6 +426,16 @@ alloc_anon (pref, size)
fputs
(
"Virtual memory exhausted!
\n
"
,
stderr
);
fputs
(
"Virtual memory exhausted!
\n
"
,
stderr
);
exit
(
1
);
exit
(
1
);
}
}
#else
#ifdef HAVE_VALLOC
page
=
(
char
*
)
valloc
(
size
);
if
(
!
page
)
{
fputs
(
"Virtual memory exhausted!
\n
"
,
stderr
);
exit
(
1
);
}
#endif
/* HAVE_VALLOC */
#endif
/* HAVE_MMAP */
return
page
;
return
page
;
}
}
...
@@ -522,6 +534,7 @@ free_page (entry)
...
@@ -522,6 +534,7 @@ free_page (entry)
static
inline
void
static
inline
void
release_pages
()
release_pages
()
{
{
#ifdef HAVE_MMAP
page_entry
*
p
,
*
next
;
page_entry
*
p
,
*
next
;
char
*
start
;
char
*
start
;
size_t
len
;
size_t
len
;
...
@@ -553,6 +566,19 @@ release_pages ()
...
@@ -553,6 +566,19 @@ release_pages ()
}
}
munmap
(
start
,
len
);
munmap
(
start
,
len
);
#else
#ifdef HAVE_VALLOC
page_entry
*
p
,
*
next
;
for
(
p
=
G
.
free_pages
;
p
;
p
=
next
)
{
next
=
p
->
next
;
free
(
p
->
page
);
free
(
p
);
}
#endif
/* HAVE_VALLOC */
#endif
/* HAVE_MMAP */
G
.
free_pages
=
NULL
;
G
.
free_pages
=
NULL
;
}
}
...
@@ -582,8 +608,8 @@ static unsigned char const size_lookup[257] =
...
@@ -582,8 +608,8 @@ static unsigned char const size_lookup[257] =
/* Allocate a chunk of memory of SIZE bytes. If ZERO is non-zero, the
/* Allocate a chunk of memory of SIZE bytes. If ZERO is non-zero, the
memory is zeroed; otherwise, its contents are undefined. */
memory is zeroed; otherwise, its contents are undefined. */
static
void
*
void
*
alloc_obj
(
size
,
zero
)
ggc_
alloc_obj
(
size
,
zero
)
size_t
size
;
size_t
size
;
int
zero
;
int
zero
;
{
{
...
@@ -700,8 +726,8 @@ alloc_obj (size, zero)
...
@@ -700,8 +726,8 @@ alloc_obj (size, zero)
/* If P is not marked, marks it and returns 0. Otherwise returns 1.
/* If P is not marked, marks it and returns 0. Otherwise returns 1.
P must have been allocated by the GC allocator; it mustn't point to
P must have been allocated by the GC allocator; it mustn't point to
static objects, stack variables, or memory allocated with malloc. */
static objects, stack variables, or memory allocated with malloc. */
static
int
int
mark_obj
(
p
)
ggc_set_mark
(
p
)
void
*
p
;
void
*
p
;
{
{
page_entry
*
entry
;
page_entry
*
entry
;
...
@@ -738,6 +764,13 @@ mark_obj (p)
...
@@ -738,6 +764,13 @@ mark_obj (p)
return
0
;
return
0
;
}
}
void
ggc_mark_if_gcable
(
p
)
void
*
p
;
{
if
(
p
&&
ggc_allocated_p
(
p
))
ggc_set_mark
(
p
);
}
/* Initialize the ggc-mmap allocator. */
/* Initialize the ggc-mmap allocator. */
void
void
...
@@ -746,7 +779,7 @@ init_ggc ()
...
@@ -746,7 +779,7 @@ init_ggc ()
G
.
pagesize
=
getpagesize
();
G
.
pagesize
=
getpagesize
();
G
.
lg_pagesize
=
exact_log2
(
G
.
pagesize
);
G
.
lg_pagesize
=
exact_log2
(
G
.
pagesize
);
#if
ndef MAP_ANONYMOUS
#if
defined (HAVE_MMAP) && !defined(MAP_ANONYMOUS)
G
.
dev_zero_fd
=
open
(
"/dev/zero"
,
O_RDONLY
);
G
.
dev_zero_fd
=
open
(
"/dev/zero"
,
O_RDONLY
);
if
(
G
.
dev_zero_fd
==
-
1
)
if
(
G
.
dev_zero_fd
==
-
1
)
abort
();
abort
();
...
@@ -813,64 +846,6 @@ ggc_pop_context ()
...
@@ -813,64 +846,6 @@ ggc_pop_context ()
}
}
}
}
struct
rtx_def
*
ggc_alloc_rtx
(
nslots
)
int
nslots
;
{
return
(
struct
rtx_def
*
)
alloc_obj
(
sizeof
(
struct
rtx_def
)
+
(
nslots
-
1
)
*
sizeof
(
rtunion
),
1
);
}
struct
rtvec_def
*
ggc_alloc_rtvec
(
nelt
)
int
nelt
;
{
return
(
struct
rtvec_def
*
)
alloc_obj
(
sizeof
(
struct
rtvec_def
)
+
(
nelt
-
1
)
*
sizeof
(
rtx
),
1
);
}
union
tree_node
*
ggc_alloc_tree
(
length
)
int
length
;
{
return
(
union
tree_node
*
)
alloc_obj
(
length
,
1
);
}
char
*
ggc_alloc_string
(
contents
,
length
)
const
char
*
contents
;
int
length
;
{
char
*
string
;
if
(
length
<
0
)
{
if
(
contents
==
NULL
)
return
NULL
;
length
=
strlen
(
contents
);
}
string
=
(
char
*
)
alloc_obj
(
length
+
1
,
0
);
if
(
contents
!=
NULL
)
memcpy
(
string
,
contents
,
length
);
string
[
length
]
=
0
;
return
string
;
}
void
*
ggc_alloc
(
size
)
size_t
size
;
{
return
alloc_obj
(
size
,
0
);
}
static
inline
void
static
inline
void
clear_marks
()
clear_marks
()
{
{
...
@@ -1072,54 +1047,9 @@ ggc_collect ()
...
@@ -1072,54 +1047,9 @@ ggc_collect ()
time
=
get_run_time
()
-
time
;
time
=
get_run_time
()
-
time
;
gc_time
+=
time
;
gc_time
+=
time
;
time
=
(
time
+
500
)
/
1000
;
if
(
!
quiet_flag
)
if
(
!
quiet_flag
)
fprintf
(
stderr
,
"%luk in %d.%03d}"
,
{
(
unsigned
long
)
G
.
allocated
/
1024
,
time
/
1000
,
time
%
1000
);
fprintf
(
stderr
,
"%luk in %.3f}"
,
}
(
unsigned
long
)
G
.
allocated
/
1024
,
time
*
1e-6
);
}
int
ggc_set_mark_rtx
(
r
)
rtx
r
;
{
return
mark_obj
(
r
);
}
int
ggc_set_mark_rtvec
(
v
)
rtvec
v
;
{
return
mark_obj
(
v
);
}
int
ggc_set_mark_tree
(
t
)
tree
t
;
{
return
mark_obj
(
t
);
}
void
ggc_mark_string
(
s
)
char
*
s
;
{
if
(
s
)
mark_obj
(
s
);
}
void
ggc_mark_string_if_gcable
(
s
)
char
*
s
;
{
if
(
s
&&
ggc_allocated_p
(
s
))
mark_obj
(
s
);
}
void
ggc_mark
(
p
)
void
*
p
;
{
if
(
p
)
mark_obj
(
p
);
}
}
gcc/ggc-simple.c
View file @
005537df
This diff is collapsed.
Click to expand it.
gcc/ggc.h
View file @
005537df
...
@@ -56,34 +56,52 @@ void ggc_del_root PROTO ((void *base));
...
@@ -56,34 +56,52 @@ void ggc_del_root PROTO ((void *base));
/* Mark nodes from the gc_add_root callback. These functions follow
/* Mark nodes from the gc_add_root callback. These functions follow
pointers to mark other objects too. */
pointers to mark other objects too. */
extern
void
ggc_mark_rtvec
PROTO
((
struct
rtvec_def
*
));
extern
void
ggc_mark_tree_varray
PROTO
((
struct
varray_head_tag
*
));
extern
void
ggc_mark_tree_varray
PROTO
((
struct
varray_head_tag
*
));
extern
void
ggc_mark_tree_hash_table
PROTO
((
struct
hash_table
*
));
extern
void
ggc_mark_tree_hash_table
PROTO
((
struct
hash_table
*
));
extern
void
ggc_mark_string
PROTO
((
char
*
));
extern
void
ggc_mark
PROTO
((
void
*
));
extern
void
ggc_mark_roots
PROTO
((
void
));
extern
void
ggc_mark_roots
PROTO
((
void
));
extern
void
ggc_mark_rtx_children
PROTO
((
struct
rtx_def
*
));
extern
void
ggc_mark_rtx_children
PROTO
((
struct
rtx_def
*
));
extern
void
ggc_mark_rtvec_children
PROTO
((
struct
rtvec_def
*
));
extern
void
ggc_mark_tree_children
PROTO
((
union
tree_node
*
));
extern
void
ggc_mark_tree_children
PROTO
((
union
tree_node
*
));
/* Mark the string, but only if it was allocated in collectable
#define ggc_mark_rtx(EXPR) \
memory. */
extern
void
ggc_mark_string_if_gcable
PROTO
((
char
*
));
#define ggc_mark_rtx(RTX_EXPR) \
do { \
do { \
rtx r__ = (
RTX_
EXPR); \
rtx r__ = (EXPR); \
if (r__ != NULL && ! ggc_set_mark
_rtx
(r__)) \
if (r__ != NULL && ! ggc_set_mark (r__)) \
ggc_mark_rtx_children (r__); \
ggc_mark_rtx_children (r__); \
} while (0)
} while (0)
#define ggc_mark_tree(
TREE_
EXPR) \
#define ggc_mark_tree(EXPR) \
do { \
do { \
tree t__ = (
TREE_
EXPR); \
tree t__ = (EXPR); \
if (t__ != NULL && ! ggc_set_mark
_tree
(t__)) \
if (t__ != NULL && ! ggc_set_mark (t__)) \
ggc_mark_tree_children (t__); \
ggc_mark_tree_children (t__); \
} while (0)
} while (0)
#define ggc_mark_rtvec(EXPR) \
do { \
rtvec v__ = (EXPR); \
if (v__ != NULL && ! ggc_set_mark (v__)) \
ggc_mark_rtvec_children (v__); \
} while (0)
#define ggc_mark_string(EXPR) \
do { \
char *s__ = (EXPR); \
if (s__ != NULL) \
ggc_set_mark (s__); \
} while (0)
#define ggc_mark(EXPR) \
do { \
void *a__ = (EXPR); \
if (a__ != NULL) \
ggc_set_mark (a__); \
} while (0)
/* Mark, but only if it was allocated in collectable memory. */
extern
void
ggc_mark_if_gcable
PROTO
((
void
*
));
/* A GC implementation must provide these functions. */
/* A GC implementation must provide these functions. */
/* Initialize the garbage collector. */
/* Initialize the garbage collector. */
...
@@ -98,24 +116,35 @@ extern void ggc_push_context PROTO ((void));
...
@@ -98,24 +116,35 @@ extern void ggc_push_context PROTO ((void));
extern
void
ggc_pop_context
PROTO
((
void
));
extern
void
ggc_pop_context
PROTO
((
void
));
/* Allocation. */
/* Allocation. */
struct
rtx_def
*
ggc_alloc_rtx
PROTO
((
int
nslots
));
struct
rtvec_def
*
ggc_alloc_rtvec
PROTO
((
int
nelt
));
/* The internal primitive. */
union
tree_node
*
ggc_alloc_tree
PROTO
((
int
length
));
void
*
ggc_alloc_obj
PROTO
((
size_t
,
int
));
#define ggc_alloc_rtx(NSLOTS) \
((struct rtx_def *) ggc_alloc_obj (sizeof (struct rtx_def) \
+ ((NSLOTS) - 1) * sizeof (rtunion), 1))
#define ggc_alloc_rtvec(NELT) \
((struct rtvec_def *) ggc_alloc_obj (sizeof (struct rtvec_def) \
+ ((NELT) - 1) * sizeof (rtx), 1))
#define ggc_alloc_tree(LENGTH) \
((union tree_node *) ggc_alloc_obj ((LENGTH), 1))
#define ggc_alloc(SIZE) ggc_alloc_obj((SIZE), 0)
char
*
ggc_alloc_string
PROTO
((
const
char
*
contents
,
int
length
));
char
*
ggc_alloc_string
PROTO
((
const
char
*
contents
,
int
length
));
void
*
ggc_alloc
PROTO
((
size_t
));
/* Invoke the collector. This is really just a hint, but in the case of
/* Invoke the collector. This is really just a hint, but in the case of
the simple collector, the only time it will happen. */
the simple collector, the only time it will happen. */
void
ggc_collect
PROTO
((
void
));
void
ggc_collect
PROTO
((
void
));
/* Actually set the mark on a particular region of memory, but don't
/* Actually set the mark on a particular region of memory, but don't
follow pointers. These functions are called by ggc_mark_*. They
follow pointers. This function is called by ggc_mark_*. It
return zero if the object was not previously marked; they return
returns zero if the object was not previously marked; non-zero if
non-zero if the object was already marked, or if, for any other
the object was already marked, or if, for any other reason,
reason, pointers in this data structure should not be traversed. */
pointers in this data structure should not be traversed. */
int
ggc_set_mark_rtx
PROTO
((
struct
rtx_def
*
));
int
ggc_set_mark
PROTO
((
void
*
));
int
ggc_set_mark_rtvec
PROTO
((
struct
rtvec_def
*
));
int
ggc_set_mark_tree
PROTO
((
union
tree_node
*
));
/* Callbacks to the languages. */
/* Callbacks to the languages. */
...
...
gcc/rtl.h
View file @
005537df
...
@@ -102,18 +102,15 @@ typedef struct rtx_def
...
@@ -102,18 +102,15 @@ typedef struct rtx_def
{
{
#ifdef ONLY_INT_FIELDS
#ifdef ONLY_INT_FIELDS
#ifdef CODE_FIELD_BUG
#ifdef CODE_FIELD_BUG
unsigned
int
code
:
1
5
;
unsigned
int
code
:
1
6
;
#else
#else
unsigned
short
code
;
unsigned
short
code
;
#endif
#endif
#else
#else
/* The kind of expression this is. */
/* The kind of expression this is. */
enum
rtx_code
code
:
1
5
;
enum
rtx_code
code
:
1
6
;
#endif
#endif
/* Used by the garbage collector. */
unsigned
gc_mark
:
1
;
/* The kind of value the expression has. */
/* The kind of value the expression has. */
#ifdef ONLY_INT_FIELDS
#ifdef ONLY_INT_FIELDS
int
mode
:
8
;
int
mode
:
8
;
...
@@ -207,7 +204,6 @@ typedef struct rtx_def
...
@@ -207,7 +204,6 @@ typedef struct rtx_def
typedef
struct
rtvec_def
{
typedef
struct
rtvec_def
{
int
num_elem
;
/* number of elements */
int
num_elem
;
/* number of elements */
int
gc_mark
;
struct
rtx_def
*
elem
[
1
];
struct
rtx_def
*
elem
[
1
];
}
*
rtvec
;
}
*
rtvec
;
...
...
gcc/tree.h
View file @
005537df
...
@@ -203,9 +203,7 @@ struct tree_common
...
@@ -203,9 +203,7 @@ struct tree_common
unsigned
lang_flag_5
:
1
;
unsigned
lang_flag_5
:
1
;
unsigned
lang_flag_6
:
1
;
unsigned
lang_flag_6
:
1
;
unsigned
gc_mark
:
1
;
/* There is room for three more flags. */
/* There is room for two more flags. */
};
};
/* The following table lists the uses of each of the above flags and
/* The following table lists the uses of each of the above flags and
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment