Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 148629 | Differences between
and this patch

Collapse All | Expand All

(-)src-native/src/Martini/Include/JIE.h (+3 lines)
Lines 584-589 namespace JIE Link Here
584
         */
584
         */
585
        virtual IJavaClass *GetClassInterface(const unsigned char *pucClassFile,
585
        virtual IJavaClass *GetClassInterface(const unsigned char *pucClassFile,
586
                                              unsigned int uiClassSize) const = 0;
586
                                              unsigned int uiClassSize) const = 0;
587
588
        virtual void EnableStackMapCalculation() const = 0;
589
587
    };
590
    };
588
591
589
    /**
592
    /**
(-)src-native/src/Martini/Infrastructure/CGAdaptor/.cvsignore (+1 lines)
Line 1 Link Here
1
debug
1
debug
2
CGAdaptor.plg
(-)src-native/src/Martini/Infrastructure/CGAdaptor/CGAdaptor.cpp (-11 / +62 lines)
Lines 17-22 Link Here
17
#include "HeapProxy.h"
17
#include "HeapProxy.h"
18
#include "ThreadProxy.h"
18
#include "ThreadProxy.h"
19
#include "ValidityChecks.h"
19
#include "ValidityChecks.h"
20
#include "MRTEInfrastructureDefinitions.h"
20
21
21
#include <assert.h>
22
#include <assert.h>
22
#include <string.h>
23
#include <string.h>
Lines 378-384 TResult CCGAdaptor::DoCallGraphInstrumen Link Here
378
    // If no methods were instrumented, modify the return code to indicate this
379
    // If no methods were instrumented, modify the return code to indicate this
379
    if (MRTE_SUCCEEDED(res) && instrMethodCount == 0)
380
    if (MRTE_SUCCEEDED(res) && instrMethodCount == 0)
380
    {
381
    {
381
        LOG_INFORMATIVE1("CGAdaptor", 3, false, "Class %s was not instrumented because all its methods were excluded", 
382
        LOG_INFORMATIVE1("CGAdaptor", 3, false, 
383
            "Class %s was not instrumented because all its methods were excluded", 
382
            classInfo.szClassName);
384
            classInfo.szClassName);
383
        res = MRTE_ERROR_INSTRUMENTATION_NOT_NEEDED;
385
        res = MRTE_ERROR_INSTRUMENTATION_NOT_NEEDED;
384
    }
386
    }
Lines 681-687 TResult CCGAdaptor::InstrumentMethod(IJa Link Here
681
    }
683
    }
682
684
683
    res = InjectEpilogCode(pMethod, pInstructionsIter, pOriginalFirstInstr, isJVMInitVar, 
685
    res = InjectEpilogCode(pMethod, pInstructionsIter, pOriginalFirstInstr, isJVMInitVar, 
684
        cpMethodId, cpLeaveCallback, bJVMInitDone);
686
        cpMethodId, cpLeaveCallback, bJVMInitDone,
687
        IsConstructor(pInfo->szName));
688
    if (MRTE_RESULT_OK != res)
689
    {
690
        return res;
691
    }
685
692
686
    pInstructionsIter->Free();
693
    pInstructionsIter->Free();
687
    res = pMethod->ApplyInstrumentation();
694
    res = pMethod->ApplyInstrumentation();
Lines 837-843 TResult CCGAdaptor::InjectEpilogCode(IJa Link Here
837
                                     TVariableID isJVMInitVar,
844
                                     TVariableID isJVMInitVar,
838
                                     TConstantPoolIndex cpiMethodId,
845
                                     TConstantPoolIndex cpiMethodId,
839
                                     TConstantPoolIndex cpiLeaveCallback,
846
                                     TConstantPoolIndex cpiLeaveCallback,
840
                                     bool bJVMInitDone)
847
                                     bool bJVMInitDone,
848
                                     bool bIsConstructor)
841
{
849
{
842
    TResult res;
850
    TResult res;
843
851
Lines 899-906 TResult CCGAdaptor::InjectEpilogCode(IJa Link Here
899
    // whether the method terminates normally or abnormally
907
    // whether the method terminates normally or abnormally
900
908
901
    IInstruction *pStartTry;
909
    IInstruction *pStartTry;
902
    pInstructionsIter->GetFirst();
910
    if (bIsConstructor)
903
    pStartTry = pOriginalFirstMethodInst;
911
    {
912
        // The instrumented method is a constructor. The protected block should start
913
        // only after the call to the constructor of the superclass to prevent
914
        // verification issues (see https://bugs.eclipse.org/170075)
915
        pStartTry = pInstructionsIter->GetFirst();
916
        while (pStartTry != pOriginalFirstMethodInst && pStartTry != NULL)
917
        {
918
            pStartTry = pInstructionsIter->GetNext();
919
        }
920
        if (NULL == pStartTry)
921
        {
922
            LOG_INFORMATIVE("CGAdaptor", 0, false, 
923
                "Cannot find the first instruction of the method");
924
            return MRTE_ERROR_FAIL;
925
        }
926
927
        // Since this is a constructor, it is expected to start with an invocation of the
928
        // super-constructor, i.e., :
929
        // aload_0                  ; load 'this' to stack
930
        // invokespecial <ctor>     ; invoke super-constructor
931
        //
932
        // If this is not the case (may happen for generated or instrumented code) the
933
        // constructor will not be instrumented
934
        bool ok = false;
935
        if (pStartTry->GetMnemonic() == MNM_ALOAD_0)
936
        {
937
            pStartTry = pInstructionsIter->GetNext();
938
            if (pStartTry->GetMnemonic() == MNM_INVOKESPECIAL)
939
            {
940
                // Assume this is the construction invocation
941
                pStartTry = pInstructionsIter->GetNext();
942
                ok = true;
943
            }
944
        }
945
        if (!ok)
946
        {
947
            LOG_INFORMATIVE("CGAdaptor", 0, false, 
948
                "Constructor method does not start with invocation of super-constructor. "
949
                "Method will not be instrumented");
950
            return MRTE_ERROR_UNABLE_TO_INSTRUMENT;
951
        }
952
953
    }
954
    else
955
    {
956
        // Regular method. The protected block spans the entire (original) method code
957
        pStartTry = pOriginalFirstMethodInst;
958
    }
904
    res = pMethod->BindTryFinallyBlock(pStartTry, pLastMethodInstruction,
959
    res = pMethod->BindTryFinallyBlock(pStartTry, pLastMethodInstruction,
905
        pFirstInstInFinally, pLastInstInFinally);
960
        pFirstInstInFinally, pLastInstInFinally);
906
961
Lines 953-964 TResult CCGAdaptor::AddAlreadyInvokedFie Link Here
953
    return MRTE_RESULT_OK;
1008
    return MRTE_RESULT_OK;
954
}
1009
}
955
1010
956
/*
1011
bool CCGAdaptor::IsConstructor(const char *szMethodName)
957
bool CCGAdaptor::IsConstructor(const SJavaMethodInfo &methodInfo)
958
{
1012
{
959
    bool bIsCtor;
1013
    bool bIsCtor;
960
    char *szName = CWideStringUtils::WideStringToCString(methodInfo.methodName);
1014
    if (strcmp(szMethodName, JAVA_INSTANCE_CONSTRUCTOR_NAME) == 0)
961
    if (strcmp(szName, JAVA_INSTANCE_CONSTRUCTOR_NAME) == 0)
962
    {
1015
    {
963
        bIsCtor = true;
1016
        bIsCtor = true;
964
    }
1017
    }
Lines 966-975 bool CCGAdaptor::IsConstructor(const SJa Link Here
966
    {
1019
    {
967
        bIsCtor = false;
1020
        bIsCtor = false;
968
    }
1021
    }
969
    delete szName;
970
    return bIsCtor;
1022
    return bIsCtor;
971
}
1023
}
972
*/
973
1024
974
bool CCGAdaptor::IsProblematicMethod(const char *szClassName, 
1025
bool CCGAdaptor::IsProblematicMethod(const char *szClassName, 
975
                                     const char *szMethodName)
1026
                                     const char *szMethodName)
(-)src-native/src/Martini/Infrastructure/CGAdaptor/CGAdaptor.dsp (-1 / +1 lines)
Lines 75-81 LINK32=link.exe Link Here
75
# PROP Target_Dir ""
75
# PROP Target_Dir ""
76
F90=df.exe
76
F90=df.exe
77
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CGADAPTOR_EXPORTS" /YX /FD /GZ /c
77
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CGADAPTOR_EXPORTS" /YX /FD /GZ /c
78
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "WIN32" /D "_DEBUG" /D "IA32_ARCH" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CGADAPTOR_EXPORTS" /D "MARTINI_JIE" /FR /YX /FD /GZ /c
78
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "WIN32" /D "_DEBUG" /D "IA32_ARCH" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "CGADAPTOR_EXPORTS" /D "MARTINI_JIE" /FR /YX /FD /GZ /c
79
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
79
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
80
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
80
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
81
# ADD BASE RSC /l 0x409 /d "_DEBUG"
81
# ADD BASE RSC /l 0x409 /d "_DEBUG"
(-)src-native/src/Martini/Infrastructure/Include/CGAdaptor.h (-2 / +3 lines)
Lines 125-131 namespace Martini { namespace CGAdaptor Link Here
125
                                 MIE::TVariableID isJVMInitVar,
125
                                 MIE::TVariableID isJVMInitVar,
126
                                 JIE::TConstantPoolIndex cpiMethodId,
126
                                 JIE::TConstantPoolIndex cpiMethodId,
127
                                 JIE::TConstantPoolIndex cpiLeaveCallback,
127
                                 JIE::TConstantPoolIndex cpiLeaveCallback,
128
                                 bool bJVMInitDone);
128
                                 bool bJVMInitDone,
129
                                 bool bIsConstructor);
129
130
130
        // Adds a static private boolean field to the specified Java class
131
        // Adds a static private boolean field to the specified Java class
131
        // which is used to determine whether a method was called for the first time
132
        // which is used to determine whether a method was called for the first time
Lines 134-140 namespace Martini { namespace CGAdaptor Link Here
134
                                                MPI::TId methodMPIId);
135
                                                MPI::TId methodMPIId);
135
136
136
        bool IsProblematicMethod(const char *szClassName, const char *szMethodName);
137
        bool IsProblematicMethod(const char *szClassName, const char *szMethodName);
137
        //bool IsConstructor(const JIE::SJavaMethodInfo &methodInfo);
138
        bool IsConstructor(const char *szMethodName);
138
139
139
    }; // class CCGAdaptor
140
    }; // class CCGAdaptor
140
141
(-)src-native/src/Martini/Infrastructure/Include/JPI.H (-1 / +1 lines)
Lines 16-22 Link Here
16
16
17
#include <iostream>
17
#include <iostream>
18
#include "OSA.h"
18
#include "OSA.h"
19
#include "jvmpi.h"
19
#include "jvmti.h"
20
#include "MPI.h"
20
#include "MPI.h"
21
21
22
#ifdef JPI_EXPORTS
22
#ifdef JPI_EXPORTS
(-)src-native/src/Martini/Infrastructure/JIE/JIE.cpp (+42 lines)
Lines 13-24 Link Here
13
#pragma warning (disable:4786)
13
#pragma warning (disable:4786)
14
14
15
#include "JIEImpl.h"
15
#include "JIEImpl.h"
16
#include "JIEUtils.h"
16
#include "JavaClass.h"
17
#include "JavaClass.h"
17
18
19
#include "LibraryLoader.h"
20
#include "OSA.h"
21
18
// first ids are reserved for threads in the prf resolution
22
// first ids are reserved for threads in the prf resolution
19
#define JIE_FIRST_METHOD_ID 0x10000 
23
#define JIE_FIRST_METHOD_ID 0x10000 
20
24
21
using namespace Martini::JIE;
25
using namespace Martini::JIE;
26
using namespace Martini::OSA;
22
27
23
extern "C" JIE_API IJIE *GetJIEInstance()
28
extern "C" JIE_API IJIE *GetJIEInstance()
24
{
29
{
Lines 26-31 extern "C" JIE_API IJIE *GetJIEInstance( Link Here
26
    return (IJIE*)&s_jie;
31
    return (IJIE*)&s_jie;
27
}
32
}
28
33
34
29
//////////////////////////////////////////////////////////////////////////
35
//////////////////////////////////////////////////////////////////////////
30
// class CJIE implementation
36
// class CJIE implementation
31
37
Lines 51-53 IJavaClass *CJIE::GetClassInterface(cons Link Here
51
    }
57
    }
52
    return pClass; 
58
    return pClass; 
53
}
59
}
60
61
void CJIE::EnableStackMapCalculation() const
62
{
63
    TResult res = BindJpiFunctions();
64
    if (MRTE_SUCCEEDED(res))
65
    {
66
        CJieGlobals::Instance()->isStackMapCalcEnabled = true;
67
    }
68
}
69
70
TResult CJIE::BindJpiFunctions() const
71
{
72
    ILibraryLoader *pJpiLoader = LoadBistroLibrary("JPI");
73
    if (!pJpiLoader)
74
    {
75
        return MRTE_ERROR_FAIL;
76
    }
77
78
    CJieGlobals::Instance()->pfnJPI_AttachCurrentThread = 
79
        (TJpiAttachCurrentThread)pJpiLoader->GetEntry("JPI_AttachCurrentThread");
80
    if (!CJieGlobals::Instance()->pfnJPI_AttachCurrentThread)
81
    {
82
        return MRTE_ERROR_FAIL;
83
    }
84
85
    CJieGlobals::Instance()->pfnJPI_DetachCurrentThread = 
86
        (TJpiDetachCurrentThread)pJpiLoader->GetEntry("JPI_DetachCurrentThread");
87
    if (!CJieGlobals::Instance()->pfnJPI_DetachCurrentThread)
88
    {
89
        return MRTE_ERROR_FAIL;
90
    }
91
    
92
    pJpiLoader->Destroy();
93
94
    return MRTE_RESULT_OK;
95
}
(-)src-native/src/Martini/Infrastructure/JIE/JIE.dsp (-13 / +17 lines)
Lines 49-55 RSC=rc.exe Link Here
49
# PROP Target_Dir ""
49
# PROP Target_Dir ""
50
F90=df.exe
50
F90=df.exe
51
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FD /c
51
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FD /c
52
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "NDEBUG" /D "IA32_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /FD /c
52
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\..\..\..\..\..\org.apache.harmony_vmcore_verifier\include" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /I "..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEngJ" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "NDEBUG" /D "IA32_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /D "STATIC_BUILD" /FD /c
53
# SUBTRACT CPP /Fr
53
# SUBTRACT CPP /Fr
54
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
54
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
55
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
55
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
Lines 60-66 BSC32=bscmake.exe Link Here
60
# ADD BSC32 /nologo
60
# ADD BSC32 /nologo
61
LINK32=link.exe
61
LINK32=link.exe
62
# ADD BASE LINK32 kernel32.lib /nologo /dll /machine:I386
62
# ADD BASE LINK32 kernel32.lib /nologo /dll /machine:I386
63
# ADD LINK32 kernel32.lib MartiniOSA.lib /nologo /dll /debug /machine:I386 /libpath:"..\..\..\..\bin\windows\release\IA-32"
63
# ADD LINK32 kernel32.lib MartiniOSA.lib verifier-ext.lib /nologo /dll /debug /machine:I386 /libpath:"..\..\..\..\bin\windows\release\IA-32" /libpath:"..\..\..\..\..\..\org.apache.harmony_vmcore_verifier\lib\win\IA-32"
64
# SUBTRACT LINK32 /incremental:yes
64
# SUBTRACT LINK32 /incremental:yes
65
65
66
!ELSEIF  "$(CFG)" == "JIE - Win32 IA32 Debug"
66
!ELSEIF  "$(CFG)" == "JIE - Win32 IA32 Debug"
Lines 79-85 LINK32=link.exe Link Here
79
# PROP Target_Dir ""
79
# PROP Target_Dir ""
80
F90=df.exe
80
F90=df.exe
81
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FR /FD /GZ /c
81
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FR /FD /GZ /c
82
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "_DEBUG" /D "IA32_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /FR /FD /GZ /c
82
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /I "..\..\..\..\org.apache.harmony_vmcore_verifier\include" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /I "..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEngJ" /I "..\..\..\..\..\..\org.apache.harmony_vmcore_verifier\include" /D "_DEBUG" /D "IA32_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /D "STATIC_BUILD" /FR /FD /LDd /GZ /c
83
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
83
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
84
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
84
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
85
# ADD BASE RSC /l 0x409 /d "_DEBUG"
85
# ADD BASE RSC /l 0x409 /d "_DEBUG"
Lines 89-96 BSC32=bscmake.exe Link Here
89
# ADD BSC32 /nologo
89
# ADD BSC32 /nologo
90
LINK32=link.exe
90
LINK32=link.exe
91
# ADD BASE LINK32 kernel32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
91
# ADD BASE LINK32 kernel32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
92
# ADD LINK32 kernel32.lib MartiniOSA.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\bin\windows\debug\IA-32"
92
# ADD LINK32 kernel32.lib MartiniOSA.lib verifier-ext.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\bin\windows\debug\IA-32" /libpath:"..\..\..\..\..\..\org.apache.harmony_vmcore_verifier\lib\win\IA-32"
93
# SUBTRACT LINK32 /incremental:no
93
# SUBTRACT LINK32 /incremental:no /nodefaultlib
94
94
95
!ELSEIF  "$(CFG)" == "JIE - Win32 EM64T Debug"
95
!ELSEIF  "$(CFG)" == "JIE - Win32 EM64T Debug"
96
96
Lines 108-114 LINK32=link.exe Link Here
108
# PROP Target_Dir ""
108
# PROP Target_Dir ""
109
F90=df.exe
109
F90=df.exe
110
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /I "..\Include\win" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FR /FD /GZ /c
110
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /I "..\Include\win" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FR /FD /GZ /c
111
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "_DEBUG" /D "EM64T_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /FD /GZ /c
111
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\..\..\..\org.apache.harmony_vmcore_verifier\include" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /I "..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEngJ" /I "..\..\..\..\..\..\org.apache.harmony_vmcore_verifier\include" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "_DEBUG" /D "EM64T_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /D "STATIC_BUILD" /FD /GZ /c
112
# SUBTRACT CPP /Fr
112
# SUBTRACT CPP /Fr
113
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
113
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
114
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
114
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
Lines 119-125 BSC32=bscmake.exe Link Here
119
# ADD BSC32 /nologo
119
# ADD BSC32 /nologo
120
LINK32=link.exe
120
LINK32=link.exe
121
# ADD BASE LINK32 kernel32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\IA32Debug"
121
# ADD BASE LINK32 kernel32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\IA32Debug"
122
# ADD LINK32 kernel32.lib MartiniOSA.lib /nologo /dll /incremental:no /debug /machine:I386 /libpath:"..\..\..\..\bin\windows\debug\EM64T"
122
# ADD LINK32 kernel32.lib MartiniOSA.lib verifier-ext.lib /nologo /dll /incremental:no /debug /machine:I386 /include:"../../.../../" /libpath:"..\..\..\..\bin\windows\debug\EM64T"
123
# SUBTRACT LINK32 /pdb:none
123
# SUBTRACT LINK32 /pdb:none
124
124
125
!ELSEIF  "$(CFG)" == "JIE - Win32 EM64T Release"
125
!ELSEIF  "$(CFG)" == "JIE - Win32 EM64T Release"
Lines 138-144 LINK32=link.exe Link Here
138
# PROP Target_Dir ""
138
# PROP Target_Dir ""
139
F90=df.exe
139
F90=df.exe
140
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /I "..\Include\win" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FD /c
140
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /I "..\Include\win" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FD /c
141
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "NDEBUG" /D "EM64T_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /FD /c
141
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\..\..\..\org.apache.harmony_vmcore_verifier\include" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /I "..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEngJ" /I "..\..\..\..\..\..\org.apache.harmony_vmcore_verifier\include" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "NDEBUG" /D "EM64T_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /D "STATIC_BUILD" /FD /c
142
# SUBTRACT CPP /Fr
142
# SUBTRACT CPP /Fr
143
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
143
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
144
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
144
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
Lines 149-155 BSC32=bscmake.exe Link Here
149
# ADD BSC32 /nologo
149
# ADD BSC32 /nologo
150
LINK32=link.exe
150
LINK32=link.exe
151
# ADD BASE LINK32 kernel32.lib /nologo /dll /machine:I386 /libpath:"..\..\..\..\IA32Release"
151
# ADD BASE LINK32 kernel32.lib /nologo /dll /machine:I386 /libpath:"..\..\..\..\IA32Release"
152
# ADD LINK32 kernel32.lib MartiniOSA.lib /nologo /dll /debug /machine:I386 /libpath:"..\..\..\..\bin\windows\release\EM64T"
152
# ADD LINK32 kernel32.lib MartiniOSA.lib verifier-ext.lib /nologo /dll /debug /machine:I386 /include:"../../.../../" /libpath:"..\..\..\..\bin\windows\release\EM64T"
153
# SUBTRACT LINK32 /incremental:yes
153
# SUBTRACT LINK32 /incremental:yes
154
154
155
!ELSEIF  "$(CFG)" == "JIE - Win32 IPF Release"
155
!ELSEIF  "$(CFG)" == "JIE - Win32 IPF Release"
Lines 168-174 LINK32=link.exe Link Here
168
# PROP Target_Dir ""
168
# PROP Target_Dir ""
169
F90=df.exe
169
F90=df.exe
170
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /I "..\Include\win" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FD /c
170
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /I "..\Include\win" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FD /c
171
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "NDEBUG" /D "IPF_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /FD /c
171
# ADD CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\..\..\..\org.apache.harmony_vmcore_verifier\include" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /I "..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEngJ" /I "..\..\..\..\..\..\org.apache.harmony_vmcore_verifier\include" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "NDEBUG" /D "IPF_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /D "STATIC_BUILD" /FD /c
172
# SUBTRACT CPP /Fr
172
# SUBTRACT CPP /Fr
173
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
173
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
174
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
174
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
Lines 179-185 BSC32=bscmake.exe Link Here
179
# ADD BSC32 /nologo
179
# ADD BSC32 /nologo
180
LINK32=link.exe
180
LINK32=link.exe
181
# ADD BASE LINK32 kernel32.lib /nologo /dll /machine:I386 /libpath:"..\..\..\..\IA32Release"
181
# ADD BASE LINK32 kernel32.lib /nologo /dll /machine:I386 /libpath:"..\..\..\..\IA32Release"
182
# ADD LINK32 kernel32.lib MartiniOSA.lib /nologo /dll /debug /machine:I386 /libpath:"..\..\..\..\IA64Release" /libpath:"..\..\..\..\bin\windows\release\IPF"
182
# ADD LINK32 kernel32.lib MartiniOSA.lib verifier-ext.lib /nologo /dll /debug /machine:I386 /include:"../../.../../" /libpath:"..\..\..\..\IA64Release" /libpath:"..\..\..\..\bin\windows\release\IPF"
183
# SUBTRACT LINK32 /pdb:none /incremental:yes
183
# SUBTRACT LINK32 /pdb:none /incremental:yes
184
184
185
!ELSEIF  "$(CFG)" == "JIE - Win32 IPF Debug"
185
!ELSEIF  "$(CFG)" == "JIE - Win32 IPF Debug"
Lines 198-204 LINK32=link.exe Link Here
198
# PROP Target_Dir ""
198
# PROP Target_Dir ""
199
F90=df.exe
199
F90=df.exe
200
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /I "..\Include\win" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FR /FD /GZ /c
200
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /I "..\Include\win" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /FR /FD /GZ /c
201
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /D "_DEBUG" /D "IPF_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /FD /GZ /c
201
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\org.apache.harmony_vmcore_verifier\include" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng" /I "..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ" /I "..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\JClass" /I "..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEngJ" /I "..\..\..\..\..\..\org.apache.harmony_vmcore_verifier\include" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "_DEBUG" /D "IPF_ARCH" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JIE_EXPORTS" /D "MARTINI_JIE" /D "STATIC_BUILD" /FD /GZ /c
202
# SUBTRACT CPP /Fr
202
# SUBTRACT CPP /Fr
203
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
203
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
204
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
204
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
Lines 209-215 BSC32=bscmake.exe Link Here
209
# ADD BSC32 /nologo
209
# ADD BSC32 /nologo
210
LINK32=link.exe
210
LINK32=link.exe
211
# ADD BASE LINK32 kernel32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\IA32Debug"
211
# ADD BASE LINK32 kernel32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\IA32Debug"
212
# ADD LINK32 kernel32.lib MartiniOSA.lib /nologo /dll /incremental:no /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\bin\windows\debug\IPF"
212
# ADD LINK32 kernel32.lib MartiniOSA.lib verifier-ext.lib /nologo /dll /incremental:no /debug /machine:I386 /include:"../../.../../" /pdbtype:sept /libpath:"..\..\..\..\bin\windows\debug\IPF"
213
# SUBTRACT LINK32 /pdb:none
213
# SUBTRACT LINK32 /pdb:none
214
214
215
!ENDIF 
215
!ENDIF 
Lines 235-240 SOURCE=.\BciUtils.cpp Link Here
235
# End Source File
235
# End Source File
236
# Begin Source File
236
# Begin Source File
237
237
238
SOURCE="..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\BCIEng\BCIEngJ\class_interface.cpp"
239
# End Source File
240
# Begin Source File
241
238
SOURCE="..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common\Command.cpp"
242
SOURCE="..\..\..\..\..\..\org.eclipse.hyades.probekit\src-native\BCI\Common\Command.cpp"
239
# End Source File
243
# End Source File
240
# Begin Source File
244
# Begin Source File
(-)src-native/src/Martini/Infrastructure/JIE/JIEImpl.h (+4 lines)
Lines 27-32 namespace Martini { namespace JIE { Link Here
27
        // IJIE methods
27
        // IJIE methods
28
        virtual IJavaClass *GetClassInterface(const unsigned char *pucClassFile,
28
        virtual IJavaClass *GetClassInterface(const unsigned char *pucClassFile,
29
                                              unsigned int uiClassSize) const;
29
                                              unsigned int uiClassSize) const;
30
        virtual void EnableStackMapCalculation() const;
31
        
32
    private:
33
        TResult BindJpiFunctions() const;
30
        
34
        
31
    }; // class CJIE
35
    }; // class CJIE
32
36
(-)src-native/src/Martini/Infrastructure/JIE/JIEUtils.cpp (+3 lines)
Lines 221-224 U16 CharToUtf8(U8 *pDest, unsigned int u Link Here
221
	return ret;
221
	return ret;
222
}
222
}
223
223
224
//////////////////////////////////////////////////////////////////////////
225
// CJieGlobals implementation
224
226
227
Martini::JIE::CJieGlobals* Martini::JIE::CJieGlobals::s_pInstance = NULL;
(-)src-native/src/Martini/Infrastructure/JIE/JIEUtils.h (+36 lines)
Lines 20-25 Link Here
20
#include "MString.h"
20
#include "MString.h"
21
#include "JavaHelpers.h"
21
#include "JavaHelpers.h"
22
22
23
#include "jni.h"
24
23
///////////////////////////////////////////////////////////////////////////////
25
///////////////////////////////////////////////////////////////////////////////
24
// Global constants
26
// Global constants
25
27
Lines 35-38 TResult Utf8ToChar(U8 *bytes, U16 length Link Here
35
U16 WCharToUtf8(U8 *pDest, unsigned int uiDesBufferSize, const WCHAR *pSource);
37
U16 WCharToUtf8(U8 *pDest, unsigned int uiDesBufferSize, const WCHAR *pSource);
36
U16 CharToUtf8(U8 *pDest, unsigned int uiDesBufferSize, const char *pSource);
38
U16 CharToUtf8(U8 *pDest, unsigned int uiDesBufferSize, const char *pSource);
37
39
40
typedef TResult (*TJpiAttachCurrentThread) (JNIEnv **ppJNIEnv, bool *bAttached);
41
typedef void (*TJpiDetachCurrentThread) ();
42
43
namespace Martini { namespace JIE {
44
45
    class CJieGlobals
46
    {
47
    public:
48
49
        static CJieGlobals* Instance() 
50
        {
51
            if (0 == s_pInstance)
52
            {
53
                s_pInstance = new CJieGlobals();
54
            }
55
            return s_pInstance;
56
        }
57
58
        TJpiAttachCurrentThread pfnJPI_AttachCurrentThread;
59
        TJpiDetachCurrentThread pfnJPI_DetachCurrentThread;
60
        
61
        bool isStackMapCalcEnabled;
62
63
    protected:
64
        static CJieGlobals* s_pInstance;
65
66
        CJieGlobals(): 
67
            pfnJPI_AttachCurrentThread(0), pfnJPI_DetachCurrentThread(0),
68
            isStackMapCalcEnabled(false)
69
            {}
70
71
    };
72
}} // namespace Martini::JIE
73
38
#endif // MRTE_JIEUTILS
74
#endif // MRTE_JIEUTILS
(-)src-native/src/Martini/Infrastructure/JIE/JavaClass.cpp (+47 lines)
Lines 29-34 Link Here
29
#include "JStream.h"
29
#include "JStream.h"
30
#include "JMemStream.h"
30
#include "JMemStream.h"
31
#include "JVMInsSet.h"
31
#include "JVMInsSet.h"
32
#include "class_inerface_int.h"
32
#include "MIEInstructionFactory.h"
33
#include "MIEInstructionFactory.h"
33
#include "BciUtils.h"
34
#include "BciUtils.h"
34
35
Lines 40-45 using namespace Martini::Infrastructure; Link Here
40
//////////////////////////////////////////////////////////////////////////
41
//////////////////////////////////////////////////////////////////////////
41
// class CJavaClass implementation
42
// class CJavaClass implementation
42
43
44
static void* g_pJniEnv = NULL;
45
46
static void *
47
get_vm_pointer(void **pJniEnv) 
48
{
49
    *pJniEnv = g_pJniEnv;
50
    return g_pJniEnv;
51
/*
52
    bool attached = false;
53
    TResult res = CJieGlobals::Instance()->pfnJPI_AttachCurrentThread(
54
        (JNIEnv **)pJniEnv, &attached);
55
    if (MRTE_SUCCEEDED(res))
56
    {
57
        return *pJniEnv;
58
    }
59
    else 
60
    {
61
        return NULL;
62
    }
63
*/
64
}
65
43
// constructs a CJavaClass object
66
// constructs a CJavaClass object
44
CJavaClass::CJavaClass(const unsigned char *pubClassFile, unsigned int uiClassSize)
67
CJavaClass::CJavaClass(const unsigned char *pubClassFile, unsigned int uiClassSize)
45
    : m_pStaticInitializer(NULL), m_bModuleParsed(false), m_bMethodListCreated(false),
68
    : m_pStaticInitializer(NULL), m_bModuleParsed(false), m_bMethodListCreated(false),
Lines 50-55 CJavaClass::CJavaClass(const unsigned ch Link Here
50
    //_CrtSetBreakAlloc(2189);
73
    //_CrtSetBreakAlloc(2189);
51
#endif
74
#endif
52
75
76
    if (CJieGlobals::Instance()->isStackMapCalcEnabled)
77
    {
78
        TResult res = CJieGlobals::Instance()->pfnJPI_AttachCurrentThread(
79
            &m_pJniEnv, &m_isThreadAttached);
80
        if (MRTE_SUCCEEDED(res))
81
        {
82
            g_pJniEnv = m_pJniEnv;
83
            initialize_dynamic(get_vm_pointer);
84
        }
85
        else
86
        {
87
            CJieGlobals::Instance()->isStackMapCalcEnabled = false;
88
            m_isThreadAttached = false;
89
            m_pJniEnv = NULL;
90
        }
91
    }
92
53
	CJMemStream		memStream;					// Memory stream
93
	CJMemStream		memStream;					// Memory stream
54
	CJStream		jsIn(&memStream);		    // Java input stream
94
	CJStream		jsIn(&memStream);		    // Java input stream
55
    // read class file
95
    // read class file
Lines 62-67 CJavaClass::CJavaClass(const unsigned ch Link Here
62
    // is deleted.
102
    // is deleted.
63
	m_pModule->Open(m_pClassBuilder, true);
103
	m_pModule->Open(m_pClassBuilder, true);
64
	m_pModule->SetAccessFlags(m_pClassBuilder->GetAccessFlags());
104
	m_pModule->SetAccessFlags(m_pClassBuilder->GetAccessFlags());
105
	m_pModule->UseStackMapCalculation(CJieGlobals::Instance()->isStackMapCalcEnabled);
65
}
106
}
66
107
67
// destructor
108
// destructor
Lines 100-105 void CJavaClass::Free() Link Here
100
    // deallocate the instruction factory
141
    // deallocate the instruction factory
101
    CMIEInstructionFactory::Free();
142
    CMIEInstructionFactory::Free();
102
143
144
    // detach the current thread from the JVM (if needed)
145
    if (CJieGlobals::Instance()->isStackMapCalcEnabled && m_isThreadAttached)
146
    {
147
        CJieGlobals::Instance()->pfnJPI_DetachCurrentThread();
148
    }
149
103
    // deallocate the JavaClass object
150
    // deallocate the JavaClass object
104
    delete this;
151
    delete this;
105
}
152
}
(-)src-native/src/Martini/Infrastructure/JIE/JavaClass.h (+9 lines)
Lines 20-25 Link Here
20
#include "JavaFields.h"
20
#include "JavaFields.h"
21
#include "ModuleJ.h"
21
#include "ModuleJ.h"
22
22
23
#include "jni.h"
24
23
namespace Martini { namespace JIE {
25
namespace Martini { namespace JIE {
24
26
25
    class CJavaClass : public IJavaClass
27
    class CJavaClass : public IJavaClass
Lines 108-113 namespace Martini { namespace JIE { Link Here
108
        // create a new field
110
        // create a new field
109
        IJavaField* InternalAddField(u2 uiFlags, const char *szName, CJavaType fieldType);
111
        IJavaField* InternalAddField(u2 uiFlags, const char *szName, CJavaType fieldType);
110
112
113
        // JNI environment pointer for Java 6 StackMap calculation
114
        JNIEnv* m_pJniEnv;
115
116
        // Whether the current thread was actively attached to the JVM during instantiation of 
117
        // this class
118
        bool m_isThreadAttached; 
119
111
    }; // class CJavaClass
120
    }; // class CJavaClass
112
121
113
}} // namespace JIE
122
}} // namespace JIE
(-)src-native/src/Martini/Infrastructure/JPI/JPI.dsp (-1 / +1 lines)
Lines 80-86 LINK32=link.exe Link Here
80
# PROP Target_Dir ""
80
# PROP Target_Dir ""
81
F90=df.exe
81
F90=df.exe
82
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /D "_DEBUG" /D "MPI_EXPORTS" /D "JPI_EXPORTS" /D "JVMPI" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /GZ /c
82
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\Include" /D "_DEBUG" /D "MPI_EXPORTS" /D "JPI_EXPORTS" /D "JVMPI" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /GZ /c
83
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "DUMP_CLASS" /D "_DEBUG" /D "IA32_ARCH" /D "MPI_EXPORTS" /D "JPI_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /GZ /c
83
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "DUMP_CLASS" /D "_DEBUG" /D "IA32_ARCH" /D "MPI_EXPORTS" /D "JPI_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /GZ /c
84
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
84
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
85
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
85
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
86
# ADD BASE RSC /l 0x409 /d "_DEBUG"
86
# ADD BASE RSC /l 0x409 /d "_DEBUG"
(-)src-native/src/Martini/Infrastructure/JPIBootLoader/JPIBootLoader.dsp (-1 / +1 lines)
Lines 80-86 LINK32=link.exe Link Here
80
# PROP Target_Dir ""
80
# PROP Target_Dir ""
81
F90=df.exe
81
F90=df.exe
82
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\..\Include" /D "_DEBUG" /D "JPIBOOTLOADER_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JVMPI" /FR /YX /FD /GZ /c
82
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\..\Include" /D "_DEBUG" /D "JPIBOOTLOADER_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "JVMPI" /FR /YX /FD /GZ /c
83
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "_DEBUG" /D "IA32_ARCH" /D "JPIBOOTLOADER_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /GZ /c
83
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\Include" /I "..\..\Include" /I "..\..\..\..\include\Martini" /I "$(JAVA_HOME)\include" /I "$(JAVA_HOME)\include\win32" /D "_DEBUG" /D "IA32_ARCH" /D "JPIBOOTLOADER_EXPORTS" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /YX /FD /GZ /c
84
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
84
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
85
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
85
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
86
# ADD BASE RSC /l 0x409 /d "_DEBUG"
86
# ADD BASE RSC /l 0x409 /d "_DEBUG"
(-)src-native/src/Martini/Infrastructure/LibraryLoader/LibraryLoader.dsp (-1 / +1 lines)
Lines 69-75 LIB32=link.exe -lib Link Here
69
# PROP Intermediate_Dir "debug\IA-32"
69
# PROP Intermediate_Dir "debug\IA-32"
70
# PROP Target_Dir ""
70
# PROP Target_Dir ""
71
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\InstrumentorEngine" /I "..\..\Include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
71
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\InstrumentorEngine" /I "..\..\Include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
72
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include\Martini" /I "..\..\Include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "IA32_ARCH" /YX /FD /GZ /c
72
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\..\..\include\Martini" /I "..\..\Include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "IA32_ARCH" /YX /FD /GZ /c
73
# ADD BASE RSC /l 0x409 /d "_DEBUG"
73
# ADD BASE RSC /l 0x409 /d "_DEBUG"
74
# ADD RSC /l 0x409 /d "_DEBUG"
74
# ADD RSC /l 0x409 /d "_DEBUG"
75
BSC32=bscmake.exe
75
BSC32=bscmake.exe
(-)src-native/src/Martini/Infrastructure/OSA/Windows/MartiniOSA.dsp (-2 / +1 lines)
Lines 48-55 RSC=rc.exe Link Here
48
# PROP Target_Dir ""
48
# PROP Target_Dir ""
49
F90=df.exe
49
F90=df.exe
50
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I ".\Common" /I ".\Win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSABSTRACTION_EXPORTS" /YX /FD /GZ /c
50
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I ".\Common" /I ".\Win32" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OSABSTRACTION_EXPORTS" /YX /FD /GZ /c
51
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I ".\IA32" /I ".\Common" /I "..\..\..\Include" /I "..\..\..\..\..\include\Martini" /D "_DEBUG" /D "IA32_ARCH" /D "_WINDOWS" /D "_USRDLL" /D "MARTINIOSA_EXPORTS" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c
51
# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I ".\IA32" /I ".\Common" /I "..\..\..\Include" /I "..\..\..\..\..\include\Martini" /D "_DEBUG" /D "IA32_ARCH" /D "_WINDOWS" /D "_USRDLL" /D "MARTINIOSA_EXPORTS" /D "WIN32" /D "_MBCS" /YX /FD /GZ /c
52
# SUBTRACT CPP /X /Fr
53
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
52
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
54
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
53
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
55
# ADD BASE RSC /l 0x409 /d "_DEBUG"
54
# ADD BASE RSC /l 0x409 /d "_DEBUG"
(-)src-native/src/Martini/Infrastructure/common/InstrumentationAdaptorBase.cpp (+2 lines)
Lines 65-75 TResult CInstrumentationAdaptorBase::Ini Link Here
65
    {
65
    {
66
        return MRTE_ERROR_FAIL;
66
        return MRTE_ERROR_FAIL;
67
    }
67
    }
68
68
    return MRTE_RESULT_OK;
69
    return MRTE_RESULT_OK;
69
}
70
}
70
71
71
void CInstrumentationAdaptorBase::JvmInitDone()
72
void CInstrumentationAdaptorBase::JvmInitDone()
72
{
73
{
74
    m_pJIE->EnableStackMapCalculation();
73
    m_bJVMInitDone = true;
75
    m_bJVMInitDone = true;
74
}
76
}
75
77

Return to bug 148629