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 96761 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]
patch to bciEng
bci_eng.patch (text/plain), 31.06 KB, created by
Vasily v. Levchenko
on 2008-04-20 22:40:23 EDT
(
hide
)
Description:
patch to bciEng
Filename:
MIME Type:
Creator:
Vasily v. Levchenko
Created:
2008-04-20 22:40:23 EDT
Size:
31.06 KB
patch
obsolete
>? bci.1.patch >? BCIEngJ/BCIEngJ.plg >? BCIEngJ/bci.1.patch >? BCIEngJ/class_inerface_int.h >? BCIEngJ/class_interface.cpp >? BCIEngJ/class_interface_x.h >? BCIEngProbe/BCIEngProbe.plg >Index: BCIEng.dsp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/BCIEng/BCIEng.dsp,v >retrieving revision 1.5 >diff -U3 -p -r1.5 BCIEng.dsp >--- BCIEng.dsp 24 Mar 2006 21:59:51 -0000 1.5 >+++ BCIEng.dsp 18 Apr 2008 03:36:11 -0000 >@@ -23,6 +23,8 @@ CFG=BCIEng - Win32 Debug > > # Begin Project > # PROP AllowPerConfigDependencies 0 >+# PROP Scc_ProjName "" >+# PROP Scc_LocalPath "" > CPP=cl.exe > RSC=rc.exe > >@@ -62,7 +64,7 @@ LIB32=link.exe -lib > # PROP Intermediate_Dir "Debug" > # PROP Target_Dir "" > # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c >-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Common" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c >+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\Common" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c > # ADD BASE RSC /l 0x409 /d "_DEBUG" > # ADD RSC /l 0x409 /d "_DEBUG" > BSC32=bscmake.exe >Index: BCIEng.dsw >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/BCIEng/BCIEng.dsw,v >retrieving revision 1.5 >diff -U3 -p -r1.5 BCIEng.dsw >--- BCIEng.dsw 24 Mar 2006 21:59:52 -0000 1.5 >+++ BCIEng.dsw 18 Apr 2008 03:35:32 -0000 >@@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace Fil > > ############################################################################### > >-Project: "BCIEng"=.\BCIEng.dsp - Package Owner=<4> >+Project: "BCIEng"=".\BCIEng.dsp" - Package Owner=<4> > > Package=<5> > {{{ >@@ -15,7 +15,7 @@ Package=<4> > > ############################################################################### > >-Project: "BCIEngJ"=.\BCIEngJ\BCIEngJ.dsp - Package Owner=<4> >+Project: "BCIEngJ"=".\BCIEngJ\BCIEngJ.dsp" - Package Owner=<4> > > Package=<5> > {{{ >@@ -30,7 +30,7 @@ Package=<4> > > ############################################################################### > >-Project: "BCIEngProbe"=.\BCIEngProbe\BCIEngProbe.dsp - Package Owner=<4> >+Project: "BCIEngProbe"=".\BCIEngProbe\BCIEngProbe.dsp" - Package Owner=<4> > > Package=<5> > {{{ >@@ -48,7 +48,7 @@ Package=<4> > > ############################################################################### > >-Project: "BciEngJTest"=.\BCIEngJ\BciEngJTest\BciEngJTest.dsp - Package Owner=<4> >+Project: "BciEngJTest"=".\BCIEngJ\BciEngJTest\BciEngJTest.dsp" - Package Owner=<4> > > Package=<5> > {{{ >@@ -60,7 +60,7 @@ Package=<4> > > ############################################################################### > >-Project: "JClassStat"=..\JClass\JClassStat.dsp - Package Owner=<4> >+Project: "JClassStat"="..\JClass\JClassStat.dsp" - Package Owner=<4> > > Package=<5> > {{{ >@@ -72,7 +72,7 @@ Package=<4> > > ############################################################################### > >-Project: "JDump"=..\JDump\JDump.dsp - Package Owner=<4> >+Project: "JDump"="..\JDump\JDump.dsp" - Package Owner=<4> > > Package=<5> > {{{ >@@ -90,7 +90,7 @@ Package=<4> > > ############################################################################### > >-Project: "ProbeInstrumenter"=.\BCIEngProbe\ProbeInstrumenter\ProbeInstrumenter.dsp - Package Owner=<4> >+Project: "ProbeInstrumenter"=".\BCIEngProbe\ProbeInstrumenter\ProbeInstrumenter.dsp" - Package Owner=<4> > > Package=<5> > {{{ >@@ -105,7 +105,7 @@ Package=<4> > > ############################################################################### > >-Project: "ProbeUnitTests"=.\ProbeUnitTests\ProbeUnitTests.dsp - Package Owner=<4> >+Project: "ProbeUnitTests"=".\ProbeUnitTests\ProbeUnitTests.dsp" - Package Owner=<4> > > Package=<5> > {{{ >Index: BCIEngInterface.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/BCIEng/BCIEngInterface.h,v >retrieving revision 1.6 >diff -U3 -p -r1.6 BCIEngInterface.h >--- BCIEngInterface.h 24 Mar 2006 21:59:51 -0000 1.6 >+++ BCIEngInterface.h 15 Apr 2008 03:54:07 -0000 >@@ -152,6 +152,8 @@ typedef void* pbcieng_t; > _BCIENGINTERFACE_EXT_REF unsigned Initialize(pbcieng_t i_pbcieng, const char* i_pchOptions, size_t i_cbOptions); > _BCIENGINTERFACE_EXT_REF unsigned Instrument(pbcieng_t i_pbcieng, void* i_pInClass, size_t i_cbInClass, > void** o_ppOutClass, size_t* o_pcbOutClass); >+ _BCIENGINTERFACE_EXT_REF unsigned Instrument2(pbcieng_t i_pbcieng, void* i_pInClass, size_t i_cbInClass, >+ void** o_ppOutClass, size_t* o_pcbOutClass, void *(*)(void **)); > _BCIENGINTERFACE_EXT_REF unsigned SetAllocator(pbcieng_t i_pbcieng, pfnMalloc_t i_pfnMalloc); > _BCIENGINTERFACE_EXT_REF unsigned SetCallback(pbcieng_t i_pbcieng, pfnCallback_t i_pfnCallback, unsigned i_uFlags); > >Index: Module.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/BCIEng/Module.h,v >retrieving revision 1.8 >diff -U3 -p -r1.8 Module.h >--- Module.h 10 Apr 2006 03:57:59 -0000 1.8 >+++ Module.h 15 Apr 2008 03:54:07 -0000 >@@ -132,7 +132,7 @@ public: > > virtual const vector<string>& GetSourceFileNames() = 0; > >- virtual void Parse()=0; >+ virtual int Parse()=0; > virtual void Emit(); > > CMethods* GetMethods(){return m_pMethods;} >Index: BCIEngJ/BCIEngJ.dsp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/BCIEng/BCIEngJ/BCIEngJ.dsp,v >retrieving revision 1.5 >diff -U3 -p -r1.5 BCIEngJ.dsp >--- BCIEngJ/BCIEngJ.dsp 24 Mar 2006 21:57:56 -0000 1.5 >+++ BCIEngJ/BCIEngJ.dsp 20 Apr 2008 02:31:42 -0000 >@@ -41,7 +41,7 @@ RSC=rc.exe > # PROP Intermediate_Dir "Release" > # PROP Target_Dir "" > # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c >-# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\\" /I "..\..\jclass" /I "..\..\..\sun" /I "..\..\common" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c >+# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\..\common" /I "${JAVA_HOME}\include" /I "${JAVA_HOME}\include\win32" /I "${HARMONY_VERIFIER}\open\include" /I "${HARMONY_VERIFIER}\verifier-3363\x_verifier" /I "%HARMONY_VERIFIER%\include" /I "..\..\Common" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I "..\\" /I "..\..\jclass" /I "..\..\..\sun" /I "..\..\..\..\..\org.apache.harmony_vmcore_verifier\include" /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /YX /FD /c > # ADD BASE RSC /l 0x409 /d "NDEBUG" > # ADD RSC /l 0x409 /d "NDEBUG" > BSC32=bscmake.exe >@@ -64,7 +64,8 @@ LIB32=link.exe -lib > # PROP Intermediate_Dir "Debug" > # PROP Target_Dir "" > # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c >-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Common" /I "..\\" /I "..\..\jclass" /I "..\..\..\sun" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c >+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\Common" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I "..\\" /I "..\..\jclass" /I "..\..\..\sun" /I "..\..\..\..\..\org.apache.harmony_vmcore_verifier\include" /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /FR /FD /GZ /c >+# SUBTRACT CPP /YX > # ADD BASE RSC /l 0x409 /d "_DEBUG" > # ADD RSC /l 0x409 /d "_DEBUG" > BSC32=bscmake.exe >@@ -85,6 +86,10 @@ LIB32=link.exe -lib > # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" > # Begin Source File > >+SOURCE=.\class_interface.cpp >+# End Source File >+# Begin Source File >+ > SOURCE=.\ExtRefJ_Interface.cpp > # End Source File > # Begin Source File >@@ -105,6 +110,14 @@ SOURCE=.\ModuleJ.cpp > # PROP Default_Filter "h;hpp;hxx;hm;inl" > # Begin Source File > >+SOURCE=.\class_inerface_int.h >+# End Source File >+# Begin Source File >+ >+SOURCE=.\class_interface_x.h >+# End Source File >+# Begin Source File >+ > SOURCE=.\ExtRefJ_Interface.h > # End Source File > # Begin Source File >Index: BCIEngJ/ModuleJ.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/BCIEng/BCIEngJ/ModuleJ.cpp,v >retrieving revision 1.8 >diff -U3 -p -r1.8 ModuleJ.cpp >--- BCIEngJ/ModuleJ.cpp 10 Apr 2006 03:56:40 -0000 1.8 >+++ BCIEngJ/ModuleJ.cpp 18 Apr 2008 03:56:08 -0000 >@@ -34,8 +34,9 @@ > #include <iostream> > #endif > >-static CInsSetJ InsSet; >+#include <assert.h> > >+static CInsSetJ InsSet; > //============================================================================== > // CModuleJ implementation > //------------------------------------------------------------------------------ >@@ -51,6 +52,10 @@ CModuleJ::CModuleJ() > m_fDestroyClass = false; > m_fAccessFlags = 0; > m_sourceFileNamesPopulated = false; >+ m_verificationContext = NULL; >+ m_classHandler = NULL; >+ m_methodContexts = NULL; >+ m_use_stack_map_recalculation = false; > } > > //------------------------------------------------------------------------------ >@@ -63,6 +68,18 @@ CModuleJ::~CModuleJ() > { > delete m_pClass; > } >+ if (m_verificationContext != NULL) { >+ free_verification_context(m_verificationContext); >+ m_verificationContext = NULL; >+ } >+ if (m_classHandler != NULL) { >+ /*XXX: free here*/ >+ m_classHandler = NULL; >+ } >+ if (m_methodContexts != NULL) { >+ free(m_methodContexts); >+ m_methodContexts = NULL; >+ } > } > > //------------------------------------------------------------------------------ >@@ -83,6 +100,7 @@ CModuleJ::Open(CSTR i_szName) > m_fDestroyClass = true; > FileStreamIn.Close(); > Verify(); >+ > } > > //------------------------------------------------------------------------------ >@@ -184,7 +202,7 @@ CModuleJ::CreateMethod(u2 i_u2AccFlags, > } > > //------------------------------------------------------------------------------ >-void >+int > CModuleJ::Parse() > { > CJMethods* pMethods = m_pClass->GetMethods(); >@@ -227,12 +245,42 @@ CModuleJ::Parse() > } > m_pMethods->push_back(pMtd); > } >+ >+ vf_Result status; >+ int ind; >+ if (GetClassBuilder().GetMajorVersion() >= 50 >+ && IsStackMapCalculationUsed()) { >+ m_classHandler = get_class_handler_from_builder(this); >+ assert(m_classHandler); >+ m_verificationContext = allocate_verification_context(m_classHandler); >+ assert(m_verificationContext); >+ m_methodContexts = (method_handler *)malloc(m_pMethods->size() * sizeof(method_handler)); >+ assert(m_methodContexts); >+ memset(m_methodContexts, 0, m_pMethods->size() * sizeof(method_handler)); >+ fprintf(stderr, "class : %s is java6 compiled\n", m_strName.c_str()); >+ } > > CMethods::iterator iterm; >- for(iterm = m_pMethods->begin(); iterm < m_pMethods->end(); iterm++) >+ for(iterm = m_pMethods->begin(), ind = 0; iterm < m_pMethods->end(); iterm++, ind++) > { > (*iterm)->Parse(); >+ if (GetClassBuilder().GetMajorVersion() >= 50 >+ && IsStackMapCalculationUsed()) { >+ //malloc(5); >+ m_methodContexts[ind] = get_method_handler_for_cmethod(*iterm); >+ //malloc(50); >+ assert(m_methodContexts[ind]); >+ status = init_verification_context_for_method(m_methodContexts[ind], m_verificationContext); >+ malloc(50); >+ if (status != VF_OK) { >+ fprintf(stderr, "class was skiped: %s\n", m_strName.c_str()); >+ return (1); /*skip*/ >+ } >+ fprintf(stderr, "class was instrumented: %s\n", m_strName.c_str()); >+ ((CMethodJ *)(*iterm))->SetMethodHandler(m_methodContexts[ind]); >+ } > } >+ return (0); > } > > //------------------------------------------------------------------------------ >@@ -385,8 +433,11 @@ CMethodJ::Emit() > m_pMtdExTable->Emit(); > > //------- >- // Loop over instructions and patch the local variable info table >+ // Loop over instructions and patch the local variable info table, >+ // local variable type table (Java 5.0) and stack map table (Java 6.0) > // >+ >+ > > // Local variable table LVT > CLocalVariableTableAttribute* pLclAttr = m_pCodeAttr->GetLocalVariables(); >@@ -403,6 +454,13 @@ CMethodJ::Emit() > CLocalVariableTypeTable LclTypeTableSav; > CLocalVariableTypeTable::iterator itrLclType, itrLclTypeSav; // LVTT Iterator > >+ // The smtNull variable is for reference initialization in case the method does not have >+ // a Stack Map Table attribute >+ CStackMapTable smtNull; >+ CStackMapTableAttribute* pSmtAttr = m_pCodeAttr->GetStackMaps(); >+ CStackMapTable& StackMapTable = pSmtAttr?pSmtAttr->GetStackMapTable():smtNull; >+ CStackMapTable::iterator itrStackMapFrame = StackMapTable.begin(); >+ > CInsBlocks::iterator iterBlocks; > IP_t ip = 0; > >@@ -458,6 +516,18 @@ CMethodJ::Emit() > } > } > } >+ >+ // Scan for a relevant entry in the Stack Map Table and fix it >+ while (itrStackMapFrame != StackMapTable.end() >+ && (*itrStackMapFrame)->GetByteCodeOffset() < ipOrig) >+ { >+ ++itrStackMapFrame; >+ } >+ if (itrStackMapFrame != StackMapTable.end() >+ && (*itrStackMapFrame)->GetByteCodeOffset() == ipOrig) >+ { >+ (*itrStackMapFrame)->SetByteCodeOffset(ip); >+ } > > // Advance ip > ip += (*iterIns)->GetSize(ip); >@@ -503,11 +573,35 @@ CMethodJ::Emit() > } > } > } >+ // Replace the method body >+ m_pCodeAttr->SetCode(m_pBody->GetCodeSize(), m_pBody->GiveAvayCode()); > >+ // Calculate new stack depth > CalcStackDepth(); > >- // Replace the method body >- m_pCodeAttr->SetCode(m_pBody->GetCodeSize(), m_pBody->GiveAvayCode()); >+ if (((CModuleJ *)GetModule())->GetClassBuilder().GetMajorVersion() >= 50 >+ && ((CModuleJ *)GetModule())->IsStackMapCalculationUsed()) { >+ >+ u1 *tbl; >+ vf_Result status; >+ status = recompute_stackmaptable((uint8 **)&tbl, m_methodHandler, ((CModuleJ *)GetModule())->GetVerificationContext()); >+ if (status != VF_OK) { >+ __asm {int 3} >+ } >+ else { >+ //CStackMapTable smt (tbl); >+ CStackMapTableAttribute* smta = GetCodeAttribute()->GetOrCreateStackMaps(); >+ if (tbl != NULL) { >+ smta->RereadFromBuffer(tbl); //skiping name >+ smta->GetStackMapTable().AdjustOffsetDeltas(); >+ } >+ } >+ } >+ // Final Stack Map Table handling: adjust offset deltas >+ //StackMapTable.AdjustOffsetDeltas(); >+ >+ >+ > > } > >@@ -623,11 +717,15 @@ CMtdExTableJ::Emit() > { > ipRealEnd = ipIns + pi->GetSize(); > bDone = true; >+ //assert(ipStart != ipRealEnd); >+ //(*itrEx)->SetStart(ipStart); >+ //(*itrEx)->SetEnd(ipRealEnd); > break; > } > } > } > } >+ > CJException jex = CJException(uType, ipStart, ipRealEnd, ipHandler); > extblj.push_back(jex); > } >Index: BCIEngJ/ModuleJ.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/BCIEng/BCIEngJ/ModuleJ.h,v >retrieving revision 1.8 >diff -U3 -p -r1.8 ModuleJ.h >--- BCIEngJ/ModuleJ.h 10 Apr 2006 03:56:40 -0000 1.8 >+++ BCIEngJ/ModuleJ.h 15 Apr 2008 03:54:07 -0000 >@@ -30,6 +30,7 @@ > > #include "Module.h" > #include "JClassBuilder.h" >+#include "class_inerface_int.h" > > class CModuleJ; > class CMethodJ; >@@ -57,19 +58,22 @@ public: > virtual void Open(CJClassBuilder* io_pClass, bool i_fDestroyClass = false); > virtual void AddExtRef(CExtRef& i_ExtRef); > virtual void AddStringAttrib(CSTR i_szName, CSTR i_szValue); >- virtual void Parse(); >+ virtual int Parse(); > virtual void Emit(); > > void Emit(CJStream& i_jstream); // Java specific emission > CJClassFile& GetClass(); > CJClassBuilder& GetClassBuilder(); >+ class_handler GetClassHandler() {return m_classHandler;} >+ verification_context GetVerificationContext(){return m_verificationContext;} > > virtual const vector<string>& GetSourceFileNames(); > > // Module modification methods > CCPFieldrefInfo* CreateFieldRef(u2 i_u2AccFlags, CSTR i_szName, CJavaType i_jtype); > CMethodJ* CreateMethod(u2 i_u2AccFlags, CSTR i_szName, CSTR i_szSignature); >- >+ bool IsStackMapCalculationUsed() const {return m_use_stack_map_recalculation;} >+ void UseStackMapCalculation(bool a_use_stack_map_recalculation) {m_use_stack_map_recalculation = a_use_stack_map_recalculation;} > protected: > > private: >@@ -85,6 +89,10 @@ private: > // Storage in support of GetSourceFileNames: > vector<string> m_sourceFileNames; > bool m_sourceFileNamesPopulated; >+ verification_context m_verificationContext; /*verifier context for support java 6.0 and latter*/ >+ class_handler m_classHandler; /* class descriptor used for verification needs(recalculations) introduced in java 6.0*/ >+ method_handler *m_methodContexts; /*collections of method handlers*/ >+ bool m_use_stack_map_recalculation; > }; > > //============================================================================== >@@ -100,6 +108,7 @@ public: > m_strSignature = i_szSignature; > m_pCodeAttr = i_pCodeAttr; > m_u2AccessFlags = i_u2AccessFlags; >+ > > // Set the "hasThis" attribute, which is accessible to all CMethod users > SetHasThis(!(m_u2AccessFlags & ACC_STATIC)); >@@ -110,6 +119,8 @@ public: > CSTR GetSignature() const {return m_strSignature.c_str();} > bool IsAbstract() { return ((m_u2AccessFlags & ACC_ABSTRACT) != 0); }; > u2 GetAccessFlags() const { return m_u2AccessFlags; } >+ void SetMethodHandler(method_handler i_methodHandler) {m_methodHandler = i_methodHandler;} >+ method_handler GetMethodHandler() {return m_methodHandler;} > > virtual void Parse(); > virtual void Emit(); >@@ -121,6 +132,7 @@ private: > CCodeAttribute* m_pCodeAttr; // Code attribute from CJClassFile > u2 m_u2AccessFlags; // Method access flags > IP_t m_origCodeLength; // Saved code length from Parse to Emit >+ method_handler m_methodHandler; > }; > > >Index: BCIEngProbe/BCIEngProbe.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbe.cpp,v >retrieving revision 1.8 >diff -U3 -p -r1.8 BCIEngProbe.cpp >--- BCIEngProbe/BCIEngProbe.cpp 12 Mar 2008 12:36:36 -0000 1.8 >+++ BCIEngProbe/BCIEngProbe.cpp 15 Apr 2008 03:54:07 -0000 >@@ -20,6 +20,8 @@ > #pragma convert(819) /* see comment in CommonDef.h about this */ > #endif > >+#include <assert.h> >+ > #ifdef WIN32 > #pragma warning(disable:4786) > #endif >@@ -32,6 +34,7 @@ > #include "BCIEngProbe.h" // BCI Engine for Probe Kit > #include "BCIEngInterface.h" // for callback message number defines > >+ > #include <stdio.h> // for sprintf on Linux > #ifdef MVS > # include <unistd.h> /* for __etoa */ >@@ -1830,10 +1833,16 @@ CBCIEngProbe::Instrument(void* i_pInClas > // Starting with the call to Open, we don't need to delete pClass any more: > // The module owns it. > CModuleJ* pModuleJ = new CModuleJ; >+ pModuleJ->UseStackMapCalculation(m_use_external_verifier); > pModuleJ->Open(pClass, true); > pModuleJ->SetAccessFlags(pClass->GetAccessFlags()); >- pModuleJ->Parse(); >- >+ if (pModuleJ->Parse() != 0) { >+ *o_pcbOutClass = i_cbInClass; >+ *o_ppOutClass = i_pInClass; >+ delete pClass; >+ return false; >+ } >+ > // If we were asked to, then dump the module before and after instrumentation > const char *dump_output_file; > if ((dump_output_file = getenv("PROBEKIT_DUMP_FILE")) != NULL) { >@@ -1845,6 +1854,7 @@ CBCIEngProbe::Instrument(void* i_pInClas > output_stream << "=========== DUMP BEFORE INSTRUMENTATION" << endl; > pModuleJ->Dump(output_stream); > >+ > #if defined(MVS) || defined(__OS400__) > /* On EBCDIC systems, convert ASCII to EBCDIC */ > char* data = output_stream.str(); >@@ -1864,7 +1874,6 @@ CBCIEngProbe::Instrument(void* i_pInClas > // to this module, but we still ran callsite probes against this > // module and maybe we didn't actually do anything. > // In that case we should set out == in and return without calling emit. >- > pModuleJ->Emit(); > > // Tell the client that's driving us that we did something to this module >@@ -1882,6 +1891,7 @@ CBCIEngProbe::Instrument(void* i_pInClas > #else > ofstream output_stream(dump_output_file, ios::app); > #endif >+ > output_stream << "=========== DUMP AFTER INSTRUMENTATION" << endl; > pModuleJ->Dump(output_stream); > >@@ -1898,6 +1908,13 @@ CBCIEngProbe::Instrument(void* i_pInClas > } > > *o_pcbOutClass = pClass->GetSize(); >+ if (m_pfnMalloc == NULL) { >+ /*skipping*/ >+ *o_pcbOutClass = i_cbInClass; >+ *o_ppOutClass = i_pInClass; >+ delete pClass; >+ return false; >+ } > *o_ppOutClass = m_pfnMalloc(*o_pcbOutClass); > > CJMemStream OutStream; // Memory stream >@@ -1998,7 +2015,6 @@ CBCIEngProbe::Instrument(CModule* i_pmod > { > InstrumentMethod(*itrMeth); > } >- > // Process any staticInitializer fragments that matched this class, > // and default initializers for staticField elements in probes that matched. > HandleStaticInitializers(pmodj); >@@ -3179,7 +3195,7 @@ CBCIEngProbe::InstrumentMethod(CMethod* > { > return; > } >- >+ > // Allow the client that's driving us to veto instrumentation of this module > if (NULL != m_pfnCallback && > (m_wCBFlags & BCIENGINTERFACE_CALLBACK_METHOD) && >Index: BCIEngProbe/BCIEngProbe.dsp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbe.dsp,v >retrieving revision 1.5 >diff -U3 -p -r1.5 BCIEngProbe.dsp >--- BCIEngProbe/BCIEngProbe.dsp 24 Mar 2006 21:58:56 -0000 1.5 >+++ BCIEngProbe/BCIEngProbe.dsp 20 Apr 2008 02:31:42 -0000 >@@ -43,7 +43,7 @@ RSC=rc.exe > # PROP Ignore_Export_Lib 0 > # PROP Target_Dir "" > # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BCIENGPROBE_EXPORTS" /YX /FD /c >-# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\..\BCIEng\\" /I "..\..\BCIEng\BCIEngJ" /I "..\..\JClass" /I "..\..\common" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /YX /FD /c >+# ADD CPP /nologo /MT /W3 /GX /Zd /O2 /I "..\..\..\..\..\verifier\include" /I "..\..\..\..\..\verifier\open\include" /I "..\..\..\..\..\harmony-verifier\include" /I "..\..\..\..\..\harmony-verifier\open\include" /I "..\..\..\..\..\recomp" /I "..\..\..\..\..\harmony-verifier\verifier-3363\x_verifier" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I "..\..\BCIEng\\" /I "..\..\BCIEng\BCIEngJ" /I "..\..\JClass" /I "..\..\common" /I "..\..\..\..\..\org.apache.harmony_vmcore_verifier\include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VERIFIER_STANDALONE" /YX /FD /c > # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 > # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 > # ADD BASE RSC /l 0x409 /d "NDEBUG" >@@ -53,7 +53,7 @@ BSC32=bscmake.exe > # ADD BSC32 /nologo > LINK32=link.exe > # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 >-# ADD LINK32 kernel32.lib bciengj.lib /nologo /dll /debug /machine:I386 /libpath:"..\..\..\bci\jclass\release" /libpath:"..\..\..\bci\bcieng\bciengj\release" >+# ADD LINK32 bciengj.lib kernel32.lib verifier-ext.lib /nologo /dll /debug /machine:I386 /libpath:"..\..\..\bci\jclass\release" /libpath:"..\..\..\bci\bcieng\bciengj\release" /libpath:"..\..\..\..\..\org.apache.harmony_vmcore_verifier\lib\win\IA-32" > > !ELSEIF "$(CFG)" == "BCIEngProbe - Win32 Debug" > >@@ -69,7 +69,7 @@ LINK32=link.exe > # PROP Ignore_Export_Lib 0 > # PROP Target_Dir "" > # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BCIENGPROBE_EXPORTS" /YX /FD /GZ /c >-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\BCIEng\\" /I "..\..\BCIEng\BCIEngJ" /I "..\..\JClass" /I "..\..\common" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /GZ /c >+# ADD CPP /nologo /MDd /W3 /GX /Zd /Od /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I "..\..\BCIEng\\" /I "..\..\BCIEng\BCIEngJ" /I "..\..\JClass" /I "..\..\common" /I "..\..\..\..\..\org.apache.harmony_vmcore_verifier\include" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "VERIFIER_STANDALONE" /FR /YX /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" >@@ -79,7 +79,8 @@ BSC32=bscmake.exe > # ADD BSC32 /nologo > LINK32=link.exe > # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept >-# ADD LINK32 bciengj.lib kernel32.lib /nologo /dll /incremental:no /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\bci\jclass\debug" /libpath:"..\..\..\bci\bcieng\bciengj\debug" >+# ADD LINK32 verifier.lib jvm.lib bciengj.lib kernel32.lib verifier-ext.lib /nologo /dll /incremental:no /debug /machine:I386 /out:"Debug/BCIEngProbe.dll " /pdbtype:sept /libpath:"..\..\..\bci\jclass\debug" /libpath:"..\..\..\bci\bcieng\bciengj\debug" /libpath:"..\..\..\..\..\harmony-verifier\verifier\verifier_6\verifier\debug" /libpath:"C:\jrockit-jdk1.6.0_02\lib" /libpath:"..\..\..\..\..\org.apache.harmony_vmcore_verifier\lib\win\IA-32" >+# SUBTRACT LINK32 /verbose > > !ENDIF > >Index: BCIEngProbe/BCIEngProbe.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbe.h,v >retrieving revision 1.6 >diff -U3 -p -r1.6 BCIEngProbe.h >--- BCIEngProbe/BCIEngProbe.h 24 Mar 2006 21:58:56 -0000 1.6 >+++ BCIEngProbe/BCIEngProbe.h 15 Apr 2008 03:54:07 -0000 >@@ -504,6 +504,8 @@ private: > // These fields are reset and reused for each instrumented method > IP_t m_ipFinally; // Finally wrapper label > IP_t m_ipCatchAll; // catch-all wrapper label >+friend class CBCIEngProbeInterface; >+ bool m_use_external_verifier; > }; > > #endif // defined _BCIENGPROBE_H_ >Index: BCIEngProbe/BCIEngProbeInterface.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbeInterface.cpp,v >retrieving revision 1.6 >diff -U3 -p -r1.6 BCIEngProbeInterface.cpp >--- BCIEngProbe/BCIEngProbeInterface.cpp 24 Mar 2006 21:58:56 -0000 1.6 >+++ BCIEngProbe/BCIEngProbeInterface.cpp 15 Apr 2008 03:54:07 -0000 >@@ -20,6 +20,8 @@ > #pragma convert(819) /* see comment in CommonDef.h about this */ > #endif > >+#include <assert.h> >+ > #ifdef MVS > #include <unistd.h> /* for __atoe */ > #endif >@@ -37,6 +39,7 @@ > > #define TOK_WHITESPACE " \t" > >+int g_use_verifier; > //------------------------------------------------------------------------------ > inline static unsigned ExceptionToError(CBCIEngProbeInterfaceException& ex) > { >@@ -341,6 +344,12 @@ CBCIEngProbeInterface::Initialize(const > > } > >+//------------------------------------------------------------------------------ >+void >+CBCIEngProbeInterface::UseStackMapRecalculation(bool a_use_recalculation) >+{ >+ m_peng.m_use_external_verifier = a_use_recalculation; >+} > > //------------------------------------------------------------------------------ > void >@@ -439,6 +448,27 @@ unsigned Instrument(pbcieng_t i_pbcieng, > try > { > CBCIEngProbeInterface* peng = (CBCIEngProbeInterface*)i_pbcieng; >+ peng->UseStackMapRecalculation(false); >+ peng->Instrument(i_pInClass, i_cbInClass, o_ppOutClass, o_pcbOutClass); >+ } >+ catch (CBCIEngProbeInterfaceException& ex) >+ { >+ uErr = ExceptionToError(ex); >+ } >+ return uErr; >+} >+ >+//------------------------------------------------------------------------------ >+unsigned Instrument2(pbcieng_t i_pbcieng, void* i_pInClass, size_t i_cbInClass, >+ void** o_ppOutClass, size_t* o_pcbOutClass, void *(*pEnv)(void **)) >+{ >+ unsigned uErr = 0; >+ initialize_dynamic(pEnv); >+ try >+ { >+ >+ CBCIEngProbeInterface* peng = (CBCIEngProbeInterface*)i_pbcieng; >+ peng->UseStackMapRecalculation(true); > peng->Instrument(i_pInClass, i_cbInClass, o_ppOutClass, o_pcbOutClass); > } > catch (CBCIEngProbeInterfaceException& ex) >@@ -453,6 +483,7 @@ unsigned SetAllocator(pbcieng_t i_pbcien > { > unsigned uErr = 0; > CBCIEngProbeInterface* peng = (CBCIEngProbeInterface*)i_pbcieng; >+ //assert(i_pfnMalloc); > peng->SetAllocator(i_pfnMalloc); > return uErr; > } >Index: BCIEngProbe/BCIEngProbeInterface.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbeInterface.h,v >retrieving revision 1.6 >diff -U3 -p -r1.6 BCIEngProbeInterface.h >--- BCIEngProbe/BCIEngProbeInterface.h 24 Mar 2006 21:58:56 -0000 1.6 >+++ BCIEngProbe/BCIEngProbeInterface.h 15 Apr 2008 03:54:07 -0000 >@@ -85,6 +85,9 @@ public: > > private: > CBCIEngProbe m_peng; >+ void UseStackMapRecalculation(bool a_use_recalculation); >+ friend unsigned Instrument(pbcieng_t, void*, size_t , void** , size_t* ); >+ friend unsigned Instrument2(pbcieng_t, void*, size_t , void** , size_t*, void *(*f)(void **)); > }; > > //------------------------------------------------------------------------------ >Index: BCIEngProbe/ProbeInstrumenter/ProbeInstrumenter.dsp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/BCIEng/BCIEngProbe/ProbeInstrumenter/ProbeInstrumenter.dsp,v >retrieving revision 1.5 >diff -U3 -p -r1.5 ProbeInstrumenter.dsp >--- BCIEngProbe/ProbeInstrumenter/ProbeInstrumenter.dsp 24 Mar 2006 21:58:56 -0000 1.5 >+++ BCIEngProbe/ProbeInstrumenter/ProbeInstrumenter.dsp 20 Apr 2008 02:31:42 -0000 >@@ -42,7 +42,7 @@ RSC=rc.exe > # PROP Ignore_Export_Lib 0 > # PROP Target_Dir "" > # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c >-# ADD CPP /nologo /W3 /GX /Zi /O2 /I "..\..\..\Common" /I "..\..\..\jclass" /I "..\..\..\bcieng" /I "..\..\..\bcieng\bciengj" /I ".." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR"..\Release\\" /YX /FD /c >+# ADD CPP /nologo /W3 /GX /Zi /O2 /I "..\..\..\..\org.apache.harmony_vmcore_verifier\include" /I "..\..\..\Common" /I "..\..\..\jclass" /I "..\..\..\bcieng" /I "..\..\..\bcieng\bciengj" /I ".." /I "..\..\..\..\..\..\org.apache.harmony_vmcore_verifier\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FR"..\Release\\" /YX /FD /c > # ADD BASE RSC /l 0x409 /d "NDEBUG" > # ADD RSC /l 0x409 /d "NDEBUG" > BSC32=bscmake.exe >@@ -66,7 +66,7 @@ LINK32=link.exe > # PROP Ignore_Export_Lib 0 > # PROP Target_Dir "" > # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c >-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\Common" /I "..\..\..\jclass" /I "..\..\..\bcieng" /I "..\..\..\bcieng\bciengj" /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c >+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\..\..\org.apache.harmony_vmcore_verifier\include" /I "..\..\..\Common" /I "..\..\..\jclass" /I "..\..\..\bcieng" /I "..\..\..\bcieng\bciengj" /I ".." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c > # ADD BASE RSC /l 0x409 /d "_DEBUG" > # ADD RSC /l 0x409 /d "_DEBUG" > BSC32=bscmake.exe
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