gengtype.c (adjust_field_type): Diagnose duplicate "length" option applications and option being applied to...
gcc: 2012-07-27 Laurynas Biveinis <laurynas.biveinis@gmail.com> Steven Bosscher <steven@gcc.gnu.org> * gengtype.c (adjust_field_type): Diagnose duplicate "length" option applications and option being applied to arrays of atomic types. (walk_type): Allow "atomic" option on strings too. * dwarf2out.h (struct dw_vec_struct): Use the "atomic" GTY option for the array field. * vec.h: Describe the atomic object "A" type of the macros in the header comment. (VEC_T_GTY_ATOMIC, DEF_VEC_A, DEF_VEC_ALLOC_A): Define. * emit-rtl.c (locations_locators_vals): use the atomic object vector. * doc/gty.texi: Clarify that GTY option "length" is only for arrays of non-atomic objects. Fix typo in the description of the "atomic" option. gcc/java: 2012-07-24 Laurynas Biveinis <laurynas.biveinis@gmail.com> * jcf.h (CPool): Use the "atomic" GTY option for the tags field. (bootstrap_method): Likewise for the bootstrap_arguments field. libcpp: 2012-07-24 Laurynas Biveinis <laurynas.biveinis@gmail.com> * include/line-map.h (line_map_macro): Use the "atomic" GTY option for the macro_locations field. Co-Authored-By: Steven Bosscher <steven@gcc.gnu.org> From-SVN: r189951
This commit is contained in:
parent
1c5f95e6ec
commit
c0fd34971d
|
@ -1,3 +1,21 @@
|
||||||
|
2012-07-30 Laurynas Biveinis <laurynas.biveinis@gmail.com>
|
||||||
|
Steven Bosscher <steven@gcc.gnu.org>
|
||||||
|
|
||||||
|
* gengtype.c (adjust_field_type): Diagnose duplicate "length"
|
||||||
|
option applications and option being applied to arrays of atomic
|
||||||
|
types.
|
||||||
|
(walk_type): Allow "atomic" option on strings too.
|
||||||
|
* dwarf2out.h (struct dw_vec_struct): Use the "atomic" GTY option
|
||||||
|
for the array field.
|
||||||
|
* vec.h: Describe the atomic object "A" type of the macros in
|
||||||
|
the header comment.
|
||||||
|
(VEC_T_GTY_ATOMIC, DEF_VEC_A, DEF_VEC_ALLOC_A): Define.
|
||||||
|
* emit-rtl.c (locations_locators_vals): use the atomic object
|
||||||
|
vector.
|
||||||
|
* doc/gty.texi: Clarify that GTY option "length" is only for
|
||||||
|
arrays of non-atomic objects. Fix typo in the description of the
|
||||||
|
"atomic" option.
|
||||||
|
|
||||||
2012-07-27 Uros Bizjak <ubizjak@gmail.com>
|
2012-07-27 Uros Bizjak <ubizjak@gmail.com>
|
||||||
|
|
||||||
* config/i386/i386.c (ix86_avoid_lea_for_addr): Handle
|
* config/i386/i386.c (ix86_avoid_lea_for_addr): Handle
|
||||||
|
|
|
@ -134,8 +134,8 @@ The available options are:
|
||||||
@item length ("@var{expression}")
|
@item length ("@var{expression}")
|
||||||
|
|
||||||
There are two places the type machinery will need to be explicitly told
|
There are two places the type machinery will need to be explicitly told
|
||||||
the length of an array. The first case is when a structure ends in a
|
the length of an array of non-atomic objects. The first case is when a
|
||||||
variable-length array, like this:
|
structure ends in a variable-length array, like this:
|
||||||
@smallexample
|
@smallexample
|
||||||
struct GTY(()) rtvec_def @{
|
struct GTY(()) rtvec_def @{
|
||||||
int num_elem; /* @r{number of elements} */
|
int num_elem; /* @r{number of elements} */
|
||||||
|
@ -163,6 +163,11 @@ This second use of @code{length} also works on global variables, like:
|
||||||
static GTY((length("reg_known_value_size"))) rtx *reg_known_value;
|
static GTY((length("reg_known_value_size"))) rtx *reg_known_value;
|
||||||
@end verbatim
|
@end verbatim
|
||||||
|
|
||||||
|
Note that the @code{length} option is only meant for use with arrays of
|
||||||
|
non-atomic objects, that is, objects that contain pointers pointing to
|
||||||
|
other GTY-managed objects. For other GC-allocated arrays and strings
|
||||||
|
you should use @code{atomic}.
|
||||||
|
|
||||||
@findex skip
|
@findex skip
|
||||||
@item skip
|
@item skip
|
||||||
|
|
||||||
|
@ -411,7 +416,7 @@ Here is an example of how to use it:
|
||||||
@smallexample
|
@smallexample
|
||||||
struct GTY(()) my_struct @{
|
struct GTY(()) my_struct @{
|
||||||
int number_of_elements;
|
int number_of_elements;
|
||||||
unsigned int GTY ((atomic)) * elements;
|
unsigned int * GTY ((atomic)) elements;
|
||||||
@};
|
@};
|
||||||
@end smallexample
|
@end smallexample
|
||||||
In this case, @code{elements} is a pointer under GC, and the memory it
|
In this case, @code{elements} is a pointer under GC, and the memory it
|
||||||
|
|
|
@ -160,7 +160,7 @@ enum dw_val_class
|
||||||
/* Describe a floating point constant value, or a vector constant value. */
|
/* Describe a floating point constant value, or a vector constant value. */
|
||||||
|
|
||||||
typedef struct GTY(()) dw_vec_struct {
|
typedef struct GTY(()) dw_vec_struct {
|
||||||
unsigned char * GTY((length ("%h.length"))) array;
|
unsigned char * GTY((atomic)) array;
|
||||||
unsigned length;
|
unsigned length;
|
||||||
unsigned elt_size;
|
unsigned elt_size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5910,8 +5910,8 @@ gen_hard_reg_clobber (enum machine_mode mode, unsigned int regno)
|
||||||
static VEC(int,heap) *block_locators_locs;
|
static VEC(int,heap) *block_locators_locs;
|
||||||
static GTY(()) VEC(tree,gc) *block_locators_blocks;
|
static GTY(()) VEC(tree,gc) *block_locators_blocks;
|
||||||
static VEC(int,heap) *locations_locators_locs;
|
static VEC(int,heap) *locations_locators_locs;
|
||||||
DEF_VEC_O(location_t);
|
DEF_VEC_A(location_t);
|
||||||
DEF_VEC_ALLOC_O(location_t,heap);
|
DEF_VEC_ALLOC_A(location_t,heap);
|
||||||
static VEC(location_t,heap) *locations_locators_vals;
|
static VEC(location_t,heap) *locations_locators_vals;
|
||||||
int prologue_locator;
|
int prologue_locator;
|
||||||
int epilogue_locator;
|
int epilogue_locator;
|
||||||
|
|
|
@ -1256,7 +1256,17 @@ adjust_field_type (type_p t, options_p opt)
|
||||||
|
|
||||||
for (; opt; opt = opt->next)
|
for (; opt; opt = opt->next)
|
||||||
if (strcmp (opt->name, "length") == 0)
|
if (strcmp (opt->name, "length") == 0)
|
||||||
|
{
|
||||||
|
if (length_p)
|
||||||
|
error_at_line (&lexer_line, "duplicate `%s' option", opt->name);
|
||||||
|
if (t->u.p->kind == TYPE_SCALAR || t->u.p->kind == TYPE_STRING)
|
||||||
|
{
|
||||||
|
error_at_line (&lexer_line,
|
||||||
|
"option `%s' may not be applied to "
|
||||||
|
"arrays of atomic types", opt->name);
|
||||||
|
}
|
||||||
length_p = 1;
|
length_p = 1;
|
||||||
|
}
|
||||||
else if ((strcmp (opt->name, "param_is") == 0
|
else if ((strcmp (opt->name, "param_is") == 0
|
||||||
|| (strncmp (opt->name, "param", 5) == 0
|
|| (strncmp (opt->name, "param", 5) == 0
|
||||||
&& ISDIGIT (opt->name[5])
|
&& ISDIGIT (opt->name[5])
|
||||||
|
@ -2495,7 +2505,7 @@ walk_type (type_p t, struct walk_type_data *d)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (atomic_p && (t->kind != TYPE_POINTER))
|
if (atomic_p && (t->kind != TYPE_POINTER) && (t->kind != TYPE_STRING))
|
||||||
{
|
{
|
||||||
error_at_line (d->line, "field `%s' has invalid option `atomic'\n", d->val);
|
error_at_line (d->line, "field `%s' has invalid option `atomic'\n", d->val);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2012-07-30 Laurynas Biveinis <laurynas.biveinis@gmail.com>
|
||||||
|
|
||||||
|
* jcf.h (CPool): Use the "atomic" GTY option for the tags field.
|
||||||
|
(bootstrap_method): Likewise for the bootstrap_arguments field.
|
||||||
|
|
||||||
2012-07-16 Steven Bosscher <steven@gcc.gnu.org>
|
2012-07-16 Steven Bosscher <steven@gcc.gnu.org>
|
||||||
|
|
||||||
* java-gimplify.c Include dumpfile.h instead of tree-dump.h
|
* java-gimplify.c Include dumpfile.h instead of tree-dump.h
|
||||||
|
|
|
@ -82,7 +82,7 @@ typedef struct GTY(()) CPool {
|
||||||
/* The constant_pool_count. */
|
/* The constant_pool_count. */
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
uint8* GTY((length ("%h.count"))) tags;
|
uint8 * GTY((atomic)) tags;
|
||||||
|
|
||||||
union cpool_entry * GTY((length ("%h.count"),
|
union cpool_entry * GTY((length ("%h.count"),
|
||||||
desc ("cpool_entry_is_tree (%1.tags%a)"))) data;
|
desc ("cpool_entry_is_tree (%1.tags%a)"))) data;
|
||||||
|
@ -91,7 +91,7 @@ typedef struct GTY(()) CPool {
|
||||||
typedef struct GTY(()) bootstrap_method {
|
typedef struct GTY(()) bootstrap_method {
|
||||||
unsigned method_ref;
|
unsigned method_ref;
|
||||||
unsigned num_arguments;
|
unsigned num_arguments;
|
||||||
unsigned* GTY((length ("%h.num_arguments"))) bootstrap_arguments;
|
unsigned * GTY((atomic)) bootstrap_arguments;
|
||||||
} bootstrap_method;
|
} bootstrap_method;
|
||||||
|
|
||||||
typedef struct GTY(()) BootstrapMethods {
|
typedef struct GTY(()) BootstrapMethods {
|
||||||
|
|
40
gcc/vec.h
40
gcc/vec.h
|
@ -95,24 +95,25 @@ along with GCC; see the file COPYING3. If not see
|
||||||
the 'space' predicate will tell you whether there is spare capacity
|
the 'space' predicate will tell you whether there is spare capacity
|
||||||
in the vector. You will not normally need to use these two functions.
|
in the vector. You will not normally need to use these two functions.
|
||||||
|
|
||||||
Vector types are defined using a DEF_VEC_{O,P,I}(TYPEDEF) macro, to
|
Vector types are defined using a DEF_VEC_{O,A,P,I}(TYPEDEF) macro, to
|
||||||
get the non-memory allocation version, and then a
|
get the non-memory allocation version, and then a
|
||||||
DEF_VEC_ALLOC_{O,P,I}(TYPEDEF,ALLOC) macro to get memory managed
|
DEF_VEC_ALLOC_{O,A,P,I}(TYPEDEF,ALLOC) macro to get memory managed
|
||||||
vectors. Variables of vector type are declared using a
|
vectors. Variables of vector type are declared using a
|
||||||
VEC(TYPEDEF,ALLOC) macro. The ALLOC argument specifies the
|
VEC(TYPEDEF,ALLOC) macro. The ALLOC argument specifies the
|
||||||
allocation strategy, and can be either 'gc' or 'heap' for garbage
|
allocation strategy, and can be either 'gc' or 'heap' for garbage
|
||||||
collected and heap allocated respectively. It can be 'none' to get
|
collected and heap allocated respectively. It can be 'none' to get
|
||||||
a vector that must be explicitly allocated (for instance as a
|
a vector that must be explicitly allocated (for instance as a
|
||||||
trailing array of another structure). The characters O, P and I
|
trailing array of another structure). The characters O, A, P and I
|
||||||
indicate whether TYPEDEF is a pointer (P), object (O) or integral
|
indicate whether TYPEDEF is a pointer (P), object (O), atomic object
|
||||||
(I) type. Be careful to pick the correct one, as you'll get an
|
(A) or integral (I) type. Be careful to pick the correct one, as
|
||||||
awkward and inefficient API if you use the wrong one. There is a
|
you'll get an awkward and inefficient API if you use the wrong one or
|
||||||
check, which results in a compile-time warning, for the P and I
|
a even a crash if you pick the atomic object version when the object
|
||||||
versions, but there is no check for the O versions, as that is not
|
version should have been chosen instead. There is a check, which
|
||||||
possible in plain C. Due to the way GTY works, you must annotate
|
results in a compile-time warning, for the P and I versions, but there
|
||||||
any structures you wish to insert or reference from a vector with a
|
is no check for the O versions, as that is not possible in plain C.
|
||||||
GTY(()) tag. You need to do this even if you never declare the GC
|
Due to the way GTY works, you must annotate any structures you wish to
|
||||||
allocated variants.
|
insert or reference from a vector with a GTY(()) tag. You need to do
|
||||||
|
this even if you never declare the GC allocated variants.
|
||||||
|
|
||||||
An example of their use would be,
|
An example of their use would be,
|
||||||
|
|
||||||
|
@ -530,6 +531,13 @@ typedef struct GTY(()) VEC(T,B) \
|
||||||
T GTY ((length ("%h.prefix.num"))) vec[1]; \
|
T GTY ((length ("%h.prefix.num"))) vec[1]; \
|
||||||
} VEC(T,B)
|
} VEC(T,B)
|
||||||
|
|
||||||
|
#define VEC_T_GTY_ATOMIC(T,B) \
|
||||||
|
typedef struct GTY(()) VEC(T,B) \
|
||||||
|
{ \
|
||||||
|
struct vec_prefix prefix; \
|
||||||
|
T GTY ((atomic)) vec[1]; \
|
||||||
|
} VEC(T,B)
|
||||||
|
|
||||||
/* Derived vector type, user visible. */
|
/* Derived vector type, user visible. */
|
||||||
#define VEC_TA_GTY(T,B,A,GTY) \
|
#define VEC_TA_GTY(T,B,A,GTY) \
|
||||||
typedef struct GTY VEC(T,A) \
|
typedef struct GTY VEC(T,A) \
|
||||||
|
@ -904,6 +912,14 @@ DEF_VEC_ALLOC_FUNC_O(T,A) \
|
||||||
DEF_VEC_NONALLOC_FUNCS_O(T,A) \
|
DEF_VEC_NONALLOC_FUNCS_O(T,A) \
|
||||||
struct vec_swallow_trailing_semi
|
struct vec_swallow_trailing_semi
|
||||||
|
|
||||||
|
/* Vector of atomic object. */
|
||||||
|
#define DEF_VEC_A(T) \
|
||||||
|
VEC_T_GTY_ATOMIC(T,base); \
|
||||||
|
VEC_TA(T,base,none); \
|
||||||
|
DEF_VEC_FUNC_O(T) \
|
||||||
|
struct vec_swallow_trailing_semi
|
||||||
|
#define DEF_VEC_ALLOC_A(T,A) DEF_VEC_ALLOC_O(T,A)
|
||||||
|
|
||||||
#define DEF_VEC_FUNC_O(T) \
|
#define DEF_VEC_FUNC_O(T) \
|
||||||
static inline unsigned VEC_OP (T,base,length) (const VEC(T,base) *vec_) \
|
static inline unsigned VEC_OP (T,base,length) (const VEC(T,base) *vec_) \
|
||||||
{ \
|
{ \
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2012-07-30 Laurynas Biveinis <laurynas.biveinis@gmail.com>
|
||||||
|
|
||||||
|
* include/line-map.h (line_map_macro): Use the "atomic" GTY option
|
||||||
|
for the macro_locations field.
|
||||||
|
|
||||||
2011-06-19 Uros Bizjak <ubizjak@gmail.com>
|
2011-06-19 Uros Bizjak <ubizjak@gmail.com>
|
||||||
|
|
||||||
* lex.c (search_line_sse42): Use __builtin_ia32_loaddqu and
|
* lex.c (search_line_sse42): Use __builtin_ia32_loaddqu and
|
||||||
|
|
|
@ -165,7 +165,7 @@ struct GTY(()) line_map_macro {
|
||||||
In the example above x1 (for token "+") is going to be the same
|
In the example above x1 (for token "+") is going to be the same
|
||||||
as y1. x0 is the spelling location for the argument token "1",
|
as y1. x0 is the spelling location for the argument token "1",
|
||||||
and x2 is the spelling location for the argument token "2". */
|
and x2 is the spelling location for the argument token "2". */
|
||||||
source_location * GTY((length ("2 * %h.n_tokens"))) macro_locations;
|
source_location * GTY((atomic)) macro_locations;
|
||||||
|
|
||||||
/* This is the location of the expansion point of the current macro
|
/* This is the location of the expansion point of the current macro
|
||||||
map. It's the location of the macro name. That location is held
|
map. It's the location of the macro name. That location is held
|
||||||
|
|
Loading…
Reference in New Issue