aboutsummaryrefslogtreecommitdiff
path: root/gcc/jit/jit-tempdir.c
AgeCommit message (Collapse)AuthorFilesLines
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-01-19PR jit/69144: Ensure that libgccjit's tempdir is fully cleaned-upDavid Malcolm1-1/+17
There were a couple of ways that libgccjit could fail to unlink all of its tempfiles, leading to /tmp/libgccjit-* tempdirs lingering after the build: - dumpfiles requested by gcc_jit_context_enable_dump - ahead-of-time compilation artifacts which lingered in the tempdir after they've been copied up to the output_path. This was only the case for GCC_JIT_OUTPUT_KIND_OBJECT_FILE and GCC_JIT_OUTPUT_KIND_EXECUTABLE. The following patch fixes these by introducing a vec of additional cleanups to be performed by gcc:jit::tempdir's dtor. In addition, if a gcc_jit_result * is leaked and GCC_JIT_BOOL_OPTION_DEBUGINFO is enabled, the tempdir will also not be cleaned up. This was the case for tut04-toyvm/toyvm.cc which the patch fixes by introducing a wrapper around gcc_jit_result *. Doing this required some updates to the corresponding docs. gcc/jit/ChangeLog: PR jit/69144 * jit-playback.c (gcc::jit::playback::compile_to_file::postprocess): Potentially add the temporary artifact to the tempdir's list of tempfiles needing additional cleanup. (gcc::jit::playback::context::extract_any_requested_dumps): Likewise for the dumpfile. * jit-tempdir.c (gcc::jit::tempdir::~tempdir): Clean up additional tempfiles. * jit-tempdir.h (gcc::jit::tempdir::add_temp_file): New method. (gcc::jit::tempdir::m_tempfiles): New field. * docs/cp/intro/tutorial04.rst: Update for changes to toyvm.cc. * docs/examples/tut04-toyvm/toyvm.cc (class compilation_result): New. (toyvm_function::compile): Change return type from function ptr to a compilation_result. (toyvm_function::get_function_name): New accessor. (toyvm_function::m_funcname): New field. (get_function_name): Convert to... (toyvm_function::make_function_name): ...this new method. (toyvm_function::parse): Call make_function_name. (toyvm_function::compile): Convert return type from function ptr to a compilation_result. Use get_function_name. (compilation_state::compile): Convert return type from gcc_jit_result * to a compilation_result. (test_script): Update for above changes, extracting the code from the compilation_result. (main): Likewise. * docs/_build/texinfo/libgccjit.texi: Regenerate. From-SVN: r232582
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-01-09PR jit/64206: delay cleanup of tempdir if the user has requested debuginfoDavid Malcolm1-5/+24
gcc/jit/ChangeLog: PR jit/64206 * docs/internals/test-hello-world.exe.log.txt: Update, the log now shows tempdir creation/cleanup. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-logging.h (class gcc::jit::log_user): Add gcc::jit::tempdir to the list of subclasses in the comment. * jit-playback.c (gcc::jit::playback::context::context): Add a comment clarifying when the tempdir gets cleaned up. (gcc::jit::playback::context::compile): Pass the context's logger, if any, to the tempdir. (gcc::jit::playback::context::dlopen_built_dso): When creating the gcc::jit::result, if GCC_JIT_BOOL_OPTION_DEBUGINFO is set, hand over ownership of the tempdir to it. * jit-result.c: Include "jit-tempdir.h". (gcc::jit::result::result): Add tempdir param, saving it as m_tempdir. (gcc::jit::result::~result): Delete m_tempdir. * jit-result.h (gcc::jit::result::result): Add tempdir param. (gcc::jit::result::m_tempdir): New field. * jit-tempdir.c (gcc::jit::tempdir::tempdir): Add logger param; add JIT_LOG_SCOPE. (gcc::jit::tempdir::create): Add JIT_LOG_SCOPE to log entry/exit, and log m_path_template and m_path_tempdir. (gcc::jit::tempdir::~tempdir): Add JIT_LOG_SCOPE to log entry/exit, and log the unlink and rmdir calls. * jit-tempdir.h: Include "jit-logging.h". (class gcc::jit::tempdir): Make this be a subclass of log_user. (gcc::jit::tempdir::tempdir): Add logger param. * notes.txt: Update to show the two possible places where the tempdir can be cleaned up. From-SVN: r219395
2015-01-05Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r219189
2014-12-09Add jit-tempdir.{c|h}David Malcolm1-0/+129
gcc/jit/ChangeLog: PR jit/64206 * Make-lang.in (jit_OBJS): Add jit/jit-tempdir.o. * jit-common.h (gcc::jit::tempdir): New forward decl. * jit-playback.c: Include jit-tempdir.h. (gcc::jit::playback::context::context): Initialize m_tempdir. (gcc::jit::playback::context::~context): Move tempdir cleanup to new file jit-tempdir.c (make_tempdir_path_template): Move to new file jit-tempdir.c. (gcc::jit::playback::context::compile): Move tempdir creation to new tempdir object in new file jit-tempdir.c. (gcc::jit::playback::context::make_fake_args): Get path from tempdir object rather than from member data. (gcc::jit::playback::context::convert_to_dso): Likewise. (gcc::jit::playback::context::dlopen_built_dso): Likewise. (gcc::jit::playback::context::dump_generated_code): Likewise. (gcc::jit::playback::context::get_path_c_file): New function. (gcc::jit::playback::context::get_path_s_file): New function. (gcc::jit::playback::context::get_path_so_file): New function. * jit-playback.h (gcc::jit::playback::context::get_path_c_file): New function. (gcc::jit::playback::context::get_path_s_file): New function. (gcc::jit::playback::context::get_path_so_file): New function. (gcc::jit::playback::context): Move fields "m_path_template", "m_path_tempdir", "m_path_c_file", "m_path_s_file", "m_path_so_file" to new jit::tempdir class; add field "m_tempdir". * jit-tempdir.c: New file. * jit-tempdir.h: New file. From-SVN: r218533