mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-12 07:10:26 +08:00
gbl-ctors.h: Fix formatting.
* gbl-ctors.h: Fix formatting. * gcc.c: Likewise. * gccspec.c: Likewise. * gcov.c: Likewise. * gcov-io.h: Likewise. * gcse.c: Likewise. * ggc-common.c: Likewise. * ggc.h: Likewise. * ggc-page.c: Likewise. * ggc-simple.c: Likewise. * global.c: Likewise. * graph.h: Likewise. * gthr-dce.h: Likewise. * gthr.h: Likewise. * gthr-posix.h: Likewise. * gthr-rtems.h: Likewise. * gthr-solaris.h: Likewise. * gthr-win32.h: Likewise. From-SVN: r54240
This commit is contained in:
parent
94213cff2a
commit
589005ff21
@ -1,3 +1,24 @@
|
||||
2002-06-04 Kazu Hirata <kazu@cs.umass.edu>
|
||||
|
||||
* gbl-ctors.h: Fix formatting.
|
||||
* gcc.c: Likewise.
|
||||
* gccspec.c: Likewise.
|
||||
* gcov.c: Likewise.
|
||||
* gcov-io.h: Likewise.
|
||||
* gcse.c: Likewise.
|
||||
* ggc-common.c: Likewise.
|
||||
* ggc.h: Likewise.
|
||||
* ggc-page.c: Likewise.
|
||||
* ggc-simple.c: Likewise.
|
||||
* global.c: Likewise.
|
||||
* graph.h: Likewise.
|
||||
* gthr-dce.h: Likewise.
|
||||
* gthr.h: Likewise.
|
||||
* gthr-posix.h: Likewise.
|
||||
* gthr-rtems.h: Likewise.
|
||||
* gthr-solaris.h: Likewise.
|
||||
* gthr-win32.h: Likewise.
|
||||
|
||||
2002-06-03 Geoffrey Keating <geoffk@redhat.com>
|
||||
|
||||
Merge from pch-branch:
|
||||
@ -1206,7 +1227,7 @@ Mon Jun 3 11:53:01 CEST 2002 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
2002-06-02 Kazu Hirata <kazu@cs.umass.edu>
|
||||
|
||||
* emit-rtl.c: Likewise.
|
||||
* emit-rtl.c: Fix formatting.
|
||||
* errors.h: Likewise.
|
||||
* except.c: Likewise.
|
||||
* explow.c: Likewise.
|
||||
|
@ -78,6 +78,6 @@ do { \
|
||||
for (nptrs = 0; __CTOR_LIST__[nptrs + 1] != 0; nptrs++); \
|
||||
for (i = nptrs; i >= 1; i--) \
|
||||
__CTOR_LIST__[i] (); \
|
||||
} while (0)
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
|
80
gcc/gcc.c
80
gcc/gcc.c
@ -242,7 +242,7 @@ static const struct modify_target
|
||||
}
|
||||
modify_target[] = MODIFY_TARGET_NAME;
|
||||
#endif
|
||||
|
||||
|
||||
/* The number of errors that have occurred; the link phase will not be
|
||||
run if this is non-zero. */
|
||||
static int error_count = 0;
|
||||
@ -1522,12 +1522,12 @@ init_spec ()
|
||||
{
|
||||
const char *p = libgcc_spec;
|
||||
int in_sep = 1;
|
||||
|
||||
|
||||
/* Transform the extant libgcc_spec into one that uses the shared libgcc
|
||||
when given the proper command line arguments. */
|
||||
while (*p)
|
||||
{
|
||||
if (in_sep && *p == '-' && strncmp (p, "-lgcc", 5) == 0)
|
||||
if (in_sep && *p == '-' && strncmp (p, "-lgcc", 5) == 0)
|
||||
{
|
||||
init_gcc_specs (&obstack,
|
||||
#ifdef NO_SHARED_LIBGCC_MULTILIB
|
||||
@ -2758,8 +2758,8 @@ execute ()
|
||||
{
|
||||
const char *const *j;
|
||||
|
||||
if (verbose_only_flag)
|
||||
{
|
||||
if (verbose_only_flag)
|
||||
{
|
||||
for (j = commands[i].argv; *j; j++)
|
||||
{
|
||||
const char *p;
|
||||
@ -2772,8 +2772,8 @@ execute ()
|
||||
}
|
||||
fputc ('"', stderr);
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
for (j = commands[i].argv; *j; j++)
|
||||
fprintf (stderr, " %s", *j);
|
||||
|
||||
@ -2784,7 +2784,7 @@ execute ()
|
||||
}
|
||||
fflush (stderr);
|
||||
if (verbose_only_flag != 0)
|
||||
return 0;
|
||||
return 0;
|
||||
#ifdef DEBUG
|
||||
notice ("\nGo ahead? (y or n) ");
|
||||
fflush (stderr);
|
||||
@ -3384,20 +3384,20 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
|
||||
add_linker_option ("--help", 6);
|
||||
}
|
||||
else if (strcmp (argv[i], "-ftarget-help") == 0)
|
||||
{
|
||||
/* translate_options() has turned --target-help into -ftarget-help. */
|
||||
target_help_flag = 1;
|
||||
{
|
||||
/* translate_options() has turned --target-help into -ftarget-help. */
|
||||
target_help_flag = 1;
|
||||
|
||||
/* We will be passing a dummy file on to the sub-processes. */
|
||||
n_infiles++;
|
||||
n_switches++;
|
||||
/* We will be passing a dummy file on to the sub-processes. */
|
||||
n_infiles++;
|
||||
n_switches++;
|
||||
|
||||
/* CPP driver cannot obtain switch from cc1_options. */
|
||||
if (is_cpp_driver)
|
||||
add_preprocessor_option ("--target-help", 13);
|
||||
add_assembler_option ("--target-help", 13);
|
||||
add_linker_option ("--target-help", 13);
|
||||
}
|
||||
add_assembler_option ("--target-help", 13);
|
||||
add_linker_option ("--target-help", 13);
|
||||
}
|
||||
else if (! strcmp (argv[i], "-pass-exit-codes"))
|
||||
{
|
||||
pass_exit_codes = 1;
|
||||
@ -3572,7 +3572,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
|
||||
tmp[++ len] = 0;
|
||||
value = tmp;
|
||||
}
|
||||
|
||||
|
||||
/* As a kludge, if the arg is "[foo/]stageN/", just
|
||||
add "[foo/]include" to the include prefix. */
|
||||
if ((len == 7
|
||||
@ -3703,7 +3703,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
|
||||
|
||||
if (is_modify_target_name)
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
n_switches++;
|
||||
|
||||
@ -3893,7 +3893,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
|
||||
/* -save-temps overrides -pipe, so that temp files are produced */
|
||||
if (save_temps_flag)
|
||||
error ("warning: -pipe ignored because -save-temps specified");
|
||||
/* -time overrides -pipe because we can't get correct stats when
|
||||
/* -time overrides -pipe because we can't get correct stats when
|
||||
multiple children are running at once. */
|
||||
else if (report_times)
|
||||
error ("warning: -pipe ignored because -time specified");
|
||||
@ -4509,7 +4509,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
|
||||
}
|
||||
suffix_length += strlen (TARGET_OBJECT_SUFFIX);
|
||||
}
|
||||
|
||||
|
||||
/* If the input_filename has the same suffix specified
|
||||
for the %g, %u, or %U, and -save-temps is specified,
|
||||
we could end up using that file as an intermediate
|
||||
@ -4517,7 +4517,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
|
||||
gcc -save-temps foo.s would clobber foo.s with the
|
||||
output of cpp0). So check for this condition and
|
||||
generate a temp file as the intermediate. */
|
||||
|
||||
|
||||
if (save_temps_flag)
|
||||
{
|
||||
temp_filename_length = basename_length + suffix_length;
|
||||
@ -4529,7 +4529,7 @@ do_spec_1 (spec, inswitch, soft_matched_part)
|
||||
if (strcmp (temp_filename, input_filename) != 0)
|
||||
{
|
||||
struct stat st_temp;
|
||||
|
||||
|
||||
/* Note, set_input() resets input_stat_set to 0. */
|
||||
if (input_stat_set == 0)
|
||||
{
|
||||
@ -4537,17 +4537,17 @@ do_spec_1 (spec, inswitch, soft_matched_part)
|
||||
if (input_stat_set >= 0)
|
||||
input_stat_set = 1;
|
||||
}
|
||||
|
||||
|
||||
/* If we have the stat for the input_filename
|
||||
and we can do the stat for the temp_filename
|
||||
then the they could still refer to the same
|
||||
file if st_dev/st_ino's are the same. */
|
||||
|
||||
|
||||
if (input_stat_set != 1
|
||||
|| stat (temp_filename, &st_temp) < 0
|
||||
|| input_stat.st_dev != st_temp.st_dev
|
||||
|| input_stat.st_ino != st_temp.st_ino)
|
||||
{
|
||||
{
|
||||
temp_filename = save_string (temp_filename,
|
||||
temp_filename_length + 1);
|
||||
obstack_grow (&obstack, temp_filename,
|
||||
@ -4755,8 +4755,8 @@ do_spec_1 (spec, inswitch, soft_matched_part)
|
||||
case 'C':
|
||||
{
|
||||
const char *const spec
|
||||
= (input_file_compiler->cpp_spec
|
||||
? input_file_compiler->cpp_spec
|
||||
= (input_file_compiler->cpp_spec
|
||||
? input_file_compiler->cpp_spec
|
||||
: cpp_spec);
|
||||
value = do_spec_1 (spec, 0, NULL);
|
||||
if (value != 0)
|
||||
@ -4984,17 +4984,17 @@ do_spec_1 (spec, inswitch, soft_matched_part)
|
||||
obstack_1grow (&obstack, '%');
|
||||
break;
|
||||
|
||||
case '.':
|
||||
{
|
||||
unsigned len = 0;
|
||||
case '.':
|
||||
{
|
||||
unsigned len = 0;
|
||||
|
||||
while (p[len] && p[len] != ' ' && p[len] != '%')
|
||||
len++;
|
||||
suffix_subst = save_string (p - 1, len + 1);
|
||||
p += len;
|
||||
}
|
||||
while (p[len] && p[len] != ' ' && p[len] != '%')
|
||||
len++;
|
||||
suffix_subst = save_string (p - 1, len + 1);
|
||||
p += len;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case '*':
|
||||
if (soft_matched_part)
|
||||
{
|
||||
@ -5693,7 +5693,7 @@ set_input (filename)
|
||||
}
|
||||
else
|
||||
input_suffix = "";
|
||||
|
||||
|
||||
/* If a spec for 'g', 'u', or 'U' is seen with -save-temps then
|
||||
we will need to do a stat on the input_filename. The
|
||||
INPUT_STAT_SET signals that the stat is needed. */
|
||||
@ -6095,7 +6095,7 @@ main (argc, argv)
|
||||
input_file_compiler
|
||||
= lookup_compiler (infiles[i].name, input_filename_length,
|
||||
infiles[i].language);
|
||||
|
||||
|
||||
if (input_file_compiler)
|
||||
{
|
||||
/* Ok, we found an applicable compiler. Run its spec. */
|
||||
@ -6234,7 +6234,7 @@ lookup_compiler (name, length, language)
|
||||
&& !strcmp (cp->suffix,
|
||||
name + length - strlen (cp->suffix))
|
||||
))
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
#if defined (OS2) ||defined (HAVE_DOS_BASED_FILE_SYSTEM)
|
||||
|
@ -57,7 +57,7 @@ lang_specific_driver (in_argc, in_argv, in_added_libraries)
|
||||
}
|
||||
else
|
||||
{
|
||||
int len;
|
||||
int len;
|
||||
|
||||
/* If the filename ends in .m or .mi, we are compiling ObjC
|
||||
and want to pass -shared-libgcc. */
|
||||
|
@ -74,7 +74,7 @@ __store_gcov_type (value, dest, bytes)
|
||||
if (value && value != -1)
|
||||
return 1;
|
||||
|
||||
for(; i < bytes ; i++)
|
||||
for(; i < bytes ; i++)
|
||||
dest[i] = 0;
|
||||
dest[bytes - 1] |= upper_bit;
|
||||
return 0;
|
||||
|
14
gcc/gcov.c
14
gcc/gcov.c
@ -687,7 +687,7 @@ create_program_flow_graph (bptr)
|
||||
__read_long (&function_name_len, bbg_file, 4);
|
||||
function_name = xmalloc (function_name_len + 1);
|
||||
fread (function_name, 1, function_name_len + 1, bbg_file);
|
||||
|
||||
|
||||
/* Skip padding. */
|
||||
tmp = (function_name_len + 1) % 4;
|
||||
|
||||
@ -695,7 +695,7 @@ create_program_flow_graph (bptr)
|
||||
fseek (bbg_file, 4 - tmp, SEEK_CUR);
|
||||
|
||||
__read_long (&tmp, bbg_file, 4); /* ignore -1. */
|
||||
|
||||
|
||||
/* Read the cfg checksum. */
|
||||
__read_long (&cfg_checksum, bbg_file, 4);
|
||||
|
||||
@ -729,7 +729,7 @@ create_program_flow_graph (bptr)
|
||||
__read_long (&flag_bits, bbg_file, 4);
|
||||
if (flag_bits & 0x1)
|
||||
arcptr->on_tree++;
|
||||
else
|
||||
else
|
||||
instr_arcs++;
|
||||
arcptr->fake = !! (flag_bits & 0x2);
|
||||
arcptr->fall_through = !! (flag_bits & 0x4);
|
||||
@ -1063,9 +1063,9 @@ calculate_branch_probs (current_graph, block_num, branch_probs, last_line_num)
|
||||
a_ptr = (struct arcdata *) xmalloc (sizeof (struct arcdata));
|
||||
a_ptr->total = total;
|
||||
if (total == 0)
|
||||
a_ptr->hits = 0;
|
||||
a_ptr->hits = 0;
|
||||
else
|
||||
a_ptr->hits = arcptr->arc_count;
|
||||
a_ptr->hits = arcptr->arc_count;
|
||||
a_ptr->call_insn = arcptr->fake;
|
||||
|
||||
if (output_function_summary)
|
||||
@ -1565,8 +1565,8 @@ output_data ()
|
||||
((a_ptr->hits * 100)
|
||||
+ (a_ptr->total >> 1))
|
||||
/ a_ptr->total);
|
||||
fnotice (gcov_file,
|
||||
"branch %d taken = %s%%\n", i, c);
|
||||
fnotice (gcov_file,
|
||||
"branch %d taken = %s%%\n", i, c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
350
gcc/gcse.c
350
gcc/gcse.c
File diff suppressed because it is too large
Load Diff
@ -53,7 +53,7 @@ struct ggc_root
|
||||
static struct ggc_root *roots;
|
||||
|
||||
/* Add BASE as a new garbage collection root. It is an array of
|
||||
length NELT with each element SIZE bytes long. CB is a
|
||||
length NELT with each element SIZE bytes long. CB is a
|
||||
function that will be called with a pointer to each element
|
||||
of the array; it is the intention that CB call the appropriate
|
||||
routine to mark gc-able memory for that element. */
|
||||
@ -103,7 +103,7 @@ ggc_mark_roots ()
|
||||
const struct ggc_cache_tab *const *ct;
|
||||
const struct ggc_cache_tab *cti;
|
||||
size_t i;
|
||||
|
||||
|
||||
for (rt = gt_ggc_deletable_rtab; *rt; rt++)
|
||||
for (rti = *rt; rti->base != NULL; rti++)
|
||||
memset (rti->base, 0, rti->stride);
|
||||
@ -179,7 +179,7 @@ ggc_mark_rtx_children_1 (r)
|
||||
int i;
|
||||
rtx next_rtx;
|
||||
|
||||
do
|
||||
do
|
||||
{
|
||||
enum rtx_code code = GET_CODE (r);
|
||||
/* This gets set to a child rtx to eliminate tail recursion. */
|
||||
@ -244,12 +244,12 @@ ggc_mark_rtx_children_1 (r)
|
||||
case 'e': case 'u':
|
||||
exp = XEXP (r, i);
|
||||
if (ggc_test_and_set_mark (exp))
|
||||
{
|
||||
if (next_rtx == NULL)
|
||||
next_rtx = exp;
|
||||
else
|
||||
{
|
||||
if (next_rtx == NULL)
|
||||
next_rtx = exp;
|
||||
else
|
||||
ggc_mark_rtx_children (exp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'V': case 'E':
|
||||
gt_ggc_m_rtvec_def (XVEC (r, i));
|
||||
@ -342,17 +342,17 @@ ggc_print_common_statistics (stream, stats)
|
||||
}
|
||||
|
||||
/* Print the statistics for trees. */
|
||||
fprintf (stream, "\n%-17s%10s %16s %10s\n", "Tree",
|
||||
fprintf (stream, "\n%-17s%10s %16s %10s\n", "Tree",
|
||||
"Number", "Bytes", "% Total");
|
||||
for (code = 0; code < MAX_TREE_CODES; ++code)
|
||||
if (ggc_stats->num_trees[code])
|
||||
if (ggc_stats->num_trees[code])
|
||||
{
|
||||
fprintf (stream, "%-17s%10u%16ld%c %10.3f\n",
|
||||
tree_code_name[code],
|
||||
ggc_stats->num_trees[code],
|
||||
SCALE (ggc_stats->size_trees[code]),
|
||||
LABEL (ggc_stats->size_trees[code]),
|
||||
(100 * ((double) ggc_stats->size_trees[code])
|
||||
(100 * ((double) ggc_stats->size_trees[code])
|
||||
/ ggc_stats->total_size_trees));
|
||||
}
|
||||
fprintf (stream,
|
||||
@ -362,17 +362,17 @@ ggc_print_common_statistics (stream, stats)
|
||||
LABEL (ggc_stats->total_size_trees));
|
||||
|
||||
/* Print the statistics for RTL. */
|
||||
fprintf (stream, "\n%-17s%10s %16s %10s\n", "RTX",
|
||||
fprintf (stream, "\n%-17s%10s %16s %10s\n", "RTX",
|
||||
"Number", "Bytes", "% Total");
|
||||
for (code = 0; code < NUM_RTX_CODE; ++code)
|
||||
if (ggc_stats->num_rtxs[code])
|
||||
if (ggc_stats->num_rtxs[code])
|
||||
{
|
||||
fprintf (stream, "%-17s%10u%16ld%c %10.3f\n",
|
||||
rtx_name[code],
|
||||
ggc_stats->num_rtxs[code],
|
||||
SCALE (ggc_stats->size_rtxs[code]),
|
||||
LABEL (ggc_stats->size_rtxs[code]),
|
||||
(100 * ((double) ggc_stats->size_rtxs[code])
|
||||
(100 * ((double) ggc_stats->size_rtxs[code])
|
||||
/ ggc_stats->total_size_rtxs));
|
||||
}
|
||||
fprintf (stream,
|
||||
|
@ -59,7 +59,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
#define USING_MALLOC_PAGE_GROUPS
|
||||
#endif
|
||||
|
||||
/* Stategy:
|
||||
/* Stategy:
|
||||
|
||||
This garbage-collecting allocator allocates objects on one of a set
|
||||
of pages. Each page can allocate objects of a single size only;
|
||||
@ -74,7 +74,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
|
||||
Each page-entry also has a context depth, which is used to track
|
||||
pushing and popping of allocation contexts. Only objects allocated
|
||||
in the current (highest-numbered) context may be collected.
|
||||
in the current (highest-numbered) context may be collected.
|
||||
|
||||
Page entries are arranged in an array of singly-linked lists. The
|
||||
array is indexed by the allocation size, in bits, of the pages on
|
||||
@ -133,7 +133,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
The bottommost HOST_PAGE_SIZE_BITS are ignored, since page-entry
|
||||
pages are aligned on system page boundaries. The next most
|
||||
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.
|
||||
|
||||
For 32-bit architectures and the settings below, there are no
|
||||
leftover bits. For architectures with wider pointers, the lookup
|
||||
@ -206,7 +206,7 @@ static size_t object_size_table[NUM_ORDERS];
|
||||
|
||||
/* A page_entry records the status of an allocation page. This
|
||||
structure is dynamically sized to fit the bitmap in_use_p. */
|
||||
typedef struct page_entry
|
||||
typedef struct page_entry
|
||||
{
|
||||
/* The next page-entry with objects of the same size, or NULL if
|
||||
this is the last page-entry. */
|
||||
@ -411,7 +411,7 @@ ggc_allocated_p (p)
|
||||
return base[L1] && 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.
|
||||
Die (probably) if the object wasn't allocated via GC. */
|
||||
|
||||
static inline page_entry *
|
||||
@ -731,7 +731,7 @@ alloc_page (order)
|
||||
set_page_table_entry (page, entry);
|
||||
|
||||
if (GGC_DEBUG_LEVEL >= 2)
|
||||
fprintf (G.debug_file,
|
||||
fprintf (G.debug_file,
|
||||
"Allocating page at %p, object size=%lu, data %p-%p\n",
|
||||
(PTR) entry, (unsigned long) OBJECT_SIZE (order), page,
|
||||
page + entry_size - 1);
|
||||
@ -746,7 +746,7 @@ free_page (entry)
|
||||
page_entry *entry;
|
||||
{
|
||||
if (GGC_DEBUG_LEVEL >= 2)
|
||||
fprintf (G.debug_file,
|
||||
fprintf (G.debug_file,
|
||||
"Deallocating page at %p, data %p-%p\n", (PTR) entry,
|
||||
entry->page, entry->page + entry->bytes - 1);
|
||||
|
||||
@ -816,7 +816,7 @@ release_pages ()
|
||||
if (g->in_use == 0)
|
||||
{
|
||||
*gp = g->next;
|
||||
G.bytes_mapped -= g->alloc_size;
|
||||
G.bytes_mapped -= g->alloc_size;
|
||||
free (g->allocation);
|
||||
}
|
||||
else
|
||||
@ -827,16 +827,16 @@ release_pages ()
|
||||
/* This table provides a fast way to determine ceil(log_2(size)) for
|
||||
allocation requests. The minimum allocation size is eight bytes. */
|
||||
|
||||
static unsigned char size_lookup[257] =
|
||||
static unsigned char size_lookup[257] =
|
||||
{
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
|
||||
5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
|
||||
6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
|
||||
7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
|
||||
@ -878,11 +878,11 @@ ggc_alloc (size)
|
||||
{
|
||||
struct page_entry *new_entry;
|
||||
new_entry = alloc_page (order);
|
||||
|
||||
|
||||
/* If this is the only entry, it's also the tail. */
|
||||
if (entry == NULL)
|
||||
G.page_tails[order] = new_entry;
|
||||
|
||||
|
||||
/* Put new pages at the head of the page list. */
|
||||
new_entry->next = entry;
|
||||
entry = new_entry;
|
||||
@ -904,7 +904,7 @@ ggc_alloc (size)
|
||||
unsigned hint = entry->next_bit_hint;
|
||||
word = hint / HOST_BITS_PER_LONG;
|
||||
bit = hint % HOST_BITS_PER_LONG;
|
||||
|
||||
|
||||
/* If the hint didn't work, scan the bitmap from the beginning. */
|
||||
if ((entry->in_use_p[word] >> bit) & 1)
|
||||
{
|
||||
@ -953,7 +953,7 @@ ggc_alloc (size)
|
||||
G.allocated += OBJECT_SIZE (order);
|
||||
|
||||
if (GGC_DEBUG_LEVEL >= 3)
|
||||
fprintf (G.debug_file,
|
||||
fprintf (G.debug_file,
|
||||
"Allocating object, requested size=%lu, actual=%lu at %p on %p\n",
|
||||
(unsigned long) size, (unsigned long) OBJECT_SIZE (order), result,
|
||||
(PTR) entry);
|
||||
@ -986,7 +986,7 @@ ggc_set_mark (p)
|
||||
bit = (((const char *) p) - entry->page) / OBJECT_SIZE (entry->order);
|
||||
word = bit / HOST_BITS_PER_LONG;
|
||||
mask = (unsigned long) 1 << (bit % HOST_BITS_PER_LONG);
|
||||
|
||||
|
||||
/* If the bit was previously set, skip it. */
|
||||
if (entry->in_use_p[word] & mask)
|
||||
return 1;
|
||||
@ -1001,7 +1001,7 @@ ggc_set_mark (p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return 1 if P has been marked, zero otherwise.
|
||||
/* Return 1 if P has been marked, zero otherwise.
|
||||
P must have been allocated by the GC allocator; it mustn't point to
|
||||
static objects, stack variables, or memory allocated with malloc. */
|
||||
|
||||
@ -1026,7 +1026,7 @@ ggc_marked_p (p)
|
||||
bit = (((const char *) p) - entry->page) / OBJECT_SIZE (entry->order);
|
||||
word = bit / HOST_BITS_PER_LONG;
|
||||
mask = (unsigned long) 1 << (bit % HOST_BITS_PER_LONG);
|
||||
|
||||
|
||||
return (entry->in_use_p[word] & mask) != 0;
|
||||
}
|
||||
|
||||
@ -1150,7 +1150,7 @@ ggc_recalculate_in_use_p (p)
|
||||
unsigned int i;
|
||||
size_t num_objects;
|
||||
|
||||
/* Because the past-the-end bit in in_use_p is always set, we
|
||||
/* Because the past-the-end bit in in_use_p is always set, we
|
||||
pretend there is one additional object. */
|
||||
num_objects = OBJECTS_PER_PAGE (p->order) + 1;
|
||||
|
||||
@ -1158,7 +1158,7 @@ ggc_recalculate_in_use_p (p)
|
||||
p->num_free_objects = num_objects;
|
||||
|
||||
/* Combine the IN_USE_P and SAVE_IN_USE_P arrays. */
|
||||
for (i = 0;
|
||||
for (i = 0;
|
||||
i < CEIL (BITMAP_SIZE (num_objects),
|
||||
sizeof (*p->in_use_p));
|
||||
++i)
|
||||
@ -1178,7 +1178,7 @@ ggc_recalculate_in_use_p (p)
|
||||
abort ();
|
||||
}
|
||||
|
||||
/* Decrement the `GC context'. All objects allocated since the
|
||||
/* Decrement the `GC context'. All objects allocated since the
|
||||
previous ggc_push_context are migrated to the outer context. */
|
||||
|
||||
void
|
||||
@ -1249,7 +1249,7 @@ clear_marks ()
|
||||
memset (p->in_use_p, 0, bitmap_size);
|
||||
|
||||
/* Make sure the one-past-the-end bit is always set. */
|
||||
p->in_use_p[num_objects / HOST_BITS_PER_LONG]
|
||||
p->in_use_p[num_objects / HOST_BITS_PER_LONG]
|
||||
= ((unsigned long) 1 << (num_objects % HOST_BITS_PER_LONG));
|
||||
}
|
||||
}
|
||||
@ -1273,7 +1273,7 @@ sweep_pages ()
|
||||
size_t live_objects;
|
||||
page_entry *p, *previous;
|
||||
int done;
|
||||
|
||||
|
||||
p = G.pages[order];
|
||||
if (p == NULL)
|
||||
continue;
|
||||
@ -1351,7 +1351,7 @@ sweep_pages ()
|
||||
|
||||
previous = p;
|
||||
p = next;
|
||||
}
|
||||
}
|
||||
while (! done);
|
||||
|
||||
/* Now, restore the in_use_p vectors for any pages from contexts
|
||||
@ -1421,13 +1421,13 @@ ggc_collect ()
|
||||
sweep phase. */
|
||||
G.allocated = 0;
|
||||
|
||||
/* Release the pages we freed the last time we collected, but didn't
|
||||
/* Release the pages we freed the last time we collected, but didn't
|
||||
reuse in the interim. */
|
||||
release_pages ();
|
||||
|
||||
clear_marks ();
|
||||
ggc_mark_roots ();
|
||||
|
||||
|
||||
#ifdef GGC_POISON
|
||||
poison_pages ();
|
||||
#endif
|
||||
@ -1461,7 +1461,7 @@ ggc_print_statistics ()
|
||||
|
||||
/* Clear the statistics. */
|
||||
memset (&stats, 0, sizeof (stats));
|
||||
|
||||
|
||||
/* Make sure collection will really occur. */
|
||||
G.allocated_last_gc = 0;
|
||||
|
||||
@ -1472,7 +1472,7 @@ ggc_print_statistics ()
|
||||
there as part of the total allocated memory. */
|
||||
release_pages ();
|
||||
|
||||
/* Collect some information about the various sizes of
|
||||
/* Collect some information about the various sizes of
|
||||
allocation. */
|
||||
fprintf (stderr, "\n%-5s %10s %10s %10s\n",
|
||||
"Size", "Allocated", "Used", "Overhead");
|
||||
@ -1495,7 +1495,7 @@ ggc_print_statistics ()
|
||||
for (p = G.pages[i]; p; p = p->next)
|
||||
{
|
||||
allocated += p->bytes;
|
||||
in_use +=
|
||||
in_use +=
|
||||
(OBJECTS_PER_PAGE (i) - p->num_free_objects) * OBJECT_SIZE (i);
|
||||
|
||||
overhead += (sizeof (page_entry) - sizeof (long)
|
||||
|
@ -251,7 +251,7 @@ size_t
|
||||
ggc_get_size (p)
|
||||
const void *p;
|
||||
{
|
||||
struct ggc_mem *x
|
||||
struct ggc_mem *x
|
||||
= (struct ggc_mem *) ((const char *)p - offsetof (struct ggc_mem, u));
|
||||
return x->size;
|
||||
}
|
||||
@ -360,7 +360,7 @@ ggc_collect ()
|
||||
|
||||
/* Called once to initialize the garbage collector. */
|
||||
|
||||
void
|
||||
void
|
||||
init_ggc ()
|
||||
{
|
||||
G.allocated_last_gc = GGC_MIN_LAST_ALLOCATED;
|
||||
@ -383,7 +383,7 @@ ggc_push_context ()
|
||||
/* Finish a GC context. Any uncollected memory in the new context
|
||||
will be merged with the old context. */
|
||||
|
||||
void
|
||||
void
|
||||
ggc_pop_context ()
|
||||
{
|
||||
G.context--;
|
||||
@ -425,7 +425,7 @@ debug_ggc_tree (p, indent)
|
||||
for (i = 0; i < indent; ++i)
|
||||
putc (' ', stderr);
|
||||
fprintf (stderr, "%lx %p\n", (unsigned long)PTR_KEY (p), p);
|
||||
|
||||
|
||||
if (p->sub[1])
|
||||
debug_ggc_tree (p->sub[1], indent + 1);
|
||||
}
|
||||
@ -490,7 +490,7 @@ ggc_print_statistics ()
|
||||
|
||||
/* Clear the statistics. */
|
||||
memset (&stats, 0, sizeof (stats));
|
||||
|
||||
|
||||
/* Make sure collection will really occur. */
|
||||
G.allocated_last_gc = 0;
|
||||
|
||||
|
10
gcc/ggc.h
10
gcc/ggc.h
@ -33,7 +33,7 @@ extern const char digit_vector[]; /* "0" .. "9" */
|
||||
extern void ggc_add_root PARAMS ((void *base, int nelt,
|
||||
int size, void (*)(void *)));
|
||||
|
||||
/* Structures for the easy way to mark roots.
|
||||
/* Structures for the easy way to mark roots.
|
||||
In an array, terminated by having base == NULL.*/
|
||||
struct ggc_root_tab {
|
||||
void *base;
|
||||
@ -142,7 +142,7 @@ extern void ggc_collect PARAMS ((void));
|
||||
pointers in this data structure should not be traversed. */
|
||||
extern int ggc_set_mark PARAMS ((const void *));
|
||||
|
||||
/* Return 1 if P has been marked, zero otherwise.
|
||||
/* Return 1 if P has been marked, zero otherwise.
|
||||
P must have been allocated by the GC allocator; it mustn't point to
|
||||
static objects, stack variables, or memory allocated with malloc. */
|
||||
extern int ggc_marked_p PARAMS ((const void *));
|
||||
@ -151,16 +151,16 @@ extern int ggc_marked_p PARAMS ((const void *));
|
||||
|
||||
/* This structure contains the statistics common to all collectors.
|
||||
Particular collectors can extend this structure. */
|
||||
typedef struct ggc_statistics
|
||||
typedef struct ggc_statistics
|
||||
{
|
||||
/* The Ith element is the number of nodes allocated with code I. */
|
||||
unsigned num_trees[256];
|
||||
/* The Ith element is the number of bytes allocated by nodes with
|
||||
/* The Ith element is the number of bytes allocated by nodes with
|
||||
code I. */
|
||||
size_t size_trees[256];
|
||||
/* The Ith element is the number of nodes allocated with code I. */
|
||||
unsigned num_rtxs[256];
|
||||
/* The Ith element is the number of bytes allocated by nodes with
|
||||
/* The Ith element is the number of bytes allocated by nodes with
|
||||
code I. */
|
||||
size_t size_rtxs[256];
|
||||
/* The total size of the tree nodes allocated. */
|
||||
|
36
gcc/global.c
36
gcc/global.c
@ -52,7 +52,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
1. Assign allocation-numbers (allocnos) to the pseudo-registers
|
||||
still needing allocations and to the pseudo-registers currently
|
||||
allocated by local-alloc which may be spilled by reload.
|
||||
Set up tables reg_allocno and allocno_reg to map
|
||||
Set up tables reg_allocno and allocno_reg to map
|
||||
reg numbers to allocnos and vice versa.
|
||||
max_allocno gets the number of allocnos in use.
|
||||
|
||||
@ -483,7 +483,7 @@ global_alloc (file)
|
||||
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
|
||||
if (regs_ever_live[i])
|
||||
local_reg_n_refs[i] = 0, local_reg_freq[i] = 0;
|
||||
|
||||
|
||||
allocno_row_words = (max_allocno + INT_BITS - 1) / INT_BITS;
|
||||
|
||||
/* We used to use alloca here, but the size of what it would try to
|
||||
@ -549,7 +549,7 @@ global_alloc (file)
|
||||
}
|
||||
|
||||
qsort (allocno_order, max_allocno, sizeof (int), allocno_compare);
|
||||
|
||||
|
||||
prune_preferences ();
|
||||
|
||||
if (file)
|
||||
@ -884,18 +884,18 @@ expand_preferences ()
|
||||
|
||||
/* Prune the preferences for global registers to exclude registers that cannot
|
||||
be used.
|
||||
|
||||
|
||||
Compute `regs_someone_prefers', which is a bitmask of the hard registers
|
||||
that are preferred by conflicting registers of lower priority. If possible,
|
||||
we will avoid using these registers. */
|
||||
|
||||
|
||||
static void
|
||||
prune_preferences ()
|
||||
{
|
||||
int i;
|
||||
int num;
|
||||
int *allocno_to_order = (int *) xmalloc (max_allocno * sizeof (int));
|
||||
|
||||
|
||||
/* Scan least most important to most important.
|
||||
For each allocno, remove from preferences registers that cannot be used,
|
||||
either because of conflicts or register type. Then compute all registers
|
||||
@ -1028,7 +1028,7 @@ find_reg (num, losers, alt_regs_p, accept_call_clobbered, retrying)
|
||||
COPY_HARD_REG_SET (used, used1);
|
||||
IOR_COMPL_HARD_REG_SET (used, regs_used_so_far);
|
||||
IOR_HARD_REG_SET (used, allocno[num].regs_someone_prefers);
|
||||
|
||||
|
||||
best_reg = -1;
|
||||
for (i = FIRST_PSEUDO_REGISTER, pass = 0;
|
||||
pass <= 1 && i >= FIRST_PSEUDO_REGISTER;
|
||||
@ -1073,7 +1073,7 @@ find_reg (num, losers, alt_regs_p, accept_call_clobbered, retrying)
|
||||
|
||||
Remove from the preferred registers and conflicting registers. Note that
|
||||
additional conflicts may have been added after `prune_preferences' was
|
||||
called.
|
||||
called.
|
||||
|
||||
First do this for those register with copy preferences, then all
|
||||
preferred registers. */
|
||||
@ -1156,7 +1156,7 @@ find_reg (num, losers, alt_regs_p, accept_call_clobbered, retrying)
|
||||
}
|
||||
no_prefs:
|
||||
|
||||
/* If we haven't succeeded yet, try with caller-saves.
|
||||
/* If we haven't succeeded yet, try with caller-saves.
|
||||
We need not check to see if the current function has nonlocal
|
||||
labels because we don't put any pseudos that are live over calls in
|
||||
registers in that case. */
|
||||
@ -1176,7 +1176,7 @@ find_reg (num, losers, alt_regs_p, accept_call_clobbered, retrying)
|
||||
CLEAR_HARD_REG_SET (new_losers);
|
||||
else
|
||||
COPY_HARD_REG_SET (new_losers, losers);
|
||||
|
||||
|
||||
IOR_HARD_REG_SET(new_losers, losing_caller_save_reg_set);
|
||||
find_reg (num, new_losers, alt_regs_p, 1, retrying);
|
||||
if (reg_renumber[allocno[num].reg] >= 0)
|
||||
@ -1223,7 +1223,7 @@ find_reg (num, losers, alt_regs_p, accept_call_clobbered, retrying)
|
||||
/* We explicitly evaluate the divide results into temporary
|
||||
variables so as to avoid excess precision problems that occur
|
||||
on an i386-unknown-sysv4.2 (unixware) host. */
|
||||
|
||||
|
||||
double tmp1 = ((double) local_reg_freq[regno]
|
||||
/ local_reg_live_length[regno]);
|
||||
double tmp2 = ((double) allocno[num].freq
|
||||
@ -1593,7 +1593,7 @@ mark_reg_live_nc (regno, mode)
|
||||
that SRC is a register. If SRC or the first operand of SRC is a register,
|
||||
try to set a preference. If one of the two is a hard register and the other
|
||||
is a pseudo-register, mark the preference.
|
||||
|
||||
|
||||
Note that we are not as aggressive as local-alloc in trying to tie a
|
||||
pseudo-register to a hard register. */
|
||||
|
||||
@ -1713,7 +1713,7 @@ mark_elimination (from, to)
|
||||
|
||||
FOR_EACH_BB (bb)
|
||||
{
|
||||
regset r = bb->global_live_at_start;
|
||||
regset r = bb->global_live_at_start;
|
||||
if (REGNO_REG_SET_P (r, from))
|
||||
{
|
||||
CLEAR_REGNO_REG_SET (r, from);
|
||||
@ -1741,7 +1741,7 @@ reg_becomes_live (reg, setter, regs_set)
|
||||
|
||||
if (GET_CODE (reg) != REG)
|
||||
return;
|
||||
|
||||
|
||||
regno = REGNO (reg);
|
||||
if (regno < FIRST_PSEUDO_REGISTER)
|
||||
{
|
||||
@ -1818,7 +1818,7 @@ build_insn_chain (first)
|
||||
: reg_renumber[i] >= 0)
|
||||
SET_REGNO_REG_SET (live_relevant_regs, i);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (GET_CODE (first) != NOTE && GET_CODE (first) != BARRIER)
|
||||
{
|
||||
@ -1906,7 +1906,7 @@ dump_conflicts (file)
|
||||
for (i = 0; i < max_allocno; i++)
|
||||
{
|
||||
if (reg_renumber[allocno[allocno_order[i]].reg] >= 0)
|
||||
continue;
|
||||
continue;
|
||||
nregs++;
|
||||
}
|
||||
fprintf (file, ";; %d regs to allocate:", nregs);
|
||||
@ -1958,13 +1958,13 @@ dump_global_regs (file)
|
||||
FILE *file;
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
||||
fprintf (file, ";; Register dispositions:\n");
|
||||
for (i = FIRST_PSEUDO_REGISTER, j = 0; i < max_regno; i++)
|
||||
if (reg_renumber[i] >= 0)
|
||||
{
|
||||
fprintf (file, "%d in %d ", i, reg_renumber[i]);
|
||||
if (++j % 6 == 0)
|
||||
if (++j % 6 == 0)
|
||||
fprintf (file, "\n");
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Header file for graph routines.
|
||||
/* Header file for graph routines.
|
||||
Copyright (C) 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GCC.
|
||||
|
@ -146,9 +146,9 @@ __gthread_objc_thread_detach(void (*func)(void *), void *arg)
|
||||
|
||||
if (!__gthread_active_p ())
|
||||
return NULL;
|
||||
|
||||
|
||||
if ( !(pthread_create(&new_thread_handle, pthread_attr_default,
|
||||
(void *)func, arg)) )
|
||||
(void *)func, arg)) )
|
||||
{
|
||||
/* ??? May not work! (64bit) */
|
||||
thread_id = *(objc_thread_t *)&new_thread_handle;
|
||||
@ -156,7 +156,7 @@ __gthread_objc_thread_detach(void (*func)(void *), void *arg)
|
||||
}
|
||||
else
|
||||
thread_id = NULL;
|
||||
|
||||
|
||||
return thread_id;
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ __gthread_objc_thread_set_priority(int priority)
|
||||
sys_priority = (PRI_BG_MIN_NP + PRI_BG_MAX_NP) / 2;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Change the priority. */
|
||||
if (pthread_setprio(pthread_self(), sys_priority) >= 0)
|
||||
return 0;
|
||||
@ -200,7 +200,7 @@ __gthread_objc_thread_get_priority(void)
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
if ((sys_priority = pthread_getprio(pthread_self())) >= 0)
|
||||
{
|
||||
{
|
||||
if (sys_priority >= PRI_FG_MIN_NP
|
||||
&& sys_priority <= PRI_FG_MAX_NP)
|
||||
return OBJC_THREAD_INTERACTIVE_PRIORITY;
|
||||
@ -292,12 +292,12 @@ __gthread_objc_mutex_allocate(objc_mutex_t mutex)
|
||||
mutex->backend = objc_malloc(sizeof(pthread_mutex_t));
|
||||
|
||||
if (pthread_mutex_init((pthread_mutex_t *)mutex->backend,
|
||||
pthread_mutexattr_default))
|
||||
{
|
||||
objc_free(mutex->backend);
|
||||
mutex->backend = NULL;
|
||||
return -1;
|
||||
}
|
||||
pthread_mutexattr_default))
|
||||
{
|
||||
objc_free(mutex->backend);
|
||||
mutex->backend = NULL;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -310,7 +310,7 @@ __gthread_objc_mutex_deallocate(objc_mutex_t mutex)
|
||||
if (__gthread_active_p ())
|
||||
{
|
||||
if (pthread_mutex_destroy((pthread_mutex_t *)mutex->backend))
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
objc_free(mutex->backend);
|
||||
mutex->backend = NULL;
|
||||
|
@ -52,9 +52,9 @@ typedef pthread_mutex_t __gthread_mutex_t;
|
||||
#pragma weak pthread_setspecific
|
||||
#pragma weak pthread_create
|
||||
|
||||
#pragma weak pthread_mutex_lock
|
||||
#pragma weak pthread_mutex_trylock
|
||||
#pragma weak pthread_mutex_unlock
|
||||
#pragma weak pthread_mutex_lock
|
||||
#pragma weak pthread_mutex_trylock
|
||||
#pragma weak pthread_mutex_unlock
|
||||
|
||||
#ifdef _LIBOBJC
|
||||
/* Objective C. */
|
||||
@ -120,15 +120,15 @@ __gthread_objc_init_thread_system(void)
|
||||
{
|
||||
/* Initialize the thread storage key */
|
||||
if (pthread_key_create(&_objc_thread_storage, NULL) == 0)
|
||||
{
|
||||
/* The normal default detach state for threads is
|
||||
* PTHREAD_CREATE_JOINABLE which causes threads to not die
|
||||
* when you think they should. */
|
||||
if (pthread_attr_init(&_objc_thread_attribs) == 0
|
||||
&& pthread_attr_setdetachstate(&_objc_thread_attribs,
|
||||
PTHREAD_CREATE_DETACHED) == 0)
|
||||
return 0;
|
||||
}
|
||||
{
|
||||
/* The normal default detach state for threads is
|
||||
* PTHREAD_CREATE_JOINABLE which causes threads to not die
|
||||
* when you think they should. */
|
||||
if (pthread_attr_init(&_objc_thread_attribs) == 0
|
||||
&& pthread_attr_setdetachstate(&_objc_thread_attribs,
|
||||
PTHREAD_CREATE_DETACHED) == 0)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
@ -157,12 +157,12 @@ __gthread_objc_thread_detach(void (*func)(void *), void *arg)
|
||||
|
||||
if (!__gthread_active_p ())
|
||||
return NULL;
|
||||
|
||||
|
||||
if ( !(pthread_create(&new_thread_handle, NULL, (void *)func, arg)) )
|
||||
thread_id = (objc_thread_t) new_thread_handle;
|
||||
else
|
||||
thread_id = NULL;
|
||||
|
||||
|
||||
return thread_id;
|
||||
}
|
||||
|
||||
@ -180,25 +180,25 @@ __gthread_objc_thread_set_priority(int priority)
|
||||
|
||||
if (pthread_getschedparam(thread_id, &policy, ¶ms) == 0)
|
||||
{
|
||||
if ((priority_max = sched_get_priority_max(policy)) != 0)
|
||||
return -1;
|
||||
if ((priority_max = sched_get_priority_max(policy)) != 0)
|
||||
return -1;
|
||||
|
||||
if ((priority_min = sched_get_priority_min(policy)) != 0)
|
||||
return -1;
|
||||
if ((priority_min = sched_get_priority_min(policy)) != 0)
|
||||
return -1;
|
||||
|
||||
if (priority > priority_max)
|
||||
priority = priority_max;
|
||||
else if (priority < priority_min)
|
||||
priority = priority_min;
|
||||
params.sched_priority = priority;
|
||||
if (priority > priority_max)
|
||||
priority = priority_max;
|
||||
else if (priority < priority_min)
|
||||
priority = priority_min;
|
||||
params.sched_priority = priority;
|
||||
|
||||
/*
|
||||
* The solaris 7 and several other man pages incorrectly state that
|
||||
* this should be a pointer to policy but pthread.h is universally
|
||||
* at odds with this.
|
||||
*/
|
||||
if (pthread_setschedparam(thread_id, policy, ¶ms) == 0)
|
||||
return 0;
|
||||
/*
|
||||
* The solaris 7 and several other man pages incorrectly state that
|
||||
* this should be a pointer to policy but pthread.h is universally
|
||||
* at odds with this.
|
||||
*/
|
||||
if (pthread_setschedparam(thread_id, policy, ¶ms) == 0)
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@ -214,9 +214,9 @@ __gthread_objc_thread_get_priority(void)
|
||||
struct sched_param params;
|
||||
|
||||
if (pthread_getschedparam(pthread_self(), &policy, ¶ms) == 0)
|
||||
return params.sched_priority;
|
||||
return params.sched_priority;
|
||||
else
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
return OBJC_THREAD_INTERACTIVE_PRIORITY;
|
||||
@ -330,7 +330,7 @@ __gthread_objc_mutex_deallocate(objc_mutex_t mutex)
|
||||
static inline int
|
||||
__gthread_objc_mutex_lock(objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ()
|
||||
if (__gthread_active_p ()
|
||||
&& pthread_mutex_lock((pthread_mutex_t *)mutex->backend) != 0)
|
||||
{
|
||||
return -1;
|
||||
@ -343,7 +343,7 @@ __gthread_objc_mutex_lock(objc_mutex_t mutex)
|
||||
static inline int
|
||||
__gthread_objc_mutex_trylock(objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ()
|
||||
if (__gthread_active_p ()
|
||||
&& pthread_mutex_trylock((pthread_mutex_t *)mutex->backend) != 0)
|
||||
{
|
||||
return -1;
|
||||
@ -356,7 +356,7 @@ __gthread_objc_mutex_trylock(objc_mutex_t mutex)
|
||||
static inline int
|
||||
__gthread_objc_mutex_unlock(objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ()
|
||||
if (__gthread_active_p ()
|
||||
&& pthread_mutex_unlock((pthread_mutex_t *)mutex->backend) != 0)
|
||||
{
|
||||
return -1;
|
||||
|
@ -45,7 +45,7 @@ typedef int __gthread_once_t;
|
||||
typedef void *__gthread_mutex_t;
|
||||
|
||||
/*
|
||||
* External functions provided by RTEMS. They are very similar to their POSIX
|
||||
* External functions provided by RTEMS. They are very similar to their POSIX
|
||||
* counterparts. A "Wrapper API" is being use to avoid dependency on any RTEMS
|
||||
* header files.
|
||||
*/
|
||||
|
@ -141,14 +141,14 @@ __gthread_objc_thread_detach(void (*func)(void *), void *arg)
|
||||
|
||||
if (!__gthread_active_p ())
|
||||
return NULL;
|
||||
|
||||
|
||||
if (thr_create(NULL, 0, (void *)func, arg,
|
||||
THR_DETACHED | THR_NEW_LWP,
|
||||
THR_DETACHED | THR_NEW_LWP,
|
||||
&new_thread_id) == 0)
|
||||
thread_id = *(objc_thread_t *)&new_thread_id;
|
||||
else
|
||||
thread_id = NULL;
|
||||
|
||||
|
||||
return thread_id;
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ __gthread_objc_thread_get_priority(void)
|
||||
|
||||
if (!__gthread_active_p ())
|
||||
return OBJC_THREAD_INTERACTIVE_PRIORITY;
|
||||
|
||||
|
||||
if (thr_getprio(thr_self(), &sys_priority) == 0)
|
||||
{
|
||||
if (sys_priority >= 250)
|
||||
@ -333,7 +333,7 @@ __gthread_objc_condition_allocate(objc_condition_t condition)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return cond_init((cond_t *)(&(condition->backend)), USYNC_THREAD,
|
||||
NULL);
|
||||
NULL);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@ -354,7 +354,7 @@ __gthread_objc_condition_wait(objc_condition_t condition, objc_mutex_t mutex)
|
||||
{
|
||||
if (__gthread_active_p ())
|
||||
return cond_wait((cond_t *)(&(condition->backend)),
|
||||
(mutex_t *)(&(mutex->backend)));
|
||||
(mutex_t *)(&(mutex->backend)));
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
@ -31,12 +31,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
#define GCC_GTHR_WIN32_H
|
||||
|
||||
/* Windows32 threads specific definitions. The windows32 threading model
|
||||
does not map well into pthread-inspired gcc's threading model, and so
|
||||
does not map well into pthread-inspired gcc's threading model, and so
|
||||
there are caveats one needs to be aware of.
|
||||
|
||||
1. The destructor supplied to __gthread_key_create is ignored for
|
||||
generic x86-win32 ports. This will certainly cause memory leaks
|
||||
due to unreclaimed eh contexts (sizeof (eh_context) is at least
|
||||
generic x86-win32 ports. This will certainly cause memory leaks
|
||||
due to unreclaimed eh contexts (sizeof (eh_context) is at least
|
||||
24 bytes for x86 currently).
|
||||
|
||||
This memory leak may be significant for long-running applications
|
||||
@ -47,18 +47,18 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
linked in if -mthreads option is specified, that runs the dtors in
|
||||
the reverse order of registration when each thread exits. If
|
||||
-mthreads option is not given, a stub is linked in instead of the
|
||||
DLL, which results in memory leak. Other x86-win32 ports can use
|
||||
DLL, which results in memory leak. Other x86-win32 ports can use
|
||||
the same technique of course to avoid the leak.
|
||||
|
||||
2. The error codes returned are non-POSIX like, and cast into ints.
|
||||
This may cause incorrect error return due to truncation values on
|
||||
This may cause incorrect error return due to truncation values on
|
||||
hw where sizeof (DWORD) > sizeof (int).
|
||||
|
||||
3. We might consider using Critical Sections instead of Windows32
|
||||
mutexes for better performance, but emulating __gthread_mutex_trylock
|
||||
|
||||
3. We might consider using Critical Sections instead of Windows32
|
||||
mutexes for better performance, but emulating __gthread_mutex_trylock
|
||||
interface becomes more complicated (Win9x does not support
|
||||
TryEnterCriticalSectioni, while NT does).
|
||||
|
||||
|
||||
The basic framework should work well enough. In the long term, GCC
|
||||
needs to use Structured Exception Handling on Windows32. */
|
||||
|
||||
@ -72,12 +72,12 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
#ifdef _LIBOBJC
|
||||
|
||||
/* This is necessary to prevent windef.h (included from windows.h) from
|
||||
defining it's own BOOL as a typedef. */
|
||||
defining it's own BOOL as a typedef. */
|
||||
#ifndef __OBJC__
|
||||
#define __OBJC__
|
||||
#endif
|
||||
#include <windows.h>
|
||||
/* Now undef the windows BOOL. */
|
||||
/* Now undef the windows BOOL. */
|
||||
#undef BOOL
|
||||
|
||||
/* Key structure for maintaining thread specific storage */
|
||||
@ -115,9 +115,9 @@ __gthread_objc_thread_detach(void (*func)(void *arg), void *arg)
|
||||
HANDLE win32_handle;
|
||||
|
||||
if (!(win32_handle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)func,
|
||||
arg, 0, &thread_id)))
|
||||
arg, 0, &thread_id)))
|
||||
thread_id = 0;
|
||||
|
||||
|
||||
return (objc_thread_t)thread_id;
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ __gthread_objc_thread_get_priority(void)
|
||||
int sys_priority;
|
||||
|
||||
sys_priority = GetThreadPriority(GetCurrentThread());
|
||||
|
||||
|
||||
switch (sys_priority)
|
||||
{
|
||||
case THREAD_PRIORITY_HIGHEST:
|
||||
@ -167,7 +167,7 @@ __gthread_objc_thread_get_priority(void)
|
||||
default:
|
||||
case THREAD_PRIORITY_BELOW_NORMAL:
|
||||
return OBJC_THREAD_BACKGROUND_PRIORITY;
|
||||
|
||||
|
||||
case THREAD_PRIORITY_IDLE:
|
||||
case THREAD_PRIORITY_LOWEST:
|
||||
return OBJC_THREAD_LOW_PRIORITY;
|
||||
@ -355,7 +355,7 @@ extern int __mingwthr_key_dtor (DWORD, void (*) (void *));
|
||||
#endif
|
||||
|
||||
/* Mingw runtime >= v0.3 provides a magic variable that is set to non-zero
|
||||
if -mthreads option was specified, or 0 otherwise. This is to get around
|
||||
if -mthreads option was specified, or 0 otherwise. This is to get around
|
||||
the lack of weak symbols in PE-COFF. */
|
||||
extern int _CRT_MT;
|
||||
#endif
|
||||
@ -381,27 +381,27 @@ __gthread_once (__gthread_once_t *once, void (*func) (void))
|
||||
if (! once->done)
|
||||
{
|
||||
if (InterlockedIncrement (&(once->started)) == 0)
|
||||
{
|
||||
{
|
||||
(*func) ();
|
||||
once->done = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Another thread is currently executing the code, so wait for it
|
||||
to finish; yield the CPU in the meantime. If performance
|
||||
does become an issue, the solution is to use an Event that
|
||||
we wait on here (and set above), but that implies a place to
|
||||
create the event before this routine is called. */
|
||||
/* Another thread is currently executing the code, so wait for it
|
||||
to finish; yield the CPU in the meantime. If performance
|
||||
does become an issue, the solution is to use an Event that
|
||||
we wait on here (and set above), but that implies a place to
|
||||
create the event before this routine is called. */
|
||||
while (! once->done)
|
||||
Sleep (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Windows32 thread local keys don't support destructors; this leads to
|
||||
leaks, especially in threaded applications making extensive use of
|
||||
leaks, especially in threaded applications making extensive use of
|
||||
C++ EH. Mingw uses a thread-support DLL to work-around this problem. */
|
||||
static inline int
|
||||
__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
|
||||
@ -423,7 +423,7 @@ __gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
|
||||
}
|
||||
|
||||
/* Currently, this routine is called only for Mingw runtime, and if
|
||||
-mthreads option is chosen to link in the thread support DLL. */
|
||||
-mthreads option is chosen to link in the thread support DLL. */
|
||||
static inline int
|
||||
__gthread_key_dtor (__gthread_key_t key, void *ptr)
|
||||
{
|
||||
@ -461,7 +461,7 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr)
|
||||
static inline void
|
||||
__gthread_mutex_init_function (__gthread_mutex_t *mutex)
|
||||
{
|
||||
/* Create unnamed mutex with default security attr and no initial owner. */
|
||||
/* Create unnamed mutex with default security attr and no initial owner. */
|
||||
*mutex = CreateMutex (NULL, 0, NULL);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
||||
/* If this file is compiled with threads support, it must
|
||||
#define __GTHREADS 1
|
||||
to indicate that threads support is present. Also it has define
|
||||
function
|
||||
function
|
||||
int __gthread_active_p ()
|
||||
that returns 1 if thread system is active, 0 if not.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user