CompilerOracle::append_comment_to_file and CompilerOracle::append_exclude_to_file - missing fclose calls ?

Thomas Stüfe thomas.stuefe at gmail.com
Tue Mar 26 19:39:30 UTC 2019


Hi Matthias,

On Tue, Mar 26, 2019 at 4:17 PM Baesken, Matthias <matthias.baesken at sap.com>
wrote:

>
> Hello, it seems that the  fopen calls in
> CompilerOracle::append_comment_to_file and
> CompilerOracle::append_exclude_to_file  do not have a corresponding fclose.
> Or do I miss something ?
>
>
No, you are right, this is a bug. However, I think those functions are
nowhere used, so maybe they could be removed completely.

Cheers, Thomas

We could also add a "true"  for the second argument of the fileStream
> constructor calls  ( fileStream(FILE* file, bool need_close = false)  )
> to get the closing.
>

>
> coding :
> ------------
>
> jdk/src/hotspot/share/compiler/compilerOracle.cpp
>
>
> 741void CompilerOracle::append_comment_to_file(const char* message) {
> 742  assert(has_command_file(), "command file must be specified");
> 743  fileStream stream(fopen(cc_file(), "at"));
> 744  stream.print("# ");
> 745  for (int index = 0; message[index] != '\0'; index++) {
> 746    stream.put(message[index]);
> 747    if (message[index] == '\n') stream.print("# ");
> 748  }
> 749  stream.cr();
> 750}
> 751
> 752void CompilerOracle::append_exclude_to_file(const methodHandle& method)
> {
> 753  assert(has_command_file(), "command file must be specified");
> 754  fileStream stream(fopen(cc_file(), "at"));
> 755  stream.print("exclude ");
> 756  method->method_holder()->name()->print_symbol_on(&stream);
> 757  stream.print(".");
> 758  method->name()->print_symbol_on(&stream);
> 759  method->signature()->print_symbol_on(&stream);
> 760  stream.cr();
> 761  stream.cr();
> 762}
>
> Best regards, Matthias
>


More information about the hotspot-dev mailing list