#include "context.h"
#include "jit-common.h"
+#include "jit-logging.h"
#include "jit-playback.h"
#include "jit-result.h"
#include "jit-builtins.h"
/* The constructor for gcc::jit::playback::context. */
playback::context::context (recording::context *ctxt)
- : m_recording_ctxt (ctxt),
+ : log_user (ctxt->get_logger ()),
+ m_recording_ctxt (ctxt),
m_tempdir (NULL),
m_char_array_type_node (NULL),
m_const_char_ptr (NULL)
{
+ JIT_LOG_SCOPE (get_logger ());
m_functions.create (0);
m_source_files.create (0);
m_cached_locations.create (0);
playback::context::~context ()
{
+ JIT_LOG_SCOPE (get_logger ());
if (m_tempdir)
delete m_tempdir;
m_functions.release ();
int i;
block *b;
+ JIT_LOG_SCOPE (m_ctxt->get_logger ());
+
FOR_EACH_VEC_ELT (m_blocks, i, b)
{
int j;
playback::function::
postprocess ()
{
+ JIT_LOG_SCOPE (m_ctxt->get_logger ());
+
if (m_ctxt->get_bool_option (GCC_JIT_BOOL_OPTION_DUMP_INITIAL_TREE))
debug_tree (m_stmt_list);
playback::context::
compile ()
{
+ JIT_LOG_SCOPE (get_logger ());
+
const char *ctxt_progname;
result *result_obj = NULL;
/* This runs the compiler. */
toplev toplev (false);
+ enter_scope ("toplev::main");
+ if (get_logger ())
+ for (unsigned i = 0; i < fake_args.length (); i++)
+ get_logger ()->log ("argv[%i]: %s", i, fake_args[i]);
toplev.main (fake_args.length (),
const_cast <char **> (fake_args.address ()));
+ exit_scope ("toplev::main");
/* Extracting dumps makes use of the gcc::dump_manager, hence we
need to do it between toplev::main (which creates the dump manager)
extract_any_requested_dumps (&requested_dumps);
/* Clean up the compiler. */
+ enter_scope ("toplev::finalize");
toplev.finalize ();
+ exit_scope ("toplev::finalize");
/* Ideally we would release the jit mutex here, but we can't yet since
followup activities use timevars, which are global state. */
playback::context::acquire_mutex ()
{
/* Acquire the big GCC mutex. */
+ JIT_LOG_SCOPE (get_logger ());
pthread_mutex_lock (&jit_mutex);
gcc_assert (NULL == active_playback_ctxt);
active_playback_ctxt = this;
playback::context::release_mutex ()
{
/* Release the big GCC mutex. */
+ JIT_LOG_SCOPE (get_logger ());
gcc_assert (active_playback_ctxt == this);
active_playback_ctxt = NULL;
pthread_mutex_unlock (&jit_mutex);
const char *ctxt_progname,
vec <recording::requested_dump> *requested_dumps)
{
+ JIT_LOG_SCOPE (get_logger ());
+
#define ADD_ARG(arg) argvec->safe_push (xstrdup (arg))
#define ADD_ARG_TAKE_OWNERSHIP(arg) argvec->safe_push (arg)
playback::context::
extract_any_requested_dumps (vec <recording::requested_dump> *requested_dumps)
{
+ JIT_LOG_SCOPE (get_logger ());
+
int i;
recording::requested_dump *d;
FOR_EACH_VEC_ELT (*requested_dumps, i, d)
playback::context::
convert_to_dso (const char *ctxt_progname)
{
+ JIT_LOG_SCOPE (get_logger ());
/* Currently this lumps together both assembling and linking into
TV_ASSEMBLE. */
auto_timevar assemble_timevar (TV_ASSEMBLE);
/* pex_one's error-handling requires pname to be non-NULL. */
gcc_assert (ctxt_progname);
+ if (get_logger ())
+ for (unsigned i = 0; i < argvec.length (); i++)
+ get_logger ()->log ("argv[%i]: %s", i, argvec[i]);
+
errmsg = pex_one (PEX_SEARCH, /* int flags, */
gcc_driver_name,
const_cast <char *const *> (argvec.address ()),
playback::context::
dlopen_built_dso ()
{
+ JIT_LOG_SCOPE (get_logger ());
auto_timevar load_timevar (TV_LOAD);
void *handle = NULL;
const char *error = NULL;
add_error (NULL, "%s", error);
}
if (handle)
- result_obj = new result (handle);
+ result_obj = new result (get_logger (), handle);
else
result_obj = NULL;
playback::context::
replay ()
{
+ JIT_LOG_SCOPE (get_logger ());
/* Adapted from c-common.c:c_common_nodes_and_builtins. */
tree array_domain_type = build_index_type (size_int (200));
m_char_array_type_node
playback::context::
dump_generated_code ()
{
+ JIT_LOG_SCOPE (get_logger ());
char buf[4096];
size_t sz;
FILE *f_in = fopen (get_path_s_file (), "r");
imposed by the linemap API.
line_table is a global. */
+ JIT_LOG_SCOPE (get_logger ());
int i;
source_file *file;