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
2a664a27
Commit
2a664a27
authored
Dec 10, 2014
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Don't track fields in compiler-generated hash and eq funcs.
Also, lower field tracking calls. From-SVN: r218554
parent
9131b509
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
0 deletions
+23
-0
gcc/go/gofrontend/expressions.cc
+5
-0
gcc/go/gofrontend/gogo.cc
+1
-0
gcc/go/gofrontend/gogo.h
+15
-0
gcc/go/gofrontend/types.cc
+2
-0
No files found.
gcc/go/gofrontend/expressions.cc
View file @
2a664a27
...
...
@@ -10729,6 +10729,10 @@ Field_reference_expression::do_lower(Gogo* gogo, Named_object* function,
if
(
field
->
tag
().
find
(
"go:
\"
track
\"
"
)
==
std
::
string
::
npos
)
return
this
;
// References from functions generated by the compiler don't count.
if
(
function
->
func_value
()
->
is_type_specific_function
())
return
this
;
// We have found a reference to a tracked field. Build a call to
// the runtime function __go_fieldtrack with a string that describes
// the field. FIXME: We should only call this once per referenced
...
...
@@ -10785,6 +10789,7 @@ Field_reference_expression::do_lower(Gogo* gogo, Named_object* function,
e
=
Expression
::
make_unary
(
OPERATOR_AND
,
e
,
loc
);
Expression
*
call
=
Runtime
::
make_call
(
Runtime
::
FIELDTRACK
,
loc
,
1
,
e
);
gogo
->
lower_expression
(
function
,
inserter
,
&
call
);
inserter
->
insert
(
Statement
::
make_statement
(
call
,
false
));
// Put this function, and the global variable we just created, into
...
...
gcc/go/gofrontend/gogo.cc
View file @
2a664a27
...
...
@@ -4433,6 +4433,7 @@ Function::Function(Function_type* type, Function* enclosing, Block* block,
is_sink_
(
false
),
results_are_named_
(
false
),
nointerface_
(
false
),
is_unnamed_type_stub_method_
(
false
),
calls_recover_
(
false
),
is_recover_thunk_
(
false
),
has_recover_thunk_
(
false
),
calls_defer_retaddr_
(
false
),
is_type_specific_function_
(
false
),
in_unique_section_
(
false
)
{
}
...
...
gcc/go/gofrontend/gogo.h
View file @
2a664a27
...
...
@@ -1071,6 +1071,18 @@ class Function
set_calls_defer_retaddr
()
{
this
->
calls_defer_retaddr_
=
true
;
}
// Whether this is a type hash or equality function created by the
// compiler.
bool
is_type_specific_function
()
{
return
this
->
is_type_specific_function_
;
}
// Record that this function is a type hash or equality function
// created by the compiler.
void
set_is_type_specific_function
()
{
this
->
is_type_specific_function_
=
true
;
}
// Mark the function as going into a unique section.
void
set_in_unique_section
()
...
...
@@ -1199,6 +1211,9 @@ class Function
// True if this is a thunk built for a defer statement that calls
// the __go_set_defer_retaddr runtime function.
bool
calls_defer_retaddr_
:
1
;
// True if this is a function built by the compiler to as a hash or
// equality function for some type.
bool
is_type_specific_function_
:
1
;
// True if this function should be put in a unique section. This is
// turned on for field tracking.
bool
in_unique_section_
:
1
;
...
...
gcc/go/gofrontend/types.cc
View file @
2a664a27
...
...
@@ -1805,6 +1805,7 @@ Type::write_specific_type_functions(Gogo* gogo, Named_type* name,
Named_object
*
hash_fn
=
gogo
->
start_function
(
hash_name
,
hash_fntype
,
false
,
bloc
);
hash_fn
->
func_value
()
->
set_is_type_specific_function
();
gogo
->
start_block
(
bloc
);
if
(
name
!=
NULL
&&
name
->
real_type
()
->
named_type
()
!=
NULL
)
...
...
@@ -1825,6 +1826,7 @@ Type::write_specific_type_functions(Gogo* gogo, Named_type* name,
Named_object
*
equal_fn
=
gogo
->
start_function
(
equal_name
,
equal_fntype
,
false
,
bloc
);
equal_fn
->
func_value
()
->
set_is_type_specific_function
();
gogo
->
start_block
(
bloc
);
if
(
name
!=
NULL
&&
name
->
real_type
()
->
named_type
()
!=
NULL
)
...
...
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