Bug 1472268: Update in-tree VTune integration SDK. r=sstangl draft
authorBas Schouten <bschouten@mozilla.com>
Fri, 29 Jun 2018 19:28:30 +0200
changeset 812623 6f78b75d175ce1472ba1b9690c2789222d356f2a
parent 812525 99371dbf539290e70252f91cfa910930f3c66974
push id114606
push userbschouten@mozilla.com
push dateFri, 29 Jun 2018 17:31:56 +0000
reviewerssstangl
bugs1472268
milestone63.0a1
Bug 1472268: Update in-tree VTune integration SDK. r=sstangl MozReview-Commit-ID: EnCDdy0UW5s
js/src/vtune/disable_warnings.h
js/src/vtune/ittnotify.h
js/src/vtune/ittnotify_config.h
js/src/vtune/ittnotify_static.c
js/src/vtune/ittnotify_static.h
js/src/vtune/ittnotify_types.h
js/src/vtune/jitprofiling.c
js/src/vtune/jitprofiling.h
tools/profiler/core/vtune/ittnotify.h
--- a/js/src/vtune/disable_warnings.h
+++ b/js/src/vtune/disable_warnings.h
@@ -1,15 +1,15 @@
 /* <copyright>
   This file is provided under a dual BSD/GPLv2 license.  When using or
   redistributing this file, you may do so under either license.
 
   GPL LICENSE SUMMARY
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of version 2 of the GNU General Public License as
   published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -21,17 +21,17 @@
   The full GNU General Public License is included in this distribution
   in the file called LICENSE.GPL.
 
   Contact Information:
   http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
 
   BSD LICENSE
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
   All rights reserved.
 
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
 
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
--- a/js/src/vtune/ittnotify.h
+++ b/js/src/vtune/ittnotify.h
@@ -1,15 +1,15 @@
 /* <copyright>
   This file is provided under a dual BSD/GPLv2 license.  When using or
   redistributing this file, you may do so under either license.
 
   GPL LICENSE SUMMARY
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of version 2 of the GNU General Public License as
   published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -21,17 +21,17 @@
   The full GNU General Public License is included in this distribution
   in the file called LICENSE.GPL.
 
   Contact Information:
   http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
 
   BSD LICENSE
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
   All rights reserved.
 
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
 
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
@@ -1807,17 +1807,17 @@ ITT_STUB(ITTAPI, __itt_domain*, domain_c
 typedef struct ___itt_id
 {
     unsigned long long d1, d2, d3;
 } __itt_id;
 
 #pragma pack(pop)
 /** @endcond */
 
-const __itt_id __itt_null = { 0, 0, 0 };
+static const __itt_id __itt_null = { 0, 0, 0 };
 
 /**
  * @ingroup ids
  * @brief A convenience function is provided to create an ID without domain control.
  * @brief This is a convenience function to initialize an __itt_id structure. This function
  * does not affect the collector runtime in any way. After you make the ID with this
  * function, you still must create it with the __itt_id_create function before using the ID
  * to identify a named entity.
--- a/js/src/vtune/ittnotify_config.h
+++ b/js/src/vtune/ittnotify_config.h
@@ -1,15 +1,15 @@
 /* <copyright>
   This file is provided under a dual BSD/GPLv2 license.  When using or
   redistributing this file, you may do so under either license.
 
   GPL LICENSE SUMMARY
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of version 2 of the GNU General Public License as
   published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -21,17 +21,17 @@
   The full GNU General Public License is included in this distribution
   in the file called LICENSE.GPL.
 
   Contact Information:
   http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
 
   BSD LICENSE
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
   All rights reserved.
 
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
 
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
@@ -366,30 +366,30 @@ ITT_INLINE long __TBB_machine_fetchadd4(
 ITT_INLINE long
 __itt_interlocked_increment(volatile long* ptr) ITT_INLINE_ATTRIBUTE;
 ITT_INLINE long __itt_interlocked_increment(volatile long* ptr)
 {
     return __TBB_machine_fetchadd4(ptr, 1) + 1L;
 }
 #endif /* ITT_SIMPLE_INIT */
 
-void* dlopen(const char*, int);
-void* dlsym(void*, const char*);
-int dlclose(void*);
-#define DL_SYMBOLS (1)
+void* dlopen(const char*, int) __attribute__((weak));
+void* dlsym(void*, const char*) __attribute__((weak));
+int dlclose(void*) __attribute__((weak));
+#define DL_SYMBOLS (dlopen && dlsym && dlclose)
 
-int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*);
-int pthread_mutex_lock(pthread_mutex_t*);
-int pthread_mutex_unlock(pthread_mutex_t*);
-int pthread_mutex_destroy(pthread_mutex_t*);
-int pthread_mutexattr_init(pthread_mutexattr_t*);
-int pthread_mutexattr_settype(pthread_mutexattr_t*, int);
-int pthread_mutexattr_destroy(pthread_mutexattr_t*);
-pthread_t pthread_self(void);
-#define PTHREAD_SYMBOLS (1)
+int pthread_mutex_init(pthread_mutex_t*, const pthread_mutexattr_t*) __attribute__((weak));
+int pthread_mutex_lock(pthread_mutex_t*) __attribute__((weak));
+int pthread_mutex_unlock(pthread_mutex_t*) __attribute__((weak));
+int pthread_mutex_destroy(pthread_mutex_t*) __attribute__((weak));
+int pthread_mutexattr_init(pthread_mutexattr_t*) __attribute__((weak));
+int pthread_mutexattr_settype(pthread_mutexattr_t*, int) __attribute__((weak));
+int pthread_mutexattr_destroy(pthread_mutexattr_t*) __attribute__((weak));
+pthread_t pthread_self(void) __attribute__((weak));
+#define PTHREAD_SYMBOLS (pthread_mutex_init && pthread_mutex_lock && pthread_mutex_unlock && pthread_mutex_destroy && pthread_mutexattr_init && pthread_mutexattr_settype && pthread_mutexattr_destroy && pthread_self)
 
 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
 
 typedef enum {
     __itt_collection_normal = 0,
     __itt_collection_paused = 1
 } __itt_collection_state;
 
@@ -443,17 +443,17 @@ typedef struct __itt_counter_info
     void* nameW;
 #endif /* UNICODE || _UNICODE */
     const char* domainA;  /*!< Copy of original name in ASCII. */
 #if defined(UNICODE) || defined(_UNICODE)
     const wchar_t* domainW; /*!< Copy of original name in UNICODE. */
 #else  /* UNICODE || _UNICODE */
     void* domainW;
 #endif /* UNICODE || _UNICODE */
-    unsigned type;
+    int type;
     long index;
     int   extra1; /*!< Reserved to the runtime */
     void* extra2; /*!< Reserved to the runtime */
     struct __itt_counter_info* next;
 }  __itt_counter_info_t;
 
 struct ___itt_domain;
 struct ___itt_string_handle;
--- a/js/src/vtune/ittnotify_static.c
+++ b/js/src/vtune/ittnotify_static.c
@@ -1,15 +1,15 @@
 /* <copyright>
   This file is provided under a dual BSD/GPLv2 license.  When using or
   redistributing this file, you may do so under either license.
 
   GPL LICENSE SUMMARY
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of version 2 of the GNU General Public License as
   published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -21,17 +21,17 @@
   The full GNU General Public License is included in this distribution
   in the file called LICENSE.GPL.
 
   Contact Information:
   http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
 
   BSD LICENSE
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
   All rights reserved.
 
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
 
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
@@ -72,17 +72,17 @@
 
 #define INTEL_NO_MACRO_BODY 
 #define INTEL_ITTNOTIFY_API_PRIVATE
 #include "vtune/ittnotify.h"
 #include "vtune/legacy/ittnotify.h"
 
 #include "vtune/disable_warnings.h"
 
-static const char api_version[] = API_VERSION "\0\n@(#) $Revision: 481659 $\n";
+static const char api_version[] = API_VERSION "\0\n@(#) $Revision: 523557 $\n";
 
 #define _N_(n) ITT_JOIN(INTEL_ITTNOTIFY_PREFIX,n)
 
 #if ITT_OS==ITT_OS_WIN
 static const char* ittnotify_lib_name = "libittnotify.dll";
 #elif ITT_OS==ITT_OS_LINUX || ITT_OS==ITT_OS_FREEBSD
 static const char* ittnotify_lib_name = "libittnotify.so";
 #elif ITT_OS==ITT_OS_MAC
--- a/js/src/vtune/ittnotify_static.h
+++ b/js/src/vtune/ittnotify_static.h
@@ -1,15 +1,15 @@
 /* <copyright>
   This file is provided under a dual BSD/GPLv2 license.  When using or
   redistributing this file, you may do so under either license.
 
   GPL LICENSE SUMMARY
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of version 2 of the GNU General Public License as
   published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -21,17 +21,17 @@
   The full GNU General Public License is included in this distribution
   in the file called LICENSE.GPL.
 
   Contact Information:
   http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
 
   BSD LICENSE
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
   All rights reserved.
 
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
 
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
--- a/js/src/vtune/ittnotify_types.h
+++ b/js/src/vtune/ittnotify_types.h
@@ -1,15 +1,15 @@
 /* <copyright>
   This file is provided under a dual BSD/GPLv2 license.  When using or
   redistributing this file, you may do so under either license.
 
   GPL LICENSE SUMMARY
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of version 2 of the GNU General Public License as
   published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -21,17 +21,17 @@
   The full GNU General Public License is included in this distribution
   in the file called LICENSE.GPL.
 
   Contact Information:
   http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
 
   BSD LICENSE
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
   All rights reserved.
 
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
 
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
--- a/js/src/vtune/jitprofiling.c
+++ b/js/src/vtune/jitprofiling.c
@@ -1,15 +1,15 @@
 /* <copyright>
   This file is provided under a dual BSD/GPLv2 license.  When using or
   redistributing this file, you may do so under either license.
 
   GPL LICENSE SUMMARY
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of version 2 of the GNU General Public License as
   published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -21,17 +21,17 @@
   The full GNU General Public License is included in this distribution
   in the file called LICENSE.GPL.
 
   Contact Information:
   http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
 
   BSD LICENSE
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
   All rights reserved.
 
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
 
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
@@ -63,17 +63,17 @@
 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
 #if ITT_PLATFORM != ITT_PLATFORM_MAC && ITT_PLATFORM != ITT_PLATFORM_FREEBSD
 #include <malloc.h>
 #endif
 #include <stdlib.h>
 
 #include "vtune/jitprofiling.h"
 
-static const char rcsid[] = "\n@(#) $Revision: 471937 $\n";
+static const char rcsid[] = "\n@(#) $Revision: 523557 $\n";
 
 #define DLL_ENVIRONMENT_VAR             "VS_PROFILER"
 
 #ifndef NEW_DLL_ENVIRONMENT_VAR
 #if ITT_ARCH==ITT_ARCH_IA32
 #define NEW_DLL_ENVIRONMENT_VAR	        "INTEL_JIT_PROFILER32"
 #else
 #define NEW_DLL_ENVIRONMENT_VAR	        "INTEL_JIT_PROFILER64"
@@ -246,26 +246,32 @@ int loadiJIT_Funcs()
         dllName = getenv(DLL_ENVIRONMENT_VAR);
 #if defined(__ANDROID__) || defined(ANDROID)
     if (!dllName)
         dllName = ANDROID_JIT_AGENT_PATH;
 #endif
     if (dllName)
     {
         /* Try to load the dll from the PATH... */
-        m_libHandle = dlopen(dllName, RTLD_LAZY);
+        if (DL_SYMBOLS)
+        {
+            m_libHandle = dlopen(dllName, RTLD_LAZY);
+        }
     }
 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
 
     if (!m_libHandle)
     {
 #if ITT_PLATFORM==ITT_PLATFORM_WIN
         m_libHandle = LoadLibraryA(DEFAULT_DLLNAME);
 #else  /* ITT_PLATFORM==ITT_PLATFORM_WIN */
-        m_libHandle = dlopen(DEFAULT_DLLNAME, RTLD_LAZY);
+        if (DL_SYMBOLS)
+        {
+            m_libHandle = dlopen(DEFAULT_DLLNAME, RTLD_LAZY);
+        }
 #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */
     }
 
     /* if the dll wasn't loaded - exit. */
     if (!m_libHandle)
     {
         iJIT_DLL_is_missing = 1; /* don't try to initialize
                                   * JIT agent the second time
--- a/js/src/vtune/jitprofiling.h
+++ b/js/src/vtune/jitprofiling.h
@@ -1,15 +1,15 @@
 /* <copyright>
   This file is provided under a dual BSD/GPLv2 license.  When using or
   redistributing this file, you may do so under either license.
 
   GPL LICENSE SUMMARY
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of version 2 of the GNU General Public License as
   published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -21,17 +21,17 @@
   The full GNU General Public License is included in this distribution
   in the file called LICENSE.GPL.
 
   Contact Information:
   http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
 
   BSD LICENSE
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
   All rights reserved.
 
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
 
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
@@ -664,17 +664,17 @@ unsigned int JITAPI iJIT_GetNewMethodID(
 /**
  * @brief Returns the current mode of the agent.
  *
  * @return iJIT_SAMPLING_ON, indicating that agent is running, or
  * iJIT_NOTHING_RUNNING if no agent is running.
  */
 iJIT_IsProfilingActiveFlags JITAPI iJIT_IsProfilingActive(void);
 
-int loadiJIT_Funcs(void);
+int loadiJIT_Funcs();
 
 /**
  * @brief Reports infomation about JIT-compiled code to the agent.
  *
  * The reported information is used to attribute samples obtained from any
  * Intel(R) VTune(TM) Amplifier collector. This API needs to be called
  * after JIT compilation and before the first entry into the JIT-compiled
  * code.
--- a/tools/profiler/core/vtune/ittnotify.h
+++ b/tools/profiler/core/vtune/ittnotify.h
@@ -1,15 +1,15 @@
 /* <copyright>
   This file is provided under a dual BSD/GPLv2 license.  When using or
   redistributing this file, you may do so under either license.
 
   GPL LICENSE SUMMARY
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of version 2 of the GNU General Public License as
   published by the Free Software Foundation.
 
   This program is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
@@ -21,17 +21,17 @@
   The full GNU General Public License is included in this distribution
   in the file called LICENSE.GPL.
 
   Contact Information:
   http://software.intel.com/en-us/articles/intel-vtune-amplifier-xe/
 
   BSD LICENSE
 
-  Copyright (c) 2005-2014 Intel Corporation. All rights reserved.
+  Copyright (c) 2005-2017 Intel Corporation. All rights reserved.
   All rights reserved.
 
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
 
     * Redistributions of source code must retain the above copyright
       notice, this list of conditions and the following disclaimer.
@@ -1807,17 +1807,17 @@ ITT_STUB(ITTAPI, __itt_domain*, domain_c
 typedef struct ___itt_id
 {
     unsigned long long d1, d2, d3;
 } __itt_id;
 
 #pragma pack(pop)
 /** @endcond */
 
-const __itt_id __itt_null = { 0, 0, 0 };
+static const __itt_id __itt_null = { 0, 0, 0 };
 
 /**
  * @ingroup ids
  * @brief A convenience function is provided to create an ID without domain control.
  * @brief This is a convenience function to initialize an __itt_id structure. This function
  * does not affect the collector runtime in any way. After you make the ID with this
  * function, you still must create it with the __itt_id_create function before using the ID
  * to identify a named entity.