Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 96986 Details for
Bug 148629
Support Java 6 Class File Format Changes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Java 6 StackMapTable support for Martini and Profilers
148629-martini-profilers.patch (text/plain), 60.26 KB, created by
Asaf Yaffe
on 2008-04-22 04:44:11 EDT
(
hide
)
Description:
Java 6 StackMapTable support for Martini and Profilers
Filename:
MIME Type:
Creator:
Asaf Yaffe
Created:
2008-04-22 04:44:11 EDT
Size:
60.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.platform.jvmti.runtime >Index: src-native/src/Martini/Infrastructure/JIE/JIEImpl.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/JIE/JIEImpl.h,v >retrieving revision 1.2 >diff -u -r1.2 JIEImpl.h >--- src-native/src/Martini/Infrastructure/JIE/JIEImpl.h 20 Feb 2007 12:00:32 -0000 1.2 >+++ src-native/src/Martini/Infrastructure/JIE/JIEImpl.h 22 Apr 2008 08:35:36 -0000 >@@ -27,6 +27,10 @@ > // IJIE methods > virtual IJavaClass *GetClassInterface(const unsigned char *pucClassFile, > unsigned int uiClassSize) const; >+ virtual void EnableStackMapCalculation() const; >+ >+ private: >+ TResult BindJpiFunctions() const; > > }; // class CJIE > >Index: src-native/src/Martini/Infrastructure/JIE/JIE.dsp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/JIE/JIE.dsp,v >retrieving revision 1.2 >diff -u -r1.2 JIE.dsp >--- src-native/src/Martini/Infrastructure/JIE/JIE.dsp 14 Feb 2007 11:48:50 -0000 1.2 >+++ src-native/src/Martini/Infrastructure/JIE/JIE.dsp 22 Apr 2008 08:35:36 -0000 >@@ -49,7 +49,7 @@ > # PROP Target_Dir "" > F90=df.exe > # ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FD /c >-# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "NDEBUG" /D "IA32_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /FD /c >+# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "NDEBUG" /D "IA32_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /D "VERIFIER_STANDALONE" /FD /c > # SUBTRACT CPP /Fr > # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 > # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 >@@ -79,7 +79,7 @@ > # PROP Target_Dir "" > F90=df.exe > # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FR /FD /GZ /c >-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "_DEBUG" /D "IA32_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /FR /FD /GZ /c >+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /I "$(HARMONY_VERIFIER)\include" /I "$(HARMONY_VERIFIER)\verifier-3363\x_verifier" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "_DEBUG" /D "IA32_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /D "VERIFIER_STANDALONE" /FR /FD /GZ /c > # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 > # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 > # ADD BASE RSC /l 0x409 /d "_DEBUG" >@@ -89,7 +89,7 @@ > # ADD BSC32 /nologo > LINK32=link.exe > # ADD BASE LINK32 kernel32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept >-# ADD LINK32 kernel32.lib MartiniOSA.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\bin\windows\debug\IA-32" >+# ADD LINK32 kernel32.lib MartiniOSA.lib verifier.lib /nologo /dll /map /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\bin\windows\debug\IA-32" /libpath:"$(HARMONY_VERIFIER)\verifier\verifier_6\verifier\Debug" > # SUBTRACT LINK32 /incremental:no > > !ELSEIF "$(CFG)" == "JIE - Win32 EM64T Debug" >@@ -108,7 +108,7 @@ > # PROP Target_Dir "" > F90=df.exe > # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /I "..\Include\win" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FR /FD /GZ /c >-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "_DEBUG" /D "EM64T_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /FD /GZ /c >+# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "_DEBUG" /D "EM64T_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /D "VERIFIER_STANDALONE" /FD /GZ /c > # SUBTRACT CPP /Fr > # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 > # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 >@@ -138,7 +138,7 @@ > # PROP Target_Dir "" > F90=df.exe > # ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /I "..\Include\win" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FD /c >-# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "NDEBUG" /D "EM64T_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /FD /c >+# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "NDEBUG" /D "EM64T_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /D "VERIFIER_STANDALONE" /FD /c > # SUBTRACT CPP /Fr > # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 > # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 >@@ -168,7 +168,7 @@ > # PROP Target_Dir "" > F90=df.exe > # ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /I "..\Include\win" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FD /c >-# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "NDEBUG" /D "IPF_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /FD /c >+# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "NDEBUG" /D "IPF_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /D "VERIFIER_STANDALONE" /FD /c > # SUBTRACT CPP /Fr > # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 > # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 >@@ -198,7 +198,7 @@ > # PROP Target_Dir "" > F90=df.exe > # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /I "..\Include\win" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FR /FD /GZ /c >-# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "_DEBUG" /D "IPF_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /FD /GZ /c >+# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "_DEBUG" /D "IPF_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /D "VERIFIER_STANDALONE" /FD /GZ /c > # SUBTRACT CPP /Fr > # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 > # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 >@@ -235,6 +235,10 @@ > # End Source File > # Begin Source File > >+SOURCE="..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ\class_interface.cpp" >+# End Source File >+# Begin Source File >+ > SOURCE="..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common\Command.cpp" > # End Source File > # Begin Source File >Index: src-native/src/Martini/Infrastructure/JIE/JavaClass.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/JIE/JavaClass.cpp,v >retrieving revision 1.3 >diff -u -r1.3 JavaClass.cpp >--- src-native/src/Martini/Infrastructure/JIE/JavaClass.cpp 20 Feb 2007 12:00:32 -0000 1.3 >+++ src-native/src/Martini/Infrastructure/JIE/JavaClass.cpp 22 Apr 2008 08:35:41 -0000 >@@ -29,6 +29,7 @@ > #include "JStream.h" > #include "JMemStream.h" > #include "JVMInsSet.h" >+#include "class_inerface_int.h" > #include "MIEInstructionFactory.h" > #include "BciUtils.h" > >@@ -40,6 +41,15 @@ > ////////////////////////////////////////////////////////////////////////// > // class CJavaClass implementation > >+static void* g_pJniEnv = NULL; >+ >+static void * >+get_vm_pointer(void **pJniEnv) >+{ >+ *pJniEnv = g_pJniEnv; >+ return g_pJniEnv; >+} >+ > // constructs a CJavaClass object > CJavaClass::CJavaClass(const unsigned char *pubClassFile, unsigned int uiClassSize) > : m_pStaticInitializer(NULL), m_bModuleParsed(false), m_bMethodListCreated(false), >@@ -50,6 +60,23 @@ > //_CrtSetBreakAlloc(2189); > #endif > >+ if (CJieGlobals::Instance()->isStackMapCalcEnabled) >+ { >+ TResult res = CJieGlobals::Instance()->pfnJPI_AttachCurrentThread( >+ &m_pJniEnv, &m_isThreadAttached); >+ if (MRTE_SUCCEEDED(res)) >+ { >+ g_pJniEnv = m_pJniEnv; >+ initialize_dynamic(get_vm_pointer); >+ } >+ else >+ { >+ CJieGlobals::Instance()->isStackMapCalcEnabled = false; >+ m_isThreadAttached = false; >+ m_pJniEnv = NULL; >+ } >+ } >+ > CJMemStream memStream; // Memory stream > CJStream jsIn(&memStream); // Java input stream > // read class file >@@ -62,6 +89,7 @@ > // is deleted. > m_pModule->Open(m_pClassBuilder, true); > m_pModule->SetAccessFlags(m_pClassBuilder->GetAccessFlags()); >+ m_pModule->UseStackMapCalculation(CJieGlobals::Instance()->isStackMapCalcEnabled); > } > > // destructor >@@ -100,6 +128,12 @@ > // deallocate the instruction factory > CMIEInstructionFactory::Free(); > >+ // detach the current thread from the JVM (if needed) >+ if (CJieGlobals::Instance()->isStackMapCalcEnabled && m_isThreadAttached) >+ { >+ CJieGlobals::Instance()->pfnJPI_DetachCurrentThread(); >+ } >+ > // deallocate the JavaClass object > delete this; > } >Index: src-native/src/Martini/Infrastructure/JIE/JIEUtils.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/JIE/JIEUtils.h,v >retrieving revision 1.2 >diff -u -r1.2 JIEUtils.h >--- src-native/src/Martini/Infrastructure/JIE/JIEUtils.h 20 Feb 2007 12:00:32 -0000 1.2 >+++ src-native/src/Martini/Infrastructure/JIE/JIEUtils.h 22 Apr 2008 08:35:38 -0000 >@@ -20,6 +20,8 @@ > #include "MString.h" > #include "JavaHelpers.h" > >+#include "jni.h" >+ > /////////////////////////////////////////////////////////////////////////////// > // Global constants > >@@ -35,4 +37,38 @@ > U16 WCharToUtf8(U8 *pDest, unsigned int uiDesBufferSize, const WCHAR *pSource); > U16 CharToUtf8(U8 *pDest, unsigned int uiDesBufferSize, const char *pSource); > >+typedef TResult (*TJpiAttachCurrentThread) (JNIEnv **ppJNIEnv, bool *bAttached); >+typedef void (*TJpiDetachCurrentThread) (); >+ >+namespace Martini { namespace JIE { >+ >+ class CJieGlobals >+ { >+ public: >+ >+ static CJieGlobals* Instance() >+ { >+ if (0 == s_pInstance) >+ { >+ s_pInstance = new CJieGlobals(); >+ } >+ return s_pInstance; >+ } >+ >+ TJpiAttachCurrentThread pfnJPI_AttachCurrentThread; >+ TJpiDetachCurrentThread pfnJPI_DetachCurrentThread; >+ >+ bool isStackMapCalcEnabled; >+ >+ protected: >+ static CJieGlobals* s_pInstance; >+ >+ CJieGlobals(): >+ pfnJPI_AttachCurrentThread(0), pfnJPI_DetachCurrentThread(0), >+ isStackMapCalcEnabled(false) >+ {} >+ >+ }; >+}} // namespace Martini::JIE >+ > #endif // MRTE_JIEUTILS >Index: src-native/src/Martini/Infrastructure/JIE/JIEUtils.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/JIE/JIEUtils.cpp,v >retrieving revision 1.3 >diff -u -r1.3 JIEUtils.cpp >--- src-native/src/Martini/Infrastructure/JIE/JIEUtils.cpp 20 Feb 2007 12:00:32 -0000 1.3 >+++ src-native/src/Martini/Infrastructure/JIE/JIEUtils.cpp 22 Apr 2008 08:35:38 -0000 >@@ -221,4 +221,7 @@ > return ret; > } > >+////////////////////////////////////////////////////////////////////////// >+// CJieGlobals implementation > >+Martini::JIE::CJieGlobals* Martini::JIE::CJieGlobals::s_pInstance = NULL; >Index: src-native/src/Martini/Infrastructure/JIE/JavaClass.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/JIE/JavaClass.h,v >retrieving revision 1.3 >diff -u -r1.3 JavaClass.h >--- src-native/src/Martini/Infrastructure/JIE/JavaClass.h 20 Feb 2007 12:00:32 -0000 1.3 >+++ src-native/src/Martini/Infrastructure/JIE/JavaClass.h 22 Apr 2008 08:35:41 -0000 >@@ -20,6 +20,8 @@ > #include "JavaFields.h" > #include "ModuleJ.h" > >+#include "jni.h" >+ > namespace Martini { namespace JIE { > > class CJavaClass : public IJavaClass >@@ -108,6 +110,13 @@ > // create a new field > IJavaField* InternalAddField(u2 uiFlags, const char *szName, CJavaType fieldType); > >+ // JNI environment pointer for Java 6 StackMap calculation >+ JNIEnv* m_pJniEnv; >+ >+ // Whether the current thread was actively attached to the JVM during instantiation of >+ // this class >+ bool m_isThreadAttached; >+ > }; // class CJavaClass > > }} // namespace JIE >Index: src-native/src/Martini/Infrastructure/JIE/JIE.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/JIE/JIE.cpp,v >retrieving revision 1.3 >diff -u -r1.3 JIE.cpp >--- src-native/src/Martini/Infrastructure/JIE/JIE.cpp 16 Apr 2007 09:02:52 -0000 1.3 >+++ src-native/src/Martini/Infrastructure/JIE/JIE.cpp 22 Apr 2008 08:35:36 -0000 >@@ -13,12 +13,17 @@ > #pragma warning (disable:4786) > > #include "JIEImpl.h" >+#include "JIEUtils.h" > #include "JavaClass.h" > >+#include "LibraryLoader.h" >+#include "OSA.h" >+ > // first ids are reserved for threads in the prf resolution > #define JIE_FIRST_METHOD_ID 0x10000 > > using namespace Martini::JIE; >+using namespace Martini::OSA; > > extern "C" JIE_API IJIE *GetJIEInstance() > { >@@ -26,6 +31,7 @@ > return (IJIE*)&s_jie; > } > >+ > ////////////////////////////////////////////////////////////////////////// > // class CJIE implementation > >@@ -51,3 +57,39 @@ > } > return pClass; > } >+ >+void CJIE::EnableStackMapCalculation() const >+{ >+ TResult res = BindJpiFunctions(); >+ if (MRTE_SUCCEEDED(res)) >+ { >+ CJieGlobals::Instance()->isStackMapCalcEnabled = true; >+ } >+} >+ >+TResult CJIE::BindJpiFunctions() const >+{ >+ ILibraryLoader *pJpiLoader = LoadBistroLibrary("JPI"); >+ if (!pJpiLoader) >+ { >+ return MRTE_ERROR_FAIL; >+ } >+ >+ CJieGlobals::Instance()->pfnJPI_AttachCurrentThread = >+ (TJpiAttachCurrentThread)pJpiLoader->GetEntry("JPI_AttachCurrentThread"); >+ if (!CJieGlobals::Instance()->pfnJPI_AttachCurrentThread) >+ { >+ return MRTE_ERROR_FAIL; >+ } >+ >+ CJieGlobals::Instance()->pfnJPI_DetachCurrentThread = >+ (TJpiDetachCurrentThread)pJpiLoader->GetEntry("JPI_DetachCurrentThread"); >+ if (!CJieGlobals::Instance()->pfnJPI_DetachCurrentThread) >+ { >+ return MRTE_ERROR_FAIL; >+ } >+ >+ pJpiLoader->Destroy(); >+ >+ return MRTE_RESULT_OK; >+} >Index: src-native/src/Martini/Infrastructure/Include/ThreadAdaptor.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/Include/ThreadAdaptor.h,v >retrieving revision 1.2 >diff -u -r1.2 ThreadAdaptor.h >--- src-native/src/Martini/Infrastructure/Include/ThreadAdaptor.h 7 Mar 2008 09:57:36 -0000 1.2 >+++ src-native/src/Martini/Infrastructure/Include/ThreadAdaptor.h 22 Apr 2008 08:35:36 -0000 >@@ -60,7 +60,8 @@ > // IInstrumentationAdaptor methods > > virtual TResult Init(Infrastructure::ILogAssert *pLogger = NULL, >- MPI::IEventFilter *pFilter = NULL); >+ MPI::IEventFilter *pFilter = NULL, >+ MPI::BitSet configFlags = MPI::CF_NONE); > > virtual TResult ModifyClass(MPI::TId classId, > const Infrastructure::SClassFile &classToInstrument, >Index: src-native/src/Martini/Infrastructure/Include/MPI.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/Include/MPI.h,v >retrieving revision 1.7 >diff -u -r1.7 MPI.h >--- src-native/src/Martini/Infrastructure/Include/MPI.h 4 Apr 2007 06:19:33 -0000 1.7 >+++ src-native/src/Martini/Infrastructure/Include/MPI.h 22 Apr 2008 08:35:36 -0000 >@@ -109,7 +109,7 @@ > > virtual TResult Configure(BitSet configuration, SConfigData *pConfigData) > { >- return (m_pKernel->Configure (configuration)); >+ return (m_pKernel->Configure(configuration)); > } > > virtual TResult MessageLog(TId clientId, EMessageType msgType, BitSet msgDest, >Index: src-native/src/Martini/Infrastructure/Include/InstrumentationAdaptorBase.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/Include/InstrumentationAdaptorBase.h,v >retrieving revision 1.3 >diff -u -r1.3 InstrumentationAdaptorBase.h >--- src-native/src/Martini/Infrastructure/Include/InstrumentationAdaptorBase.h 20 Feb 2007 12:00:34 -0000 1.3 >+++ src-native/src/Martini/Infrastructure/Include/InstrumentationAdaptorBase.h 22 Apr 2008 08:35:34 -0000 >@@ -109,14 +109,17 @@ > * Implements initialization common to all adaptors. Adaptor implementations should > * call this function during initialization. > * >- * @param[in] pLogger : A pointer to an initialized Logger object, to be used >- * by the instrumentation adaptor for logging messages and >- * reporting fatal errors. >+ * @param[in] pLogger : A pointer to an initialized Logger object, to be used >+ * by the instrumentation adaptor for logging messages and >+ * reporting fatal errors. >+ * @param[in] configFlags : Optional configuration flags passed to the Martini tool >+ * during its initialization (see MPI::EConfigurationFlags) > * > * @retval MRTE_RESULT_OK Success > * @retval MRTE_ERROR_FAIL Initialization error > */ >- TResult Init(Infrastructure::ILogAssert *pLogger = NULL); >+ TResult Init(Infrastructure::ILogAssert *pLogger = NULL, >+ MPI::BitSet configFlags = MPI::CF_NONE); > > /** > * @brief Retrieves Java class information >@@ -193,7 +196,8 @@ > bool m_bJVMInitDone; // Indicates whether the JVM has initialized > JIE::IJIE* m_pJIE; // Java Instrumentation Engine instance > Infrastructure::ILogAssert *m_pLogger; // Logger instance >- >+ MPI::BitSet m_configFlags; // Configuration flags >+ > private: > > /** >Index: src-native/src/Martini/Infrastructure/Include/JPI.H >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/Include/JPI.H,v >retrieving revision 1.4 >diff -u -r1.4 JPI.H >--- src-native/src/Martini/Infrastructure/Include/JPI.H 4 Apr 2007 06:19:33 -0000 1.4 >+++ src-native/src/Martini/Infrastructure/Include/JPI.H 22 Apr 2008 08:35:36 -0000 >@@ -16,7 +16,7 @@ > > #include <iostream> > #include "OSA.h" >-#include "jvmpi.h" >+#include "jvmti.h" > #include "MPI.h" > > #ifdef JPI_EXPORTS >Index: src-native/src/Martini/Infrastructure/Include/CGAdaptor.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/Include/CGAdaptor.h,v >retrieving revision 1.6 >diff -u -r1.6 CGAdaptor.h >--- src-native/src/Martini/Infrastructure/Include/CGAdaptor.h 20 Feb 2007 12:00:34 -0000 1.6 >+++ src-native/src/Martini/Infrastructure/Include/CGAdaptor.h 22 Apr 2008 08:35:32 -0000 >@@ -61,7 +61,8 @@ > // IInstrumentationAdaptor methods > > virtual TResult Init(Infrastructure::ILogAssert *pLogger = NULL, >- MPI::IEventFilter* pFilter = NULL); >+ MPI::IEventFilter* pFilter = NULL, >+ MPI::BitSet configFlags = MPI::CF_NONE); > > virtual TResult ModifyClass(MPI::TId classId, > const Infrastructure::SClassFile &classToInstrument, >@@ -125,7 +126,8 @@ > MIE::TVariableID isJVMInitVar, > JIE::TConstantPoolIndex cpiMethodId, > JIE::TConstantPoolIndex cpiLeaveCallback, >- bool bJVMInitDone); >+ bool bJVMInitDone, >+ bool bIsConstructor); > > // Adds a static private boolean field to the specified Java class > // which is used to determine whether a method was called for the first time >@@ -134,7 +136,7 @@ > MPI::TId methodMPIId); > > bool IsProblematicMethod(const char *szClassName, const char *szMethodName); >- //bool IsConstructor(const JIE::SJavaMethodInfo &methodInfo); >+ bool IsConstructor(const char *szMethodName); > > }; // class CCGAdaptor > >Index: src-native/src/Martini/Infrastructure/Include/IKernel.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/Include/IKernel.h,v >retrieving revision 1.5 >diff -u -r1.5 IKernel.h >--- src-native/src/Martini/Infrastructure/Include/IKernel.h 27 Mar 2007 08:24:41 -0000 1.5 >+++ src-native/src/Martini/Infrastructure/Include/IKernel.h 22 Apr 2008 08:35:34 -0000 >@@ -25,7 +25,7 @@ > const char *szOptions) = 0; > virtual SClientInfo *GetClientInfo(MPI::TId id) = 0; > virtual SClientInfo *GetClientInfo(const char* szProfiler) = 0; >- virtual TResult Configure(unsigned int configuration) = 0; >+ virtual TResult Configure(MPI::BitSet configuration) = 0; > virtual TResult SuspendVM() = 0; > virtual TResult ResumeVM() = 0; > virtual TResult RunGC() = 0; >Index: src-native/src/Martini/Infrastructure/Include/InstrumentationAdaptor.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/Include/InstrumentationAdaptor.h,v >retrieving revision 1.5 >diff -u -r1.5 InstrumentationAdaptor.h >--- src-native/src/Martini/Infrastructure/Include/InstrumentationAdaptor.h 28 Feb 2008 03:55:14 -0000 1.5 >+++ src-native/src/Martini/Infrastructure/Include/InstrumentationAdaptor.h 22 Apr 2008 08:35:34 -0000 >@@ -69,14 +69,16 @@ > * > * This function initializes the Instrumentation Adaptor. It is called > * prior to any other Adaptor function. >- * >- * @param[in] pLogger : A pointer to an initialized Logger object, to be used >- * by the instrumentation adaptor for logging messages and >- * reporting fatal errors. >- * @param[in] pFilter : An optional pointer to an object implementing the >- * IEventFilter interface. The Adaptor uses this >- * object to determine which elements of the class file >- * should be instrumented. >+ * >+ * @param[in] pLogger : A pointer to an initialized Logger object, to be used >+ * by the instrumentation adaptor for logging messages and >+ * reporting fatal errors. >+ * @param[in] pFilter : An optional pointer to an object implementing the >+ * IEventFilter interface. The Adaptor uses this >+ * object to determine which elements of the class file >+ * should be instrumented. >+ * @param[in] configFlags : Optional configuration flags passed to the Martini tool >+ * during its initialization (see MPI::EConfigurationFlags) > * > * @retval MRTE_RESULT_OK Success > * @retval MRTE_ERROR_FAIL Initialization error >@@ -84,7 +86,8 @@ > * by the adaptor module > */ > virtual TResult Init(Infrastructure::ILogAssert *pLogger = NULL, >- MPI::IEventFilter* pFilter = NULL) = 0; >+ MPI::IEventFilter* pFilter = NULL, >+ MPI::BitSet configFlags = MPI::CF_NONE) = 0; > > /** > * @brief Modifies a Java class file >Index: src-native/src/Martini/Infrastructure/Include/HeapAdaptor.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/Include/HeapAdaptor.h,v >retrieving revision 1.5 >diff -u -r1.5 HeapAdaptor.h >--- src-native/src/Martini/Infrastructure/Include/HeapAdaptor.h 20 Feb 2007 12:00:34 -0000 1.5 >+++ src-native/src/Martini/Infrastructure/Include/HeapAdaptor.h 22 Apr 2008 08:35:34 -0000 >@@ -69,7 +69,8 @@ > // IInstrumentationAdaptor methods > > virtual TResult Init(Infrastructure::ILogAssert *pLogger = NULL, >- MPI::IEventFilter* pFilter = NULL); >+ MPI::IEventFilter* pFilter = NULL, >+ MPI::BitSet configFlags = MPI::CF_NONE); > > virtual TResult ModifyClass(MPI::TId classId, > const Infrastructure::SClassFile &classToInstrument, >Index: src-native/src/JPIAgent/Options.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/JPIAgent/Options.h,v >retrieving revision 1.19 >diff -u -r1.19 Options.h >--- src-native/src/JPIAgent/Options.h 24 Mar 2008 15:38:06 -0000 1.19 >+++ src-native/src/JPIAgent/Options.h 22 Apr 2008 08:35:25 -0000 >@@ -54,6 +54,7 @@ > unsigned int allocSites:1; /* Print allocsites information*/ > enum TraceFormat format; /* Binary or XML output format*/ > unsigned int contAnalysis:1; /* Provide information for contention analysis*/ >+ unsigned int calcStackMap:1; /* Enables recalculation of the StackMapTable attribute for Java class versions >= 50.0 */ > enum StackInfo stackInfo; /* Stack maintenance mode (StackInfoContiguous)*/ > char *invocationOptions; /* The invocation options from the command line */ > char *filterFileName; /* Name of the filters file (filters.txt)*/ >@@ -159,6 +160,10 @@ > return m_jvmtiAgent_Options.contAnalysis == 1; > } > >+ // Is StackMap calculation enabled for Java class file versions >= 50.0 (Java 6) >+ bool isCalcStackMap() { >+ return m_jvmtiAgent_Options.calcStackMap == 1; >+ } > > const char* getUnknownOptionByName( const char* name ); > >Index: src-native/src/JPIAgent/Options.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/JPIAgent/Options.cpp,v >retrieving revision 1.24 >diff -u -r1.24 Options.cpp >--- src-native/src/JPIAgent/Options.cpp 24 Mar 2008 15:38:06 -0000 1.24 >+++ src-native/src/JPIAgent/Options.cpp 22 Apr 2008 08:35:25 -0000 >@@ -70,7 +70,8 @@ > ,1 /* Call graph profiler specific option.*/ > ,0 > ,XmlFormat /* Default output format.*/ >- ,0 /* */ >+ ,0 /* ThreadProf option: contention analysis (off) */ >+ ,0 /* Global option: StackMapTable calculation (off) */ > ,StackInfoNormal /* Stack mode preference (default) */ > ,0 /* The invocation options from the command line */ > ,0 /* Filter File (to be initialized) */ >@@ -78,7 +79,7 @@ > ,0 /* Default process type (to be initialized) */ > ,0 /* Default trace file name (to be initialized) */ > ,0 /* Default profile file name (to be initialized) */ >- ,0 /* Defualt working dir (to be initialized) */ >+ ,0 /* Default working dir (to be initialized) */ > ,0 /* currently no unknown options */ > }; > >@@ -137,7 +138,12 @@ > "\n" > "Supported option names and values:\n" > " server=standalone|enabled|controlled\n" >- " api=true|false\tWhether to enable the Profiler API (true) or not (false). Default is false.\n" >+ " api=true|false\tWhether to enable the Profiler API or not.\n" >+ " \t\t\tDefault is false.\n" >+ " stackmap=true|false\tWhether to recalculate the StackMapTable attribute of\n" >+ " \t\t\tinstrumented methods.\n" >+ " \t\t\tUse only when experiencing verification errors in \n" >+ " \t\t\tJava 1.6+. Default is false.\n" > " file=<file>\t\tOutput file (default is %s)\n" > " \t\t\tOnly applicable when server=standalone\n" > " filters=<file>\tFilter definition file (default is %s)\n" >@@ -302,6 +308,8 @@ > m_jvmtiAgent_Options.allocSites = setBooleanOption(value, key, m_jvmtiAgent_Options.allocSites); > } else if (STRICOLL(key, "CONTANALYSIS") == 0) { > m_jvmtiAgent_Options.contAnalysis = setBooleanOption(value, key, m_jvmtiAgent_Options.contAnalysis); >+ } else if (STRICOLL(key, "STACKMAP") == 0) { >+ m_jvmtiAgent_Options.calcStackMap = setBooleanOption(value, key, m_jvmtiAgent_Options.calcStackMap); > } else { > /* 60879 add the unknown profiling option to the 'unknowns' list so that we > can echo it back to the UI */ >Index: src-native/src/JPIAgent/ECWrapper.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/JPIAgent/ECWrapper.cpp,v >retrieving revision 1.35 >diff -u -r1.35 ECWrapper.cpp >--- src-native/src/JPIAgent/ECWrapper.cpp 27 Mar 2008 14:30:37 -0000 1.35 >+++ src-native/src/JPIAgent/ECWrapper.cpp 22 Apr 2008 08:35:22 -0000 >@@ -596,6 +596,12 @@ > } > > EC_EXPORT bool ECCALL >+isCalcStackMap(EC_Env* env) >+{ >+ return ECWrapper::m_pCOptions->isCalcStackMap(); >+} >+ >+EC_EXPORT bool ECCALL > isStackMemoryFree(EC_Env* env) > { > return ECWrapper::m_pCOptions->isStackMemoryFree(); >@@ -690,6 +696,7 @@ > ECWrapper::m_ECFunctions.isEnabled = &isEnabled; > ECWrapper::m_ECFunctions.isAllocSitesSupported = &isAllocSitesSupported; > ECWrapper::m_ECFunctions.isContentionAnalysisSupported = &isContentionAnalysisSupported; >+ ECWrapper::m_ECFunctions.isCalcStackMap = &isCalcStackMap; > ECWrapper::m_ECFunctions.getUnknownOptionByName = &getUnknownOptionByName; > ECWrapper::m_ECFunctions.VMInitDone = &VMInitDone; > ECWrapper::m_EC_Env.functions = &ECWrapper::m_ECFunctions; >Index: src-native/src/Martini/Infrastructure/HeapAdaptor/HeapAdaptor.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/HeapAdaptor/HeapAdaptor.cpp,v >retrieving revision 1.13 >diff -u -r1.13 HeapAdaptor.cpp >--- src-native/src/Martini/Infrastructure/HeapAdaptor/HeapAdaptor.cpp 29 Feb 2008 15:38:34 -0000 1.13 >+++ src-native/src/Martini/Infrastructure/HeapAdaptor/HeapAdaptor.cpp 22 Apr 2008 08:35:32 -0000 >@@ -80,10 +80,12 @@ > } > } > >-TResult CHeapAdaptor::Init(ILogAssert *pLogger, MPI::IEventFilter* pFilter) >+TResult CHeapAdaptor::Init(ILogAssert *pLogger, >+ MPI::IEventFilter* pFilter, >+ MPI::BitSet configFlags) > { > // Call common initializer >- TResult res = CInstrumentationAdaptorBase::Init(pLogger); >+ TResult res = CInstrumentationAdaptorBase::Init(pLogger, configFlags); > if (MRTE_FAILED(res)) > { > return MRTE_ERROR_FAIL; >Index: src-native/src/Martini/Infrastructure/JPI/JpiGlobals.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/JPI/JpiGlobals.cpp,v >retrieving revision 1.4 >diff -u -r1.4 JpiGlobals.cpp >--- src-native/src/Martini/Infrastructure/JPI/JpiGlobals.cpp 20 Feb 2007 12:00:33 -0000 1.4 >+++ src-native/src/Martini/Infrastructure/JPI/JpiGlobals.cpp 22 Apr 2008 08:35:48 -0000 >@@ -29,7 +29,7 @@ > : pfnMethodEnterHandler(NULL), pfnMethodLeaveHandler(NULL), > pfnMethodLeaveWithExcetionHandler(NULL), pfnObjectAllocHandler(NULL), > pfnArrayAllocHandler(NULL), pJvmInterface(NULL), bJvmInitDone(false), >- m_ptlsMpiThreadStatus(NULL) >+ m_ptlsMpiThreadStatus(NULL), configFlags(MPI::CF_NONE), pConfigData(NULL) > { > if (!m_ptlsMpiThreadStatus) > { >Index: src-native/src/Martini/Infrastructure/JPI/JPIKernel.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/JPI/JPIKernel.cpp,v >retrieving revision 1.7 >diff -u -r1.7 JPIKernel.cpp >--- src-native/src/Martini/Infrastructure/JPI/JPIKernel.cpp 4 Apr 2007 06:19:32 -0000 1.7 >+++ src-native/src/Martini/Infrastructure/JPI/JPIKernel.cpp 22 Apr 2008 08:35:41 -0000 >@@ -491,3 +491,9 @@ > > return res; > } >+ >+TResult CJPIKernel::Configure(BitSet configuration) >+{ >+ CJpiGlobals::Instance()->configFlags = configuration; >+ return MRTE_RESULT_OK; >+} >Index: src-native/src/Martini/Infrastructure/JPI/JpiGlobals.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/JPI/JpiGlobals.h,v >retrieving revision 1.6 >diff -u -r1.6 JpiGlobals.h >--- src-native/src/Martini/Infrastructure/JPI/JpiGlobals.h 29 Feb 2008 19:16:30 -0000 1.6 >+++ src-native/src/Martini/Infrastructure/JPI/JpiGlobals.h 22 Apr 2008 08:35:48 -0000 >@@ -128,6 +128,12 @@ > > // VM initialization status > bool bJvmInitDone; >+ >+ // JPI Configuration flags (one or more MPI::EConfigurationFlags values) >+ MPI::BitSet configFlags; >+ >+ // JPI Configuration data >+ MPI::SConfigData* pConfigData; > > private: > CJpiGlobals(); >Index: src-native/src/Martini/Infrastructure/JPI/JavaInstrumentorManager.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/JPI/JavaInstrumentorManager.cpp,v >retrieving revision 1.19 >diff -u -r1.19 JavaInstrumentorManager.cpp >--- src-native/src/Martini/Infrastructure/JPI/JavaInstrumentorManager.cpp 7 Apr 2008 05:59:32 -0000 1.19 >+++ src-native/src/Martini/Infrastructure/JPI/JavaInstrumentorManager.cpp 22 Apr 2008 08:35:45 -0000 >@@ -295,7 +295,9 @@ > ////////////////////////////////////////////////////////////////////////// > // CCgAdaptorDelegate > >-TResult CCgAdaptorDelegate::Init(ILogAssert *pLogger, MPI::IEventFilter *pFilter) >+TResult CCgAdaptorDelegate::Init(ILogAssert *pLogger, >+ MPI::IEventFilter *pFilter, >+ MPI::BitSet configFlags) > { > MPI::ICallGraphFilter *pCgFilter = (MPI::ICallGraphFilter*)pFilter; > m_CGFilterProxy.Init(pCgFilter); >@@ -326,7 +328,7 @@ > } > > // Initialize the Adaptor >- TResult res = m_pAdaptor->Init(CLogAssert::GetInstance(), &m_CGFilterProxy); >+ TResult res = m_pAdaptor->Init(CLogAssert::GetInstance(), &m_CGFilterProxy, configFlags); > return res; > } > >@@ -479,7 +481,9 @@ > > > >-TResult CThreadAdaptorDelegate::Init(ILogAssert *pLogger, MPI::IEventFilter *pFilter) >+TResult CThreadAdaptorDelegate::Init(ILogAssert *pLogger, >+ MPI::IEventFilter *pFilter, >+ MPI::BitSet configFlags) > { > //Add filtering support > MPI::IThreadInteractionFilter *pThreadInteractionFilter = (MPI::IThreadInteractionFilter*)pFilter; >@@ -511,7 +515,8 @@ > } > > // Initialize the Adaptor >- TResult res = m_pAdaptor->Init(CLogAssert::GetInstance(), &m_ThreadInteractionFilterProxy); >+ TResult res = m_pAdaptor->Init(CLogAssert::GetInstance(), &m_ThreadInteractionFilterProxy, >+ configFlags); > return MRTE_RESULT_OK; > } > >@@ -730,7 +735,9 @@ > ////////////////////////////////////////////////////////////////////////// > // CHeapAdaptorDelegate > >-TResult CHeapAdaptorDelegate::Init(ILogAssert *pLogger, MPI::IEventFilter *pFilter) >+TResult CHeapAdaptorDelegate::Init(ILogAssert *pLogger, >+ MPI::IEventFilter *pFilter, >+ MPI::BitSet configFlags) > { > if (!m_pAdaptor) > { >@@ -758,7 +765,7 @@ > } > > // Initialize the Adaptor >- TResult res = m_pAdaptor->Init(CLogAssert::GetInstance()); >+ TResult res = m_pAdaptor->Init(CLogAssert::GetInstance(), NULL, configFlags); > return res; > } > >@@ -1036,7 +1043,8 @@ > m_pAdaptor = CAdaptorFactory::Instance()->CreateAdaptor(group); > if (NULL != m_pAdaptor) > { >- res = m_pAdaptor->Init(CLogAssert::GetInstance(), pEventFilter); >+ res = m_pAdaptor->Init(CLogAssert::GetInstance(), pEventFilter, >+ CJpiGlobals::Instance()->configFlags); > } > return res; > } >@@ -1211,6 +1219,15 @@ > return; > } > >+ // If StackMapTable attribute calculation is enabled, then bootstrap classes >+ // (i.e., classes loaded before VMInit) are not instrumented. >+ if ((CJpiGlobals::Instance()->configFlags & MPI::CF_JAVA_ENABLE_STACKMAP_CALC) >+ && !m_bJVMInit) >+ { >+ SetClassFileNotInstrumented(pJVMEvent); >+ return; >+ } >+ > TResult iRetVal = MRTE_RESULT_OK; > if (m_bIsTentativeInstrumentation && !m_bHasFirstClassLoadHookArrived) > { >Index: src-native/src/Martini/Infrastructure/JPI/JPIKernel.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/JPI/JPIKernel.h,v >retrieving revision 1.5 >diff -u -r1.5 JPIKernel.h >--- src-native/src/Martini/Infrastructure/JPI/JPIKernel.h 27 Mar 2007 08:24:40 -0000 1.5 >+++ src-native/src/Martini/Infrastructure/JPI/JPIKernel.h 22 Apr 2008 08:35:41 -0000 >@@ -50,11 +50,7 @@ > const char *szOptions); > virtual Infrastructure::SClientInfo *GetClientInfo(MPI::TId id); > virtual Infrastructure::SClientInfo *GetClientInfo(const char* szClientName); >- virtual TResult Configure(unsigned int configuration) >- { >- return MRTE_ERROR_NOT_SUPPORTED; >- } >- >+ virtual TResult Configure(MPI::BitSet configuration); > virtual TResult SuspendVM(); > virtual TResult ResumeVM(); > virtual TResult RunGC(); >Index: src-native/src/Martini/Infrastructure/JPI/JavaInstrumentorManager.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/JPI/JavaInstrumentorManager.h,v >retrieving revision 1.12 >diff -u -r1.12 JavaInstrumentorManager.h >--- src-native/src/Martini/Infrastructure/JPI/JavaInstrumentorManager.h 29 Feb 2008 15:40:05 -0000 1.12 >+++ src-native/src/Martini/Infrastructure/JPI/JavaInstrumentorManager.h 22 Apr 2008 08:35:48 -0000 >@@ -79,7 +79,8 @@ > // IInstrumentationAdaptor methods > > virtual TResult Init(Infrastructure::ILogAssert *pLogger = NULL, >- MPI::IEventFilter* pFilter = NULL); >+ MPI::IEventFilter* pFilter = NULL, >+ MPI::BitSet configFlags = MPI::CF_NONE); > virtual TResult ModifyClass(MPI::TId classId, > const Infrastructure::SClassFile &classToInstrument, > TMemoryAllocatorFunc funcAllocator, >@@ -122,7 +123,8 @@ > // IInstrumentationAdaptor methods > > virtual TResult Init(Infrastructure::ILogAssert *pLogger = NULL, >- MPI::IEventFilter* pFilter = NULL); >+ MPI::IEventFilter* pFilter = NULL, >+ MPI::BitSet configFlags = MPI::CF_NONE); > virtual TResult ModifyClass(MPI::TId classId, > const Infrastructure::SClassFile &classToInstrument, > TMemoryAllocatorFunc funcAllocator, >@@ -146,7 +148,8 @@ > // IInstrumentationAdaptor methods > > virtual TResult Init(Infrastructure::ILogAssert *pLogger = NULL, >- MPI::IEventFilter *pFilter = NULL); >+ MPI::IEventFilter* pFilter = NULL, >+ MPI::BitSet configFlags = MPI::CF_NONE); > virtual TResult ModifyClass(MPI::TId classId, > const Infrastructure::SClassFile &classToInstrument, > TMemoryAllocatorFunc funcAllocator, >Index: src-native/include/JPIAgent/EC_Env.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/include/JPIAgent/EC_Env.h,v >retrieving revision 1.23 >diff -u -r1.23 EC_Env.h >--- src-native/include/JPIAgent/EC_Env.h 29 Feb 2008 19:16:29 -0000 1.23 >+++ src-native/include/JPIAgent/EC_Env.h 22 Apr 2008 08:35:12 -0000 >@@ -96,6 +96,7 @@ > bool (ECCALL *isEnabled)(EC_Env* env); > bool (ECCALL *isAllocSitesSupported)(EC_Env* env); > bool (ECCALL *isContentionAnalysisSupported)(EC_Env* env); >+ bool (ECCALL *isCalcStackMap)(EC_Env* env); > > const char*(ECCALL *getUnknownOptionByName)(EC_Env* env, const char* name); > >@@ -242,6 +243,10 @@ > return functions->isContentionAnalysisSupported(this); > } > >+ bool isCalcStackMap() { >+ return functions->isCalcStackMap(this); >+ } >+ > const char* getUnknownOptionByName( const char* name ) { > return functions->getUnknownOptionByName(this, name); > } >Index: src-native/src/Martini/Infrastructure/ThreadAdaptor/ThreadAdaptor.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/ThreadAdaptor/ThreadAdaptor.cpp,v >retrieving revision 1.1 >diff -u -r1.1 ThreadAdaptor.cpp >--- src-native/src/Martini/Infrastructure/ThreadAdaptor/ThreadAdaptor.cpp 29 Feb 2008 15:43:11 -0000 1.1 >+++ src-native/src/Martini/Infrastructure/ThreadAdaptor/ThreadAdaptor.cpp 22 Apr 2008 08:35:51 -0000 >@@ -86,10 +86,12 @@ > { > } > >-TResult CThreadAdaptor::Init(ILogAssert *pLogger, MPI::IEventFilter *pFilter) >+TResult CThreadAdaptor::Init(ILogAssert *pLogger, >+ MPI::IEventFilter *pFilter, >+ MPI::BitSet configFlags) > { > // Call common initializer >- TResult res = CInstrumentationAdaptorBase::Init(pLogger); >+ TResult res = CInstrumentationAdaptorBase::Init(pLogger, configFlags); > if (MRTE_FAILED(res)) > { > return MRTE_ERROR_FAIL; >Index: src-native/src/Martini/Infrastructure/CGAdaptor/CGAdaptor.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/CGAdaptor/CGAdaptor.cpp,v >retrieving revision 1.13 >diff -u -r1.13 CGAdaptor.cpp >--- src-native/src/Martini/Infrastructure/CGAdaptor/CGAdaptor.cpp 29 Feb 2008 15:37:54 -0000 1.13 >+++ src-native/src/Martini/Infrastructure/CGAdaptor/CGAdaptor.cpp 22 Apr 2008 08:35:30 -0000 >@@ -17,6 +17,7 @@ > #include "HeapProxy.h" > #include "ThreadProxy.h" > #include "ValidityChecks.h" >+#include "MRTEInfrastructureDefinitions.h" > > #include <assert.h> > #include <string.h> >@@ -67,10 +68,12 @@ > } > } > >-TResult CCGAdaptor::Init(ILogAssert *pLogger, MPI::IEventFilter* pFilter) >+TResult CCGAdaptor::Init(ILogAssert *pLogger, >+ MPI::IEventFilter* pFilter, >+ MPI::BitSet configFlags) > { > // Call common initializer >- TResult res = CInstrumentationAdaptorBase::Init(pLogger); >+ TResult res = CInstrumentationAdaptorBase::Init(pLogger, configFlags); > if (MRTE_FAILED(res)) > { > return MRTE_ERROR_FAIL; >@@ -378,7 +381,8 @@ > // If no methods were instrumented, modify the return code to indicate this > if (MRTE_SUCCEEDED(res) && instrMethodCount == 0) > { >- LOG_INFORMATIVE1("CGAdaptor", 3, false, "Class %s was not instrumented because all its methods were excluded", >+ LOG_INFORMATIVE1("CGAdaptor", 3, false, >+ "Class %s was not instrumented because all its methods were excluded", > classInfo.szClassName); > res = MRTE_ERROR_INSTRUMENTATION_NOT_NEEDED; > } >@@ -681,7 +685,13 @@ > } > > res = InjectEpilogCode(pMethod, pInstructionsIter, pOriginalFirstInstr, isJVMInitVar, >- cpMethodId, cpLeaveCallback, bJVMInitDone); >+ cpMethodId, cpLeaveCallback, bJVMInitDone, >+ IsConstructor(pInfo->szName)); >+ >+ if (MRTE_RESULT_OK != res) >+ { >+ return res; >+ } > > pInstructionsIter->Free(); > res = pMethod->ApplyInstrumentation(); >@@ -837,7 +847,8 @@ > TVariableID isJVMInitVar, > TConstantPoolIndex cpiMethodId, > TConstantPoolIndex cpiLeaveCallback, >- bool bJVMInitDone) >+ bool bJVMInitDone, >+ bool bIsConstructor) > { > TResult res; > >@@ -899,8 +910,56 @@ > // whether the method terminates normally or abnormally > > IInstruction *pStartTry; >- pInstructionsIter->GetFirst(); >- pStartTry = pOriginalFirstMethodInst; >+ if (bIsConstructor) >+ { >+ // The instrumented method is a constructor. The protected block should start >+ // only after the call to the constructor of the superclass (or another constructor >+ // of the current class) to prevent verification issues >+ // (see https://bugs.eclipse.org/170075) >+ >+ // Find where the original method code starts (need to skip the injected prolog) >+ pStartTry = pInstructionsIter->GetFirst(); >+ while (pStartTry != pOriginalFirstMethodInst && pStartTry != NULL) >+ { >+ pStartTry = pInstructionsIter->GetNext(); >+ } >+ if (NULL == pStartTry) >+ { >+ LOG_INFORMATIVE("CGAdaptor", 0, false, >+ "Cannot find the first instruction of the method"); >+ return MRTE_ERROR_FAIL; >+ } >+ >+ // Search for the first "invokespecial" instruction. >+ // Since this is a constructor, it is expected to have an "invokespecial" of another >+ // constructor in this class or in its superclass >+ // >+ // If this is not the case (may happen for generated or instrumented code) the >+ // constructor will not be instrumented >+ while (pStartTry != NULL >+ && pStartTry->GetMnemonic() != MNM_INVOKESPECIAL) >+ { >+ pStartTry = pInstructionsIter->GetNext(); >+ } >+ if (pStartTry != NULL >+ && pStartTry->GetMnemonic() == MNM_INVOKESPECIAL) >+ { >+ // Assume this is the constructor invocation >+ pStartTry = pInstructionsIter->GetNext(); >+ } >+ else >+ { >+ LOG_INFORMATIVE("CGAdaptor", 0, false, >+ "Constructor method does not start with invocation of super-constructor. " >+ "Method will not be instrumented"); >+ return MRTE_ERROR_UNABLE_TO_INSTRUMENT; >+ } >+ } >+ else >+ { >+ // Regular method. The protected block spans the entire (original) method code >+ pStartTry = pOriginalFirstMethodInst; >+ } > res = pMethod->BindTryFinallyBlock(pStartTry, pLastMethodInstruction, > pFirstInstInFinally, pLastInstInFinally); > >@@ -953,12 +1012,10 @@ > return MRTE_RESULT_OK; > } > >-/* >-bool CCGAdaptor::IsConstructor(const SJavaMethodInfo &methodInfo) >+bool CCGAdaptor::IsConstructor(const char *szMethodName) > { > bool bIsCtor; >- char *szName = CWideStringUtils::WideStringToCString(methodInfo.methodName); >- if (strcmp(szName, JAVA_INSTANCE_CONSTRUCTOR_NAME) == 0) >+ if (strcmp(szMethodName, JAVA_INSTANCE_CONSTRUCTOR_NAME) == 0) > { > bIsCtor = true; > } >@@ -966,10 +1023,8 @@ > { > bIsCtor = false; > } >- delete szName; > return bIsCtor; > } >-*/ > > bool CCGAdaptor::IsProblematicMethod(const char *szClassName, > const char *szMethodName) >Index: src-native/src/Martini/Infrastructure/CGAdaptor/.cvsignore >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/CGAdaptor/.cvsignore,v >retrieving revision 1.1 >diff -u -r1.1 .cvsignore >--- src-native/src/Martini/Infrastructure/CGAdaptor/.cvsignore 27 Jan 2008 19:59:04 -0000 1.1 >+++ src-native/src/Martini/Infrastructure/CGAdaptor/.cvsignore 22 Apr 2008 08:35:28 -0000 >@@ -1 +1,2 @@ > debug >+CGAdaptor.plg >Index: src-native/src/BaseProf/BaseProfiler.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/BaseProf/BaseProfiler.cpp,v >retrieving revision 1.9 >diff -u -r1.9 BaseProfiler.cpp >--- src-native/src/BaseProf/BaseProfiler.cpp 29 Feb 2008 19:09:12 -0000 1.9 >+++ src-native/src/BaseProf/BaseProfiler.cpp 22 Apr 2008 08:35:22 -0000 >@@ -64,6 +64,11 @@ > return retVal; > } > >+ if (m_pProfEnv.ec_env->isCalcStackMap()) { >+ pMpiApi->Configure(CF_JAVA_ENABLE_STACKMAP_CALC); >+ } >+ >+ > retVal = InitFilter(); > return retVal; > } >Index: src-native/src/Martini/Infrastructure/common/InstrumentationAdaptorBase.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Infrastructure/common/InstrumentationAdaptorBase.cpp,v >retrieving revision 1.3 >diff -u -r1.3 InstrumentationAdaptorBase.cpp >--- src-native/src/Martini/Infrastructure/common/InstrumentationAdaptorBase.cpp 20 Feb 2007 12:00:34 -0000 1.3 >+++ src-native/src/Martini/Infrastructure/common/InstrumentationAdaptorBase.cpp 22 Apr 2008 08:35:51 -0000 >@@ -46,7 +46,7 @@ > // Default constructor > // > CInstrumentationAdaptorBase::CInstrumentationAdaptorBase() >- : m_bJVMInitDone(false), m_pLogger(NULL) >+: m_bJVMInitDone(false), m_pLogger(NULL), m_configFlags(MPI::CF_NONE) > { > } > >@@ -57,19 +57,26 @@ > { > } > >-TResult CInstrumentationAdaptorBase::Init(ILogAssert *pLogger) >+TResult CInstrumentationAdaptorBase::Init(ILogAssert *pLogger /* = NULL */, >+ MPI::BitSet configFlags /* = MPI::CF_NONE */) > { > m_pLogger = pLogger; >+ m_configFlags = configFlags; > m_pJIE = InitJIE(); > if (NULL == m_pJIE) > { > return MRTE_ERROR_FAIL; > } >+ > return MRTE_RESULT_OK; > } > > void CInstrumentationAdaptorBase::JvmInitDone() > { >+ if (m_configFlags & MPI::CF_JAVA_ENABLE_STACKMAP_CALC) >+ { >+ m_pJIE->EnableStackMapCalculation(); >+ } > m_bJVMInitDone = true; > } > >Index: src-native/src/Martini/Include/JIE.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/src/Martini/Include/JIE.h,v >retrieving revision 1.5 >diff -u -r1.5 JIE.h >--- src-native/src/Martini/Include/JIE.h 20 Feb 2007 12:00:33 -0000 1.5 >+++ src-native/src/Martini/Include/JIE.h 22 Apr 2008 08:35:28 -0000 >@@ -584,6 +584,15 @@ > */ > virtual IJavaClass *GetClassInterface(const unsigned char *pucClassFile, > unsigned int uiClassSize) const = 0; >+ >+ >+ /** >+ * @brief enable the creation of the StackMapTable method >+ * attribute when instrumenting Java classes with version >= 50.0 >+ * (Java 6 and above) >+ */ >+ virtual void EnableStackMapCalculation() const = 0; >+ > }; > > /** >Index: src-native/include/Martini/MpiAPI.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/src-native/include/Martini/MpiAPI.h,v >retrieving revision 1.23 >diff -u -r1.23 MpiAPI.h >--- src-native/include/Martini/MpiAPI.h 7 Mar 2008 09:56:51 -0000 1.23 >+++ src-native/include/Martini/MpiAPI.h 22 Apr 2008 08:35:20 -0000 >@@ -170,6 +170,11 @@ > //!< None > CF_NONE = 0x00000000, > >+ //! @brief Set this to enable the creation of the StackMapTable method >+ //! attribute when instrumenting Java classes with version >= 50.0 >+ //! (Java 6 and above) >+ CF_JAVA_ENABLE_STACKMAP_CALC = 0x00000001, >+ > //! @brief Set this to receive native VM id's instead of MPI allocated id's. > //! Applies for the following MPI elements: thread, module, class and method > CF_DOTNET_USE_VM_IDS = 0x00010000, >@@ -181,7 +186,7 @@ > CF_DOTNET_DISABLE_PREJIT_USE = 0x00040000, > > //! @brief End sentinel >- CF_LAST = 0x80080000 >+ CF_LAST = 0x80100000 > }; > > /** >Index: readme.txt >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.tptp.platform.jvmti.runtime/readme.txt,v >retrieving revision 1.8 >diff -u -r1.8 readme.txt >--- readme.txt 28 Jun 2007 13:54:28 -0000 1.8 >+++ readme.txt 22 Apr 2008 08:35:12 -0000 >@@ -1,5 +1,5 @@ > /**************************************************************************** >- * Copyright (c) 2005 - 2007 Intel Corporation. >+ * Copyright (c) 2005 - 2008 Intel Corporation. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -20,6 +20,7 @@ > (Martini SDK) > Alexander Alexeev, Intel > Stanislav V. Polevic, Intel >+Vasily Levchenko, Intel > > JVMTI Profiler in TPTP 4.4 > >@@ -79,7 +80,11 @@ > a file named jvmti.pro in the current directory > (if such file exists). > Only applicable when server=standalone. >- >+ api=true|false - Whether to enable the Profiler API or not. Default is false. >+ stackmap=true|false - Whether to recalculate the StackMapTable attribute of >+ instrumented methods. >+ Use only when experiencing verification errors in >+ Java 1.6+. Default is false. > <profiler> - the profiler to launch: > CGProf execution time analysis > Supported options:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 148629
:
88758
|
96544
|
96545
|
96546
|
96547
|
96548
|
96761
|
96986
|
97124
|
97125
|
97938
|
98002
|
98071
|
98143
|
98144
|
98393
|
98824
|
98844
|
98845
|
98935
|
99809
|
103085