There are several places in hotspot where an internal function should have been declared static, but isn't.
These were discovered by trying to use the gcc option -Wmissing-declarations and the corresponding clang option -Wmissing-prototypes. These warnings check that a function either:
a) is declared static, or
b) has a declaration before its definition.
The rationale of this is that functions are either internal to a compilation unit, or exported to be linked by some other compilation unit. In the former case, it should be marked static. In the latter case, it should be declared in a header file, which should be included by the implementation as well. If there is a discrepancy between the exported prototype and the implemented prototype, this will be discovered during compilation (instead of as a runtime error). Additionally, marking internal methods as static allows the compiler to make better optimization, like inlining.
This seem to be to be a sane assumption, and I think Hotspot (and the entire JDK) would increase code quality by turning on these warnings. The absolute majority of the code already adheres to these rules, but there are still some places that needs to be fixed.
This is the first part of addressing these issues, where all places that are trivially missing static are fixed.
These were discovered by trying to use the gcc option -Wmissing-declarations and the corresponding clang option -Wmissing-prototypes. These warnings check that a function either:
a) is declared static, or
b) has a declaration before its definition.
The rationale of this is that functions are either internal to a compilation unit, or exported to be linked by some other compilation unit. In the former case, it should be marked static. In the latter case, it should be declared in a header file, which should be included by the implementation as well. If there is a discrepancy between the exported prototype and the implemented prototype, this will be discovered during compilation (instead of as a runtime error). Additionally, marking internal methods as static allows the compiler to make better optimization, like inlining.
This seem to be to be a sane assumption, and I think Hotspot (and the entire JDK) would increase code quality by turning on these warnings. The absolute majority of the code already adheres to these rules, but there are still some places that needs to be fixed.
This is the first part of addressing these issues, where all places that are trivially missing static are fixed.