Changeset: 2ad47c94e619 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=2ad47c94e619
Modified Files:
monetdb5/mal/mal_linker.c
Branch: Dec2016
Log Message:
Don't look up symbols in the same .so/.dll multiple times.
Note the fragility of the code: this only works because getAddress is
called once before the first call to loadLibrary (from initScenario
because the function pointer for MALoptimizer isn't filled in).
diffs (24 lines):
diff --git a/monetdb5/mal/mal_linker.c b/monetdb5/mal/mal_linker.c
--- a/monetdb5/mal/mal_linker.c
+++ b/monetdb5/mal/mal_linker.c
@@ -65,8 +65,7 @@ getAddress(stream *out, str modname, str
{
void *dl;
MALfcn adr;
- static int idx=0;
-
+ int idx=0;
static int prev= -1;
/* First try the last module loaded */
@@ -82,7 +81,9 @@ getAddress(stream *out, str modname, str
* obtained from the source-file MAL script.
*/
for (idx =0; idx < lastfile; idx++)
- if (filesLoaded[idx].handle) {
+ if (idx != prev && /* skip already searched module
*/
+ filesLoaded[idx].handle &&
+ (idx == 0 || filesLoaded[idx].handle !=
filesLoaded[0].handle)) {
adr = (MALfcn) dlsym(filesLoaded[idx].handle, fcnname);
if (adr != NULL) {
prev = idx;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list