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 97124 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]
Accumulative patch for BCI
bci.patch (text/plain), 72.36 KB, created by
Vasily v. Levchenko
on 2008-04-22 23:42:59 EDT
(
hide
)
Description:
Accumulative patch for BCI
Filename:
MIME Type:
Creator:
Vasily v. Levchenko
Created:
2008-04-22 23:42:59 EDT
Size:
72.36 KB
patch
obsolete
>? bci.patch >? src-native/BCI/BCIEng/BCIEngJ/class_inerface_int.h >? src-native/BCI/BCIEng/BCIEngJ/class_interface.cpp >? src-native/BCI/BCIEng/BCIEngJ/class_interface_x.h >Index: src-native/BCI/BCIEng/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 >--- src-native/BCI/BCIEng/BCIEng.dsp 24 Mar 2006 21:59:51 -0000 1.5 >+++ src-native/BCI/BCIEng/BCIEng.dsp 23 Apr 2008 03:27:32 -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: src-native/BCI/BCIEng/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 >--- src-native/BCI/BCIEng/BCIEng.dsw 24 Mar 2006 21:59:52 -0000 1.5 >+++ src-native/BCI/BCIEng/BCIEng.dsw 23 Apr 2008 03:27: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: src-native/BCI/BCIEng/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 >--- src-native/BCI/BCIEng/BCIEngInterface.h 24 Mar 2006 21:59:51 -0000 1.6 >+++ src-native/BCI/BCIEng/BCIEngInterface.h 23 Apr 2008 03:27:17 -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: src-native/BCI/BCIEng/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 >--- src-native/BCI/BCIEng/Module.h 10 Apr 2006 03:57:59 -0000 1.8 >+++ src-native/BCI/BCIEng/Module.h 23 Apr 2008 03:27:17 -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: src-native/BCI/BCIEng/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 >--- src-native/BCI/BCIEng/BCIEngJ/BCIEngJ.dsp 24 Mar 2006 21:57:56 -0000 1.5 >+++ src-native/BCI/BCIEng/BCIEngJ/BCIEngJ.dsp 23 Apr 2008 03:27:32 -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: src-native/BCI/BCIEng/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 >--- src-native/BCI/BCIEng/BCIEngJ/ModuleJ.cpp 10 Apr 2006 03:56:40 -0000 1.8 >+++ src-native/BCI/BCIEng/BCIEngJ/ModuleJ.cpp 23 Apr 2008 03:34:37 -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) { >+ free(m_classHandler); >+ 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,40 @@ 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()) { >+ m_methodContexts[ind] = get_method_handler_for_cmethod(*iterm); >+ 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 +431,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 +452,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 +514,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 +571,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) { >+ assert(!"verification failed"); >+ } >+ 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(); >+ >+ >+ > > } > >@@ -628,6 +720,7 @@ CMtdExTableJ::Emit() > } > } > } >+ > CJException jex = CJException(uType, ipStart, ipRealEnd, ipHandler); > extblj.push_back(jex); > } >Index: src-native/BCI/BCIEng/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 >--- src-native/BCI/BCIEng/BCIEngJ/ModuleJ.h 10 Apr 2006 03:56:40 -0000 1.8 >+++ src-native/BCI/BCIEng/BCIEngJ/ModuleJ.h 23 Apr 2008 03:27:17 -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: src-native/BCI/BCIEng/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 >--- src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbe.cpp 12 Mar 2008 12:36:36 -0000 1.8 >+++ src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbe.cpp 23 Apr 2008 03:27:17 -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: src-native/BCI/BCIEng/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 >--- src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbe.dsp 24 Mar 2006 21:58:56 -0000 1.5 >+++ src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbe.dsp 23 Apr 2008 03:27:32 -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: src-native/BCI/BCIEng/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 >--- src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbe.h 24 Mar 2006 21:58:56 -0000 1.6 >+++ src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbe.h 23 Apr 2008 03:27:17 -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: src-native/BCI/BCIEng/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 >--- src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbeInterface.cpp 24 Mar 2006 21:58:56 -0000 1.6 >+++ src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbeInterface.cpp 23 Apr 2008 03:27:17 -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: src-native/BCI/BCIEng/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 >--- src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbeInterface.h 24 Mar 2006 21:58:56 -0000 1.6 >+++ src-native/BCI/BCIEng/BCIEngProbe/BCIEngProbeInterface.h 23 Apr 2008 03:27:17 -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: src-native/BCI/BCIEng/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 >--- src-native/BCI/BCIEng/BCIEngProbe/ProbeInstrumenter/ProbeInstrumenter.dsp 24 Mar 2006 21:58:56 -0000 1.5 >+++ src-native/BCI/BCIEng/BCIEngProbe/ProbeInstrumenter/ProbeInstrumenter.dsp 23 Apr 2008 03:27:32 -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 >Index: src-native/BCI/Common/CommonDef.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/Common/CommonDef.h,v >retrieving revision 1.10 >diff -U3 -p -r1.10 CommonDef.h >--- src-native/BCI/Common/CommonDef.h 25 Apr 2006 16:16:35 -0000 1.10 >+++ src-native/BCI/Common/CommonDef.h 23 Apr 2008 03:27:17 -0000 >@@ -22,14 +22,13 @@ > // For this header to work, you need to define one of these ARCH symbols: > // > // WIN32 (means x86) >+// IA32_ARCH (means x86) > // IPF_ARCH (means Itanium Processor Family) > // EM64T_ARCH (means Intel/AMD 64-bit processors) >-// IA32_ARCH (means x86) > // SPARC_ARCH > // HPPA_ARCH > // ALPHA_ARCH > // PPC_ARCH >-// LINUX_PPC_ARCH (LINUX PPC64) > // OS390_ARCH (means zSeries) > // AS400_ARCH (means iSeries) > // >@@ -72,10 +71,14 @@ > // This brings _WINDOWS_ into scope. Use _WINDOWS_ to wrap Windows code. > # include <windows.h> /* for lots o' stuff, but esp. _WINDOWS_ */ > # include <malloc.h> /* for alloca */ >-#elif defined(IPF_ARCH) || (EM64T_ARCH) || (LINUX_PPC_ARCH) >+#elif defined(IPF_ARCH) || (EM64T_ARCH) > # include <stdint.h> /* for int64_t and uint64_t */ > #endif > >+/* On LinuxPPC64 we need this to get int64_t */ >+#if defined(PPC_ARCH) >+# include </usr/include/sys/types.h> >+#endif > /* Only on OS400, we need this to get malloc/free */ > #ifdef OS400 > #include <stdlib.h> >@@ -113,15 +116,17 @@ typedef unsigned short WORD, *PWORD; > typedef signed long long int int64_t; > typedef unsigned long long int uint64_t; > #else >-#if defined(_WINDOWS_) >+# if defined(_WINDOWS_) > typedef __int64 int64_t; > typedef unsigned __int64 uint64_t; >-#else >-# if !defined(IPF_ARCH) && !defined(EM64T_ARCH) && !defined(LINUX_PPC_ARCH) // Already being declared in stdint.h >- typedef long long int64_t; >+#elif defined(PPC_ARCH) > typedef unsigned long long uint64_t; >+# else >+# if !defined(IPF_ARCH) && !defined(EM64T_ARCH) >+ typedef long long int64_t; >+ typedef unsigned long long uint64_t; > # endif >-#endif >+# endif > #endif > > //------------------------------------------------------------------------------ >@@ -197,7 +202,7 @@ typedef unsigned short WORD, *PWORD; > /////// > #if defined(WIN32) || defined(IA32_ARCH) || defined(IPF_ARCH) || defined(EM64T_ARCH) || defined(ALPHA_ARCH) > # define BIG_ENDIAN_HW >-#elif defined(SPARC_ARCH) || defined(HPPA_ARCH) || defined(PPC_ARCH) || defined(AS400_ARCH) || defined(OS390_ARCH) || defined(LINUX_PPC_ARCH) >+#elif defined(SPARC_ARCH) || defined(HPPA_ARCH) || defined(PPC_ARCH) || defined(AS400_ARCH) || defined(OS390_ARCH) > # define LITTLE_ENDIAN_HW > #else > # error "Platform-specific configuration required" >Index: src-native/BCI/Common/JavaDef.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/Common/JavaDef.h,v >retrieving revision 1.5 >diff -U3 -p -r1.5 JavaDef.h >--- src-native/BCI/Common/JavaDef.h 24 Mar 2006 22:00:25 -0000 1.5 >+++ src-native/BCI/Common/JavaDef.h 23 Apr 2008 03:27:17 -0000 >@@ -50,6 +50,7 @@ > #define CONSTANT_InterfaceMethodref 11 // Interface method refernce constant > #define CONSTANT_NameAndType 12 // Name and type constant > >+#define CONSTANT_Unknown 0 > // Array types > #define T_BOOLEAN 4 // bool > #define T_CHAR 5 // char >@@ -60,7 +61,21 @@ > #define T_INT 10 // int > #define T_LONG 11 // long > >-#define CONSTANT_Unknown 0 >+// stack map frame types (new in Java 6.0) >+#define SAME_LOCALS_1_STACK_ITEM_EXTENDED 247 >+#define SAME_FRAME_EXTENDED 251 >+#define FULL_FRAME 255 >+ >+// verification types (new in Java 6.0) >+#define ITEM_Top 0 >+#define ITEM_Integer 1 >+#define ITEM_Float 2 >+#define ITEM_Double 3 >+#define ITEM_Long 4 >+#define ITEM_Null 5 >+#define ITEM_UninitializedThis 6 >+#define ITEM_Object 7 >+#define ITEM_Uninitialized 8 > > // ToDo: other Java specific definitions > typedef unsigned char u1; // 1 byte >Index: src-native/BCI/JClass/JClassBuilder.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/JClass/JClassBuilder.cpp,v >retrieving revision 1.5 >diff -U3 -p -r1.5 JClassBuilder.cpp >--- src-native/BCI/JClass/JClassBuilder.cpp 24 Mar 2006 22:00:44 -0000 1.5 >+++ src-native/BCI/JClass/JClassBuilder.cpp 23 Apr 2008 03:27:17 -0000 >@@ -80,7 +80,8 @@ CJClassBuilder::GetThisClassName() > string > CJClassBuilder::GetSuperClassName() > { >- CCPUtf8Info* pcpUtf8 = (CCPUtf8Info*)((*m_pConstPool)[GetSuperClass()]); >+ CCPClassInfo* pccpClassInfo = (CCPClassInfo*)((*m_pConstPool)[GetSuperClass()]); >+ CCPUtf8Info* pcpUtf8 = (CCPUtf8Info*)((*m_pConstPool)[pccpClassInfo->GetClassInd()]); > string strSuperClass = (string)*pcpUtf8; > return strSuperClass; > } >@@ -245,6 +246,7 @@ CJClassBuilder::FindClass(CSTR i_szName) > CConstPool::iterator itr = m_pConstPool->begin(); > while(itr != m_pConstPool->end()) > { >+ if (*itr == NULL) return NULL; > if((*itr)->GetTag() == CONSTANT_Class) > { > CCPClassInfo* pcpci = (CCPClassInfo*)*itr; >@@ -278,6 +280,22 @@ CJClassBuilder::CreateStringConstant(CST > } > > //------------------------------------------------------------------------------ >+// CreateClassConstant >+// In: >+// i_szClassName - class name >+// Returns: >+// CCPClassInfo* - pointer to the class infoin the constant pool >+// >+CCPClassInfo* >+CJClassBuilder::CreateClassConstant(CSTR i_szClassName) >+{ >+ u2 u2ClassName = m_pConstPool->Add(new CCPUtf8Info(i_szClassName)); >+ u2 u2ClassRef = m_pConstPool->Add(new CCPClassInfo(u2ClassName)); >+ CCPClassInfo* pcpClass = (CCPClassInfo*)((*m_pConstPool)[u2ClassRef]); >+ return pcpClass; >+} >+ >+//------------------------------------------------------------------------------ > // CreateIntegerConstant > // In: > // i_int - Integer value to add >Index: src-native/BCI/JClass/JClassBuilder.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/JClass/JClassBuilder.h,v >retrieving revision 1.5 >diff -U3 -p -r1.5 JClassBuilder.h >--- src-native/BCI/JClass/JClassBuilder.h 24 Mar 2006 22:00:45 -0000 1.5 >+++ src-native/BCI/JClass/JClassBuilder.h 23 Apr 2008 03:27:17 -0000 >@@ -62,7 +62,8 @@ public: > > // Constant pool manipulation > CCPStringInfo* CreateStringConstant(CSTR i_szString); >- CCPIntegerInfo* CreateIntegerConstant (JINTEGER i_int); >+ CCPClassInfo* CreateClassConstant(CSTR i_szClassName); >+ CCPIntegerInfo* CreateIntegerConstant (JINTEGER i_int); > CCPLongInfo* CreateLongConstant(JLONG i_long); > CCPFloatInfo* CreateFloatConstant(JFLOAT i_float); > CCPDoubleInfo* CreateDoubleConstant(JDOUBLE i_double); >Index: src-native/BCI/JClass/JClassFile.cpp >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/JClass/JClassFile.cpp,v >retrieving revision 1.7 >diff -U3 -p -r1.7 JClassFile.cpp >--- src-native/BCI/JClass/JClassFile.cpp 10 Apr 2006 03:57:43 -0000 1.7 >+++ src-native/BCI/JClass/JClassFile.cpp 23 Apr 2008 03:27:17 -0000 >@@ -47,8 +47,11 @@ > # include <iostream> > #endif > >+#include "JavaDef.h" > #include "CommonDef.h" >+ > #include "JClassFile.h" >+#include "JMemStream.h" > > USE_NAMESPACE(std); > >@@ -259,8 +262,9 @@ CCPUtf8Info::~CCPUtf8Info() > void > CCPUtf8Info::Read(CJStream& i_jstream) > { >- i_jstream >> m_u2Length; >- m_pu1Bytes = new u1[m_u2Length]; >+ i_jstream >> m_u2Length; >+ m_pu1Bytes = new u1[m_u2Length + 1]; >+ m_pu1Bytes[m_u2Length] = 0; /*Helps standard string functions find end of the string*/ > i_jstream.ReadUtf8((void*)m_pu1Bytes, m_u2Length); > } > >@@ -1738,6 +1742,10 @@ CJAttribs::Read(CJStream& i_jstream) > { > pCurrent = new CLocalVariableTypeTableAttribute(m_pClassFile); > } >+ else if(*pcpUtf8 == "StackMapTable") >+ { >+ pCurrent = new CStackMapTableAttribute(m_pClassFile); >+ } > else if(*pcpUtf8 == "Exceptions") > { > pCurrent = new CExceptionsAttribute(m_pClassFile); >@@ -2119,6 +2127,41 @@ CCodeAttribute::GetLocalVariableTypes() > return NULL; > } > >+//------------------------------------------------------------------------------ >+CStackMapTableAttribute* >+CCodeAttribute::GetStackMaps() >+{ >+ for(CJAttribs::iterator iter = m_Attribs.begin(); iter < m_Attribs.end(); iter++) >+ { >+ if(*(*iter)->GetName() == "StackMapTable") >+ return (CStackMapTableAttribute*)*iter; >+ } >+ return NULL; >+} >+ >+//------------------------------------------------------------------------------ >+CStackMapTableAttribute* >+CCodeAttribute::GetOrCreateStackMaps() >+{ >+ // Return the StackMapTable attribute of this Code attribute, creating a new one >+ // if such an attribute does not exist >+ >+ CStackMapTableAttribute* result = NULL; >+ for(CJAttribs::iterator iter = m_Attribs.begin(); iter < m_Attribs.end(); iter++) >+ { >+ if(*(*iter)->GetName() == "StackMapTable") >+ { >+ result = (CStackMapTableAttribute*)*iter; >+ } >+ } >+ >+ if (result == NULL) >+ { >+ result = new CStackMapTableAttribute(m_pClassFile); >+ m_Attribs.push_back(result); >+ } >+ return result; >+} > > //============================================================================== > // CExceptionsAttribute implementation >@@ -2500,6 +2543,764 @@ CSourceDirAttribute::CSourceDirAttribute > {} > > //============================================================================== >+// CStackMapTableAttribute implementation >+// >+CVerificationTypeInfo::CVerificationTypeInfo(u1 i_u1Tag) >+: m_u1Tag(i_u1Tag) >+{ >+} >+ >+CVerificationTypeInfo::~CVerificationTypeInfo() >+{ >+} >+ >+void >+CVerificationTypeInfo::Read(CJStream& i_jstream) >+{ >+ // m_u1Tag is read by the CVerificationTypes container. >+} >+ >+u2 >+CVerificationTypeInfo::Read(u1 *i_tbl) >+{ >+ // m_u1Tag is read by the CVerificationTypes container. >+ return 0; >+} >+ >+void >+CVerificationTypeInfo::Write(CJStream& i_jstream) const >+{ >+ i_jstream << m_u1Tag; >+} >+ >+u4 >+CVerificationTypeInfo::GetSize() const >+{ >+ return sizeof(m_u1Tag); >+} >+ >+//------------------------------------------------------------------------------ >+CVerificationTypes::~CVerificationTypes() >+{ >+ for (iterator iter = begin(); iter != end(); iter++) >+ { >+ delete *iter; >+ } >+} >+ >+CVerificationTypes::CVerificationTypes(const CVerificationTypes &i_VerTypes) >+{ >+ *this = i_VerTypes; >+} >+ >+CVerificationTypes& >+CVerificationTypes::operator =(const CVerificationTypes &i_VerTypes) >+{ >+ for(iterator iter = begin(); iter != end(); iter++) >+ { >+ delete *iter; >+ } >+ if(!i_VerTypes.empty()) >+ { >+ const_iterator iterIn; >+ clear(); >+ for(iterIn = i_VerTypes.begin(); iterIn != i_VerTypes.end(); iterIn++) >+ { >+ push_back((*iterIn)->Clone()); >+ } >+ } >+ return *this; >+} >+ >+void >+CVerificationTypes::Read(CJStream& i_jstream, u2 i_u2EntriesToRead) >+{ >+ CVerificationTypeInfo* pCurrent; >+ >+ resize(i_u2EntriesToRead); >+ for(u2 u2Ind = 0; u2Ind < i_u2EntriesToRead; u2Ind++) >+ { >+ u1 u1Tag; >+ i_jstream >> u1Tag; >+ switch (u1Tag) >+ { >+ case ITEM_Top: >+ case ITEM_Integer: >+ case ITEM_Float: >+ case ITEM_Double: >+ case ITEM_Long: >+ case ITEM_Null: >+ case ITEM_UninitializedThis: >+ pCurrent = new CVerificationTypeInfo(u1Tag); >+ break; >+ case ITEM_Object: >+ pCurrent = new CVerificationTypeObjectInfo(u1Tag); >+ break; >+ case ITEM_Uninitialized: >+ pCurrent = new CVerificationTypeUninitializedVariableInfo(u1Tag); >+ break; >+ default: >+ throw CJClassFileException(CJClassFileException::X_INTERNAL_ERROR); >+ } >+ >+ pCurrent->Read(i_jstream); >+ (*this)[u2Ind] = pCurrent; >+ } >+} >+ >+void >+CVerificationTypes::Write(CJStream& i_jstream) const >+{ >+ for (u2 u2Ind = 0; u2Ind < size(); u2Ind++) >+ { >+ (*this)[u2Ind]->Write(i_jstream); >+ } >+} >+ >+u4 >+CVerificationTypes::GetSize() const >+{ >+ u4 u4Size = 0; >+ for (const_iterator iter = begin(); iter != end(); iter++) >+ { >+ u4Size += (*iter)->GetSize(); >+ } >+ return u4Size; >+} >+ >+//------------------------------------------------------------------------------ >+CVerificationTypeObjectInfo::CVerificationTypeObjectInfo(u1 i_u1Tag) >+: CVerificationTypeInfo(i_u1Tag) >+{ >+} >+ >+CVerificationTypeObjectInfo::~CVerificationTypeObjectInfo() >+{ >+} >+ >+void >+CVerificationTypeObjectInfo::Read(CJStream& i_jstream) >+{ >+ CVerificationTypeInfo::Read(i_jstream); >+ i_jstream >> m_u2CpoolIndex; >+} >+ >+void >+CVerificationTypeObjectInfo::Write(CJStream& i_jstream) const >+{ >+ CVerificationTypeInfo::Write(i_jstream); >+ i_jstream << m_u2CpoolIndex; >+} >+ >+u4 >+CVerificationTypeObjectInfo::GetSize() const >+{ >+ u4 u4Size = CVerificationTypeInfo::GetSize() >+ + sizeof(m_u2CpoolIndex); >+ return u4Size; >+} >+ >+//------------------------------------------------------------------------------ >+CVerificationTypeUninitializedVariableInfo::CVerificationTypeUninitializedVariableInfo(u1 i_u1Tag) >+: CVerificationTypeInfo(i_u1Tag) >+{ >+} >+ >+CVerificationTypeUninitializedVariableInfo::~CVerificationTypeUninitializedVariableInfo() >+{ >+} >+ >+void >+CVerificationTypeUninitializedVariableInfo::Read(CJStream& i_jstream) >+{ >+ CVerificationTypeInfo::Read(i_jstream); >+ i_jstream >> m_u2Offset; >+} >+ >+void >+CVerificationTypeUninitializedVariableInfo::Write(CJStream& i_jstream) const >+{ >+ CVerificationTypeInfo::Write(i_jstream); >+ i_jstream << m_u2Offset; >+} >+ >+u4 >+CVerificationTypeUninitializedVariableInfo::GetSize() const >+{ >+ u4 u4Size = CVerificationTypeInfo::GetSize() >+ + sizeof(m_u2Offset); >+ return u4Size; >+} >+ >+//------------------------------------------------------------------------------ >+CStackMapFrameInfo::CStackMapFrameInfo(u1 i_u1FrameType) >+: m_u1FrameType(i_u1FrameType) >+{ >+ m_u2ByteCodeOffset = 0; >+ m_u2OffsetDelta = 0; >+} >+ >+CStackMapFrameInfo::~CStackMapFrameInfo() >+{ >+} >+ >+void >+CStackMapFrameInfo::Read(CJStream& i_jstream) >+{ >+ // m_u1FrameType is read by the CStackMapTable container >+} >+ >+void >+CStackMapFrameInfo::Write(CJStream& i_jstream) const >+{ >+ i_jstream << m_u1FrameType; >+} >+ >+u4 >+CStackMapFrameInfo::GetSize() const >+{ >+ return sizeof(m_u1FrameType); >+} >+ >+void >+CStackMapFrameInfo::SetByteCodeOffset(u2 i_u2Offset) >+{ >+ m_u2ByteCodeOffset = i_u2Offset; >+} >+ >+void >+CStackMapFrameInfo::AdjustOffsetDelta(int i_s2PrevFrameOffset) >+{ >+ int newOffsetDelta = m_u2ByteCodeOffset - 1 - i_s2PrevFrameOffset; >+ if (newOffsetDelta < 0) >+ { >+ // Frame order was changed. This is not supported >+ throw CJClassFileException(CJClassFileException::X_INTERNAL_ERROR); >+ } >+ m_u2OffsetDelta = (u2)newOffsetDelta; // this is a safe cast since newDelta >= 1 >+} >+ >+CStackMapFrameInfo::CStackMapFrameInfo(const CStackMapFrameInfo &i_Other) >+: m_u2ByteCodeOffset(i_Other.m_u2ByteCodeOffset), m_u2OffsetDelta(i_Other.m_u2OffsetDelta), >+ m_u1FrameType(i_Other.m_u1FrameType) >+{ >+} >+ >+//------------------------------------------------------------------------------ >+CStackMapSameFrameInfo::CStackMapSameFrameInfo(u1 i_u1FrameType, bool i_IsExtended) >+: CStackMapFrameInfo(i_u1FrameType), m_IsExtended(i_IsExtended) >+{ >+} >+ >+CStackMapSameFrameInfo::~CStackMapSameFrameInfo() >+{ >+} >+ >+void >+CStackMapSameFrameInfo::Read(CJStream& i_jstream) >+{ >+ CStackMapFrameInfo::Read(i_jstream); >+ if (m_IsExtended) >+ { >+ // SAME_FRAME_EXTENDED type >+ i_jstream >> m_u2OffsetDelta; >+ } >+ else >+ { >+ // SAME frame type. offset_delta is stored in the tag >+ m_u2OffsetDelta = GetFrameType(); >+ } >+} >+ >+void >+CStackMapSameFrameInfo::Write(CJStream& i_jstream) const >+{ >+ CStackMapFrameInfo::Write(i_jstream); >+ if (m_IsExtended) >+ { >+ // SAME_FRAME_EXTENDED type >+ i_jstream << m_u2OffsetDelta; >+ } >+} >+ >+u4 >+CStackMapSameFrameInfo::GetSize() const >+{ >+ u4 u4Size = CStackMapFrameInfo::GetSize(); >+ if (m_IsExtended) >+ { >+ u4Size += sizeof(m_u2OffsetDelta); >+ } >+ return u4Size; >+} >+ >+void >+CStackMapSameFrameInfo::AdjustOffsetDelta(int i_s2PrevFrameOffset) >+{ >+ CStackMapFrameInfo::AdjustOffsetDelta(i_s2PrevFrameOffset); >+ if (m_u2OffsetDelta > 63) >+ { >+ // Frame type is SAME_FRAME_EXTENDED >+ m_u1FrameType = SAME_FRAME_EXTENDED; >+ m_IsExtended = true; >+ } >+ else >+ { >+ // Frame type is SAME_FRAME. offset_delta is stored in the tag >+ m_u1FrameType = (u1)m_u2OffsetDelta; // this is safe since m_u2OffsetDelta <= 63 >+ m_IsExtended = false; >+ } >+} >+ >+CStackMapFrameInfo* >+CStackMapSameFrameInfo::Clone() const >+{ >+ return new CStackMapSameFrameInfo(*this); >+} >+ >+//------------------------------------------------------------------------------ >+CStackMapChopFrameInfo::CStackMapChopFrameInfo(u1 i_u1FrameType) >+: CStackMapFrameInfo(i_u1FrameType) >+{ >+} >+ >+CStackMapChopFrameInfo::~CStackMapChopFrameInfo() >+{ >+} >+ >+void >+CStackMapChopFrameInfo::Read(CJStream& i_jstream) >+{ >+ CStackMapFrameInfo::Read(i_jstream); >+ i_jstream >> m_u2OffsetDelta; >+} >+ >+void >+CStackMapChopFrameInfo::Write(CJStream& i_jstream) const >+{ >+ CStackMapFrameInfo::Write(i_jstream); >+ i_jstream << m_u2OffsetDelta; >+} >+ >+u4 >+CStackMapChopFrameInfo::GetSize() const >+{ >+ u4 u4Size = CStackMapFrameInfo::GetSize() >+ + sizeof(m_u2OffsetDelta); >+ return u4Size; >+} >+ >+CStackMapFrameInfo* >+CStackMapChopFrameInfo::Clone() const >+{ >+ return new CStackMapChopFrameInfo(*this); >+} >+ >+//------------------------------------------------------------------------------ >+CStackMapSameLocals1StackItemFrameInfo::CStackMapSameLocals1StackItemFrameInfo(u1 i_u1FrameType, >+ bool i_IsExtended) >+: CStackMapFrameInfo(i_u1FrameType), m_IsExtended(i_IsExtended) >+{ >+} >+ >+CStackMapSameLocals1StackItemFrameInfo::~CStackMapSameLocals1StackItemFrameInfo() >+{ >+} >+ >+void >+CStackMapSameLocals1StackItemFrameInfo::Read(CJStream& i_jstream) >+{ >+ CStackMapFrameInfo::Read(i_jstream); >+ if (m_IsExtended) >+ { >+ // SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED type >+ i_jstream >> m_u2OffsetDelta; >+ } >+ else >+ { >+ // SAME_LOCALS_1_STACK_ITEM_FRAME frame type >+ m_u2OffsetDelta = GetFrameType() - 64; >+ } >+ m_Stack.Read(i_jstream, 1); // must hold exactly one stack item >+} >+ >+void >+CStackMapSameLocals1StackItemFrameInfo::Write(CJStream& i_jstream) const >+{ >+ CStackMapFrameInfo::Write(i_jstream); >+ if (m_IsExtended) >+ { >+ // SAME_FRAME_EXTENDED type >+ i_jstream << m_u2OffsetDelta; >+ } >+ m_Stack.Write(i_jstream); >+} >+ >+u4 >+CStackMapSameLocals1StackItemFrameInfo::GetSize() const >+{ >+ u4 u4Size = CStackMapFrameInfo::GetSize(); >+ if (m_IsExtended) >+ { >+ u4Size += sizeof(m_u2OffsetDelta); >+ } >+ u4Size += m_Stack.GetSize(); >+ return u4Size; >+} >+ >+void >+CStackMapSameLocals1StackItemFrameInfo::AdjustOffsetDelta(int i_s2PrevFrameOffset) >+{ >+ CStackMapFrameInfo::AdjustOffsetDelta(i_s2PrevFrameOffset); >+ if (m_u2OffsetDelta + 64 > 127) >+ { >+ // Frame type is SAME_LOCALS_1_STACK_FRAME_EXTENDED >+ m_u1FrameType = SAME_LOCALS_1_STACK_ITEM_EXTENDED; >+ m_IsExtended = true; >+ } >+ else >+ { >+ // Frame type is SAME_LOCALS_1_STACK_FRAME. offset_delta is stored in the tag >+ m_u1FrameType = (u1)(m_u2OffsetDelta + 64); // this is safe since m_u2OffsetDelta <= 63 >+ m_IsExtended = false; >+ } >+} >+ >+CStackMapFrameInfo* >+CStackMapSameLocals1StackItemFrameInfo::Clone() const >+{ >+ return new CStackMapSameLocals1StackItemFrameInfo(*this); >+} >+ >+CStackMapSameLocals1StackItemFrameInfo::CStackMapSameLocals1StackItemFrameInfo(const CStackMapSameLocals1StackItemFrameInfo &i_Other) >+: CStackMapFrameInfo(i_Other), m_Stack(i_Other.m_Stack), m_IsExtended(i_Other.m_IsExtended) >+{ >+} >+ >+//------------------------------------------------------------------------------ >+CStackMapAppendFrameInfo::CStackMapAppendFrameInfo(u1 i_u1FrameType) >+: CStackMapFrameInfo(i_u1FrameType) >+{ >+} >+ >+CStackMapAppendFrameInfo::~CStackMapAppendFrameInfo() >+{ >+} >+ >+void >+CStackMapAppendFrameInfo::Read(CJStream& i_jstream) >+{ >+ CStackMapFrameInfo::Read(i_jstream); >+ i_jstream >> m_u2OffsetDelta; >+ m_Locals.Read(i_jstream, GetFrameType() - 251); >+} >+ >+void >+CStackMapAppendFrameInfo::Write(CJStream& i_jstream) const >+{ >+ CStackMapFrameInfo::Write(i_jstream); >+ i_jstream << m_u2OffsetDelta; >+ m_Locals.Write(i_jstream); >+} >+ >+u4 >+CStackMapAppendFrameInfo::GetSize() const >+{ >+ u4 u4Size = CStackMapFrameInfo::GetSize() >+ + sizeof(m_u2OffsetDelta) >+ + m_Locals.GetSize(); >+ return u4Size; >+} >+ >+CStackMapFrameInfo* >+CStackMapAppendFrameInfo::Clone() const >+{ >+ return new CStackMapAppendFrameInfo(*this); >+} >+ >+CStackMapAppendFrameInfo::CStackMapAppendFrameInfo(const CStackMapAppendFrameInfo &i_Other) >+: CStackMapFrameInfo(i_Other), m_Locals(i_Other.m_Locals) >+{ >+} >+ >+//------------------------------------------------------------------------------ >+CStackMapFullFrameInfo::CStackMapFullFrameInfo(u1 i_u1FrameType) >+: CStackMapFrameInfo(i_u1FrameType), m_u2NumberOfLocals(0), m_u2NumberOfStackItems(0) >+{ >+} >+ >+CStackMapFullFrameInfo::~CStackMapFullFrameInfo() >+{ >+} >+ >+void >+CStackMapFullFrameInfo::Read(CJStream& i_jstream) >+{ >+ CStackMapFrameInfo::Read(i_jstream); >+ i_jstream >> m_u2OffsetDelta >+ >> m_u2NumberOfLocals; >+ m_Locals.Read(i_jstream, m_u2NumberOfLocals); >+ i_jstream >> m_u2NumberOfStackItems; >+ m_Stack.Read(i_jstream, m_u2NumberOfStackItems); >+} >+ >+void >+CStackMapFullFrameInfo::Write(CJStream& i_jstream) const >+{ >+ CStackMapFrameInfo::Write(i_jstream); >+ i_jstream << m_u2OffsetDelta >+ << m_u2NumberOfLocals; >+ m_Locals.Write(i_jstream); >+ i_jstream << m_u2NumberOfStackItems; >+ m_Stack.Write(i_jstream); >+} >+ >+u4 >+CStackMapFullFrameInfo::GetSize() const >+{ >+ u4 u4Size = CStackMapFrameInfo::GetSize() >+ + sizeof(m_u2OffsetDelta) >+ + sizeof(m_u2NumberOfLocals) >+ + m_Locals.GetSize() >+ + sizeof(m_u2NumberOfStackItems) >+ + m_Stack.GetSize(); >+ return u4Size; >+} >+ >+CStackMapFrameInfo* >+CStackMapFullFrameInfo::Clone() const >+{ >+ return new CStackMapFullFrameInfo(*this); >+} >+ >+CStackMapFullFrameInfo::CStackMapFullFrameInfo(const CStackMapFullFrameInfo &i_Other) >+: CStackMapFrameInfo(i_Other), m_Locals(i_Other.m_Locals), m_Stack(i_Other.m_Stack), >+ m_u2NumberOfLocals(i_Other.m_u2NumberOfLocals), >+ m_u2NumberOfStackItems(i_Other.m_u2NumberOfStackItems) >+{ >+} >+ >+//------------------------------------------------------------------------------ >+CStackMapTable::~CStackMapTable() >+{ >+ for (iterator iter = begin(); iter != end(); iter++) >+ { >+ delete *iter; >+ } >+} >+ >+void >+CStackMapTable::Read(CJStream& i_jstream) >+{ >+ u2 u2Size; >+ CStackMapFrameInfo* pCurrent; >+ int s2PrevFrameOffset = -1; >+ >+ i_jstream >> u2Size; >+ resize(u2Size); >+ for(u2 u2Ind = 0; u2Ind < u2Size; u2Ind++) >+ { >+ u1 u1FrameType; >+ i_jstream >> u1FrameType; >+ if (u1FrameType >= 0 && u1FrameType <= 63) >+ { >+ pCurrent = new CStackMapSameFrameInfo(u1FrameType, false); >+ } >+ else if (u1FrameType >= 64 && u1FrameType <= 127) >+ { >+ pCurrent = new CStackMapSameLocals1StackItemFrameInfo(u1FrameType, false); >+ } >+ else if (u1FrameType == SAME_LOCALS_1_STACK_ITEM_EXTENDED) >+ { >+ pCurrent = new CStackMapSameLocals1StackItemFrameInfo(u1FrameType, true); >+ } >+ else if (u1FrameType >= 248 && u1FrameType <= 250) >+ { >+ pCurrent = new CStackMapChopFrameInfo(u1FrameType); >+ } >+ else if (u1FrameType == SAME_FRAME_EXTENDED) >+ { >+ pCurrent = new CStackMapSameFrameInfo(u1FrameType, true); >+ } >+ else if (u1FrameType >= 252 && u1FrameType <= 254) >+ { >+ pCurrent = new CStackMapAppendFrameInfo(u1FrameType); >+ } >+ else if (u1FrameType == FULL_FRAME) >+ { >+ pCurrent = new CStackMapFullFrameInfo(u1FrameType); >+ } >+ else >+ { >+ // Unknown frame type >+ throw CJClassFileException(CJClassFileException::X_INTERNAL_ERROR); >+ } >+ >+ pCurrent->Read(i_jstream); >+ pCurrent->SetByteCodeOffset(s2PrevFrameOffset + 1 + pCurrent->m_u2OffsetDelta); >+ (*this)[u2Ind] = pCurrent; >+ s2PrevFrameOffset = pCurrent->GetByteCodeOffset(); >+ } >+} >+ >+void >+CStackMapTable::AdjustOffsetDeltas() >+{ >+ // Recalculate offset deltas for all frames. This function must be called before >+ // writing the Stack Map Table to the class file or calculating its size >+ CStackMapFrameInfo* pCurrent; >+ int s2PrevFrameOffset = -1; >+ >+ for (u2 u2Ind = 0; u2Ind < size(); u2Ind++) >+ { >+ pCurrent = (*this)[u2Ind]; >+ pCurrent->AdjustOffsetDelta(s2PrevFrameOffset); >+ s2PrevFrameOffset = pCurrent->GetByteCodeOffset(); >+ } >+} >+ >+CStackMapFrameInfo* >+CStackMapTable::GetFrameAtOffset(u2 i_u2Offset) >+{ >+ bool found = false; >+ iterator it = begin(); >+ for (; it != end(); ++it) >+ { >+ if ((*it)->GetByteCodeOffset() == i_u2Offset) >+ { >+ found = true; >+ break; >+ } >+ } >+ >+ if (found) >+ { >+ return (*it); >+ } >+ else >+ { >+ return NULL; >+ } >+} >+ >+void >+CStackMapTable::Write(CJStream& i_jstream) const >+{ >+ i_jstream << (u2)size(); // the number_of_entries field >+ >+ CStackMapFrameInfo* pCurrent; >+ int s2PrevFrameOffset = -1; >+ >+ for (u2 u2Ind = 0; u2Ind < size(); u2Ind++) >+ { >+ pCurrent = (*this)[u2Ind]; >+ pCurrent->Write(i_jstream); >+ s2PrevFrameOffset = pCurrent->GetByteCodeOffset(); >+ } >+} >+ >+u4 >+CStackMapTable::GetSize() const >+{ >+ u4 u4Size = sizeof(u2); // the number_of_entries field >+ for (const_iterator iter = begin(); iter != end(); iter++) >+ { >+ u4Size += (*iter)->GetSize(); >+ } >+ return u4Size; >+} >+ >+CStackMapTable& >+CStackMapTable::operator = (const CStackMapTable& i_StackMaps) >+{ >+ for(iterator iter = begin(); iter != end(); iter++) >+ { >+ delete *iter; >+ } >+ if(!i_StackMaps.empty()) >+ { >+ const_iterator iterIn; >+ clear(); >+ for(iterIn = i_StackMaps.begin(); iterIn != i_StackMaps.end(); iterIn++) >+ { >+ push_back((*iterIn)->Clone()); >+ } >+ } >+ return *this; >+} >+ >+//------------------------------------------------------------------------------ >+CStackMapTableAttribute::CStackMapTableAttribute(CJClassFile* i_pClassFile) >+: CAttributeInfo(i_pClassFile) >+{ >+ u2 u2NameInd = i_pClassFile->GetConstPool()->Add(new CCPUtf8Info("StackMapTable")); >+ m_u2NameInd = u2NameInd; >+ m_StackMapTable.clear(); >+} >+ >+CStackMapTableAttribute::~CStackMapTableAttribute() >+{ >+} >+ >+void >+CStackMapTableAttribute::Read(CJStream& i_jstream) >+{ >+ CAttributeInfo::Read(i_jstream); >+ m_StackMapTable.Read(i_jstream); >+} >+ >+void >+CStackMapTableAttribute::Write(CJStream& i_jstream) const >+{ >+ const u4 u4Length = GetLength() - CAttributeInfo::SizeOf(); >+ i_jstream << m_u2NameInd >+ << u4Length; >+ m_StackMapTable.Write(i_jstream); >+} >+ >+u4 >+CStackMapTableAttribute::GetSize() const >+{ >+ return GetLength(); >+} >+ >+u4 >+CStackMapTableAttribute::GetLength() const >+{ >+ u4 u4Length = CAttributeInfo::SizeOf() >+ + m_StackMapTable.GetSize(); >+ return u4Length; >+} >+ >+void >+CStackMapTableAttribute::RereadFromBuffer(u1 *i_u1Tbl) >+{ >+ u2 u2skip = 0; >+ u4 u4attributeLenght = 0; >+ >+ if (i_u1Tbl == NULL) return; >+ >+ u2skip = i_u1Tbl[0]; >+ u2skip <<= 8; >+ u2skip |= i_u1Tbl[1]; >+ >+ u4attributeLenght = i_u1Tbl[2]; >+ u4attributeLenght <<= 8; >+ u4attributeLenght |= i_u1Tbl[3]; >+ u4attributeLenght <<= 8; >+ u4attributeLenght |= i_u1Tbl[4]; >+ u4attributeLenght <<= 8; >+ u4attributeLenght |= i_u1Tbl[5]; >+ m_u4Length = u4attributeLenght; >+ CJMemStream memstream; >+ memstream.Open(&i_u1Tbl[2], u4attributeLenght >+ + sizeof(u2) /*part of attribute header (its length)*/ >+ + 2 /*workaround for end buffer checking*/); >+ CJStream mem_jstream(&memstream); >+ //GetStackMapTable().RereadFromBuffer(&i_u1Tbl[6]); >+ this->Read(mem_jstream); >+} >+//============================================================================== > // CJClassFile implementation > // > >@@ -2544,12 +3345,8 @@ CJClassFile::Read(CJStream& i_jstream) > { > throw CJClassFileException(CJClassFileException::X_BAD_MAGIC); > } >- i_jstream >> m_u2MajorVersion; >- if(CJClassFile::MajorVersion < m_u2MajorVersion) >- { >- throw CJClassFileException(CJClassFileException::X_BAD_VERSION); >- } > i_jstream >> m_u2MinorVersion; >+ i_jstream >> m_u2MajorVersion; > m_pConstPool->Read(i_jstream); > i_jstream >> m_u2AccessFlags > >> m_u2ThisClass >@@ -2565,8 +3362,8 @@ void > CJClassFile::Write(CJStream& i_jstream) const > { > i_jstream << m_u4Magic >- << m_u2MajorVersion >- << m_u2MinorVersion; >+ << m_u2MinorVersion >+ << m_u2MajorVersion; > m_pConstPool->Write(i_jstream); > i_jstream << m_u2AccessFlags > << m_u2ThisClass >Index: src-native/BCI/JClass/JClassFile.h >=================================================================== >RCS file: /cvsroot/tptp/platform/org.eclipse.hyades.probekit/src-native/BCI/JClass/JClassFile.h,v >retrieving revision 1.7 >diff -U3 -p -r1.7 JClassFile.h >--- src-native/BCI/JClass/JClassFile.h 10 Apr 2006 03:57:43 -0000 1.7 >+++ src-native/BCI/JClass/JClassFile.h 23 Apr 2008 03:27:17 -0000 >@@ -82,6 +82,7 @@ class CExceptionsAttribute; > class CLineNumberTableAttribute; > class CLocalVariableTableAttribute; > class CLocalVariableTypeTableAttribute; >+class CStackMapTableAttribute; > > //------------------------------------------------------------------------------ > // Container classes >@@ -672,6 +673,9 @@ public: > CLineNumberTableAttribute* GetLineNumbers(); > CLocalVariableTableAttribute* GetLocalVariables(); > CLocalVariableTypeTableAttribute* GetLocalVariableTypes(); >+ CStackMapTableAttribute* GetStackMaps(); >+ CStackMapTableAttribute* GetOrCreateStackMaps(); >+ > > protected: > u2 m_u2MaxStack; >@@ -899,6 +903,289 @@ private: > }; > > //------------------------------------------------------------------------------ >+// Verification Type Information (new in Java 6) >+// >+// Represents the following verification types: Top, Integer, Float, Double, Long, Null, >+// UninitializedThis >+// >+class CVerificationTypeInfo >+{ >+public: >+ CVerificationTypeInfo(u1 i_u1Tag); >+ ~CVerificationTypeInfo(); >+ virtual void Read(CJStream& i_jstream); >+ virtual u2 Read(u1* i_tbl); >+ virtual void Write(CJStream& i_jstream) const; >+ virtual u4 GetSize() const; >+ virtual CVerificationTypeInfo* Clone() const >+ { >+ return new CVerificationTypeInfo(*this); >+ } >+ >+ u1 GetTag() { return m_u1Tag; } >+ >+private: >+ u1 m_u1Tag; >+}; >+ >+//------------------------------------------------------------------------------ >+// Verification Type Information Vector >+// >+class CVerificationTypes : public vector<CVerificationTypeInfo*> >+{ >+public: >+ CVerificationTypes() { clear(); } >+ CVerificationTypes(const CVerificationTypes &i_VerTypes); >+ ~CVerificationTypes(); >+ >+ CVerificationTypes& operator = (const CVerificationTypes &i_VerTypes); >+ >+ virtual void Read(CJStream& i_jstream, u2 i_u2EntriesToRead); >+ virtual void Write(CJStream& i_jstream) const; >+ virtual u4 GetSize() const; >+ >+private: >+}; >+ >+//------------------------------------------------------------------------------ >+// Verification Type Information: Object (new in Java 6) >+// >+class CVerificationTypeObjectInfo : public CVerificationTypeInfo >+{ >+public: >+ CVerificationTypeObjectInfo(u1 i_u1Tag); >+ ~CVerificationTypeObjectInfo(); >+ virtual void Read(CJStream& i_jstream); >+ virtual void Write(CJStream& i_jstream) const; >+ virtual u4 GetSize() const; >+ virtual CVerificationTypeInfo* Clone() const >+ { >+ return new CVerificationTypeObjectInfo(*this); >+ } >+ >+ u2 GetCpoolIndex() { return m_u2CpoolIndex; } >+ void SetCpoolIndex(u2 i_u2CpoolIndex) { m_u2CpoolIndex = i_u2CpoolIndex; } >+ >+private: >+ u2 m_u2CpoolIndex; >+}; >+ >+//------------------------------------------------------------------------------ >+// Verification Type Information: Uninitialized Variable (new in Java 6) >+// >+class CVerificationTypeUninitializedVariableInfo : public CVerificationTypeInfo >+{ >+public: >+ CVerificationTypeUninitializedVariableInfo(u1 i_u1Tag); >+ ~CVerificationTypeUninitializedVariableInfo(); >+ virtual void Read(CJStream& i_jstream); >+ virtual void Write(CJStream& i_jstream) const; >+ virtual u4 GetSize() const; >+ virtual CVerificationTypeInfo* Clone() const >+ { >+ return new CVerificationTypeUninitializedVariableInfo(*this); >+ } >+ >+ u2 GetOffset() { return m_u2Offset; } >+ void SetOffset(u2 i_u2Offset) { m_u2Offset = i_u2Offset; } >+ >+private: >+ u2 m_u2Offset; >+}; >+ >+ >+//------------------------------------------------------------------------------ >+// Stack Map Frame Information (new in Java 6) >+// >+class CStackMapFrameInfo >+{ >+ friend class CStackMapTable; >+public: >+ CStackMapFrameInfo(u1 i_u1FrameType); >+ CStackMapFrameInfo(const CStackMapFrameInfo &i_Other); >+ ~CStackMapFrameInfo(); >+ >+ virtual void Read(CJStream& i_jstream); >+ virtual void Write(CJStream& i_jstream) const; >+ virtual u4 GetSize() const; >+ virtual CStackMapFrameInfo* Clone() const = 0; >+ >+ u1 GetFrameType() const { return m_u1FrameType; } >+ u2 GetByteCodeOffset() { return m_u2ByteCodeOffset; } >+ void SetByteCodeOffset(u2 i_u2Offset); >+ >+protected: >+ virtual void AdjustOffsetDelta(int i_s2PrevFrameOffset); >+ >+ u2 m_u2ByteCodeOffset; >+ u2 m_u2OffsetDelta; >+ u1 m_u1FrameType; >+}; >+ >+//------------------------------------------------------------------------------ >+// Stack Map Frame Information: same_frame and same_frame_extended (new in Java 6) >+// >+class CStackMapSameFrameInfo : public CStackMapFrameInfo >+{ >+ friend class CStackMapTable; >+public: >+ CStackMapSameFrameInfo(u1 i_u1FrameType, bool i_IsExtended); >+ ~CStackMapSameFrameInfo(); >+ >+ virtual void Read(CJStream& i_jstream); >+ virtual void Write(CJStream& i_jstream) const; >+ virtual u4 GetSize() const; >+ virtual CStackMapFrameInfo* Clone() const; >+ >+protected: >+ virtual void AdjustOffsetDelta(int i_s2PrevFrameOffset); >+ >+private: >+ bool m_IsExtended; >+}; >+ >+//------------------------------------------------------------------------------ >+// Stack Map Frame Information: chop_frame (new in Java 6) >+// >+class CStackMapChopFrameInfo : public CStackMapFrameInfo >+{ >+public: >+ CStackMapChopFrameInfo(u1 i_u1FrameType); >+ ~CStackMapChopFrameInfo(); >+ >+ virtual void Read(CJStream& i_jstream); >+ virtual void Write(CJStream& i_jstream) const; >+ virtual u4 GetSize() const; >+ virtual CStackMapFrameInfo* Clone() const; >+ >+private: >+}; >+ >+//------------------------------------------------------------------------------ >+// Stack Map Frame Information: same_locals_1_stack_item_frame and >+// same_locals_1_stack_item_frame_extended (new in Java 6) >+// >+class CStackMapSameLocals1StackItemFrameInfo : public CStackMapFrameInfo >+{ >+ friend class CStackMapTable; >+public: >+ CStackMapSameLocals1StackItemFrameInfo(u1 i_u1FrameType, bool i_IsExtended); >+ CStackMapSameLocals1StackItemFrameInfo(const CStackMapSameLocals1StackItemFrameInfo &i_Other); >+ ~CStackMapSameLocals1StackItemFrameInfo(); >+ >+ virtual void Read(CJStream& i_jstream); >+ virtual void Write(CJStream& i_jstream) const; >+ virtual u4 GetSize() const; >+ virtual CStackMapFrameInfo* Clone() const; >+ >+ CVerificationTypes& GetStack() { return m_Stack; } >+ >+protected: >+ virtual void AdjustOffsetDelta(int i_s2PrevFrameOffset); >+ >+private: >+ CStackMapSameLocals1StackItemFrameInfo& operator = (CStackMapSameLocals1StackItemFrameInfo &i_Other); >+ >+ CVerificationTypes m_Stack; // A vector with 1 entry >+ bool m_IsExtended; >+}; >+ >+//------------------------------------------------------------------------------ >+// Stack Map Frame Information: append_frame (new in Java 6) >+// >+class CStackMapAppendFrameInfo : public CStackMapFrameInfo >+{ >+public: >+ CStackMapAppendFrameInfo(u1 i_u1FrameType); >+ CStackMapAppendFrameInfo(const CStackMapAppendFrameInfo &i_Other); >+ ~CStackMapAppendFrameInfo(); >+ >+ virtual void Read(CJStream& i_jstream); >+ virtual void Write(CJStream& i_jstream) const; >+ virtual u4 GetSize() const; >+ virtual CStackMapFrameInfo* Clone() const; >+ >+ CVerificationTypes& GetLocals() { return m_Locals; } >+ >+private: >+ CStackMapAppendFrameInfo& operator = (const CStackMapAppendFrameInfo &i_Other); >+ >+ CVerificationTypes m_Locals; >+}; >+ >+//------------------------------------------------------------------------------ >+// Stack Map Frame Information: full_frame (new in Java 6) >+// >+class CStackMapFullFrameInfo : public CStackMapFrameInfo >+{ >+public: >+ CStackMapFullFrameInfo(u1 i_u1FrameType); >+ CStackMapFullFrameInfo(const CStackMapFullFrameInfo &i_Other); >+ ~CStackMapFullFrameInfo(); >+ >+ virtual void Read(CJStream& i_jstream); >+ virtual void Write(CJStream& i_jstream) const; >+ virtual u4 GetSize() const; >+ virtual CStackMapFrameInfo* Clone() const; >+ >+ CVerificationTypes& GetLocals() { return m_Locals; } >+ CVerificationTypes& GetStack() { return m_Stack; } >+ >+private: >+ CStackMapFullFrameInfo& operator = (const CStackMapFullFrameInfo &i_Other); >+ >+ u2 m_u2NumberOfLocals; >+ CVerificationTypes m_Locals; >+ u2 m_u2NumberOfStackItems; >+ CVerificationTypes m_Stack; >+}; >+ >+ >+//------------------------------------------------------------------------------ >+// Stack Map Table (new in Java 6) >+// >+class CStackMapTable : public vector<CStackMapFrameInfo*> >+{ >+public: >+ CStackMapTable() { clear(); } >+ ~CStackMapTable(); >+ virtual void Read(CJStream& i_jstream); >+ virtual void Write(CJStream& i_jstream) const; >+ virtual u4 GetSize() const; >+ >+ void AdjustOffsetDeltas(); >+ CStackMapFrameInfo* GetFrameAtOffset(u2 i_u2Offset); >+ >+ CStackMapTable& operator = (const CStackMapTable& i_StackMaps); >+}; >+ >+//------------------------------------------------------------------------------ >+// Stack Map Table Attribute (new in Java 6 - [4.8.4]) >+// >+class CStackMapTableAttribute : public CAttributeInfo >+{ >+ friend class CStackMapTable; >+public: >+ CStackMapTableAttribute(CJClassFile* i_pClassFile); >+ ~CStackMapTableAttribute(); >+ virtual void Read(CJStream& i_jstream); >+ virtual void Write(CJStream& i_jstream) const; >+ virtual u4 GetSize() const; >+ virtual u4 GetLength() const; >+ >+ CStackMapTable& GetStackMapTable() { return m_StackMapTable; } >+ void SetStackMapTable(const CStackMapTable& i_stackmap) {m_StackMapTable = i_stackmap;} >+ void RereadFromBuffer(u1 *i_u1Tbl); >+ >+private: >+ CStackMapTable m_StackMapTable; >+ >+ // Disable assignment operator. >+ // To enable, implement these functions as public >+ CStackMapTableAttribute& operator = (const CStackMapTableAttribute& i_other) {} >+}; >+ >+//------------------------------------------------------------------------------ > // Interface information > // > class CInterfaceInfo >@@ -999,6 +1286,7 @@ public: > virtual u4 GetSize() const; > > u2 GetAccessFlags() {return m_u2AccessFlags;} >+ void SetAccessFlags(u2 i_u2AccessFlags) {m_u2AccessFlags = i_u2AccessFlags;} > u2 GetNameInd() const {return m_u2NameInd;} > u2 GetDescriptorInd() const {return m_u2DescriptorInd;} > CJAttribs& GetAttribs() {return m_Attribs;} >@@ -1070,7 +1358,7 @@ public: > class CJClassFile > { > public: >- enum {MajorVersion = 3, MinorVersion = 46}; // TODO: comment on version >+ enum {MajorVersion = 46, MinorVersion = 3}; // J2SE 1.2 > CJClassFile(); > virtual ~CJClassFile(); >
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