* [PATCH, committed] jit-playback.c: Move dlopen code into a new function
@ 2014-01-01 0:00 David Malcolm
0 siblings, 0 replies; only message in thread
From: David Malcolm @ 2014-01-01 0:00 UTC (permalink / raw)
To: gcc-patches, jit
[-- Attachment #1: Type: text/plain, Size: 87 bytes --]
Another simplification of playback::context::compile.
Committed to trunk as r218527.
[-- Attachment #2: r218527.patch --]
[-- Type: text/x-patch, Size: 2701 bytes --]
Index: gcc/jit/ChangeLog
===================================================================
--- gcc/jit/ChangeLog (revision 218526)
+++ gcc/jit/ChangeLog (revision 218527)
@@ -1,3 +1,12 @@
+2014-12-09 David Malcolm <dmalcolm@redhat.com>
+
+ * jit-playback.c (gcc::jit::playback::context::compile): Move the
+ dlopen code into...
+ (gcc::jit::playback::context::dlopen_built_dso): ...this new
+ function.
+ * jit-playback.h (gcc::jit::playback::context::dlopen_built_dso):
+ New function.
+
2014-12-08 David Malcolm <dmalcolm@redhat.com>
* libgccjit++.h: Indent the forward declarations of the classes to
Index: gcc/jit/jit-playback.c
===================================================================
--- gcc/jit/jit-playback.c (revision 218526)
+++ gcc/jit/jit-playback.c (revision 218527)
@@ -1586,7 +1586,6 @@
playback::context::
compile ()
{
- void *handle = NULL;
const char *ctxt_progname;
result *result_obj = NULL;
@@ -1648,25 +1647,8 @@
if (errors_occurred ())
return NULL;
- /* dlopen the .so file. */
- {
- auto_timevar load_timevar (TV_LOAD);
+ result_obj = dlopen_built_dso ();
- const char *error;
-
- /* Clear any existing error. */
- dlerror ();
-
- handle = dlopen (m_path_so_file, RTLD_NOW | RTLD_LOCAL);
- if ((error = dlerror()) != NULL) {
- add_error (NULL, "%s", error);
- }
- if (handle)
- result_obj = new result (handle);
- else
- result_obj = NULL;
- }
-
return result_obj;
}
@@ -1916,6 +1898,34 @@
}
}
+/* Dynamically-link the built DSO file into this process, using dlopen.
+ Wrap it up within a jit::result *, and return that.
+ Return NULL if any errors occur, reporting them on this context. */
+
+result *
+playback::context::
+dlopen_built_dso ()
+{
+ auto_timevar load_timevar (TV_LOAD);
+ void *handle = NULL;
+ const char *error = NULL;
+ result *result_obj = NULL;
+
+ /* Clear any existing error. */
+ dlerror ();
+
+ handle = dlopen (m_path_so_file, RTLD_NOW | RTLD_LOCAL);
+ if ((error = dlerror()) != NULL) {
+ add_error (NULL, "%s", error);
+ }
+ if (handle)
+ result_obj = new result (handle);
+ else
+ result_obj = NULL;
+
+ return result_obj;
+}
+
/* Top-level hook for playing back a recording context.
This plays back m_recording_ctxt, and, if no errors
Index: gcc/jit/jit-playback.h
===================================================================
--- gcc/jit/jit-playback.h (revision 218526)
+++ gcc/jit/jit-playback.h (revision 218527)
@@ -250,6 +250,9 @@
void
convert_to_dso (const char *ctxt_progname);
+ result *
+ dlopen_built_dso ();
+
private:
::gcc::jit::recording::context *m_recording_ctxt;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-12-09 18:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-01 0:00 [PATCH, committed] jit-playback.c: Move dlopen code into a new function David Malcolm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).