harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r507531 - in /harmony/enhanced/drlvm/trunk/vm: include/ jitrino/src/codegenerator/ia32/ jitrino/src/vm/ jitrino/src/vm/drl/ vmcore/include/ vmcore/src/class_support/ vmcore/src/jit/ vmcore/src/jvmti/
Date Wed, 14 Feb 2007 13:55:36 GMT
Author: gshimansky
Date: Wed Feb 14 05:55:31 2007
New Revision: 507531

URL: http://svn.apache.org/viewvc?view=rev&rev=507531
Log:
Applied HARMONY-2145 [drlvm][jvmti] Compiled Method Load event - inlined method support

Tests passed on Ubuntu6 x86, Windows 2003 server x86 and SuSE9 x86_64


Added:
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/inline_info.h   (with props)
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/inline_info.cpp   (with props)
Modified:
    harmony/enhanced/drlvm/trunk/vm/include/jit_intf.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp
    harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp
    harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp

Modified: harmony/enhanced/drlvm/trunk/vm/include/jit_intf.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/include/jit_intf.h?view=diff&rev=507531&r1=507530&r2=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/include/jit_intf.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/include/jit_intf.h Wed Feb 14 05:55:31 2007
@@ -286,6 +286,33 @@
 // Deprecated.  Please use vector_first_element_offset instead.
 //VMEXPORT int get_array_offset(Java_Type element_type);
 
+/**
+ * One entry of correspondence table between native addresses and bytecode
+ * locations.
+ */
+struct AddrLocation {
+    /** Native code address. */
+    void* start_addr;
+
+    /** Bytecode location. */
+    uint16 location;
+};
+
+/**
+ * Adds information about inlined method.
+ * @param[in] method - method which is inlined
+ * @param[in] codeSize - size of inlined code block
+ * @param[in] codeAddr - size of inlined code block
+ * @param[in] mapLength - number of AddrLocation elements in addrLocationMap
+ * @param[in] addrLocationMap - native addresses to bytecode locations
+ *       correspondence table
+ * @param[in] compileInfo - VM specific information.
+ * @param[in] outer_method - target method to which inlining was made
+ */
+VMEXPORT void compiled_method_load(Method_Handle method, uint32 codeSize, 
+                                  void* codeAddr, uint32 mapLength, 
+                                  AddrLocation* addrLocationMap, 
+                                  void* compileInfo, Method_Handle outer_method);
 
 //////////////// end C interface
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp?view=diff&rev=507531&r1=507530&r2=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/codegenerator/ia32/Ia32CodeEmitter.cpp Wed
Feb 14 05:55:31 2007
@@ -46,7 +46,7 @@
         :memoryManager(0x1000, "CodeEmitter"),
         exceptionHandlerInfos(memoryManager), constantAreaLayout(memoryManager),
         traversalInfo(memoryManager), methodLocationMap(memoryManager), 
-        entryExitMap(memoryManager)
+        entryExitMap(memoryManager), instSizeMap(memoryManager)
     {
     }
 
@@ -72,6 +72,7 @@
     void orderNodesAndMarkInlinees(StlList<MethodMarkerPseudoInst*>& container,

         Node * node, bool isForward);
     void reportCompiledInlinees();
+    void reportInlinedMethod(CompiledMethodInfo* methInfo, MethodMarkerPseudoInst* methEntryInst);
 
     //------------------------------------------------------------------------------------
     class ConstantAreaLayout
@@ -131,22 +132,48 @@
     StlVector<int> traversalInfo;
     StlMap<MethodMarkerPseudoInst*, CompiledMethodInfo* > methodLocationMap;
     StlMap<MethodMarkerPseudoInst*, MethodMarkerPseudoInst* > entryExitMap;
+    StlMap<POINTER_SIZE_INT, unsigned> instSizeMap;
 };
+
+typedef StlMap<POINTER_SIZE_INT, uint16> LocationMap;
+
 class CompiledMethodInfo {
 public:
-    CompiledMethodInfo(MemoryManager& mm): locationList(mm) {}
+    CompiledMethodInfo(MemoryManager& mm, POINTER_SIZE_INT addr, MethodMarkerPseudoInst*
outerEntry, uint32 idpth):
+        memoryManager(mm),
+        locationMap(memoryManager),
+        codeSize(0),
+        codeAddr(addr),
+        outerMethodEntry(outerEntry),
+        inlineDepth(idpth)
+    {}
     uint32 getCodeSize() { return codeSize; }
-    void* getCodeAddr() { return codeAddr; }
+    uint32 getInlineDepth() { return inlineDepth; }
+    POINTER_SIZE_INT getCodeAddr() { return codeAddr; }
+    MethodMarkerPseudoInst* getOuterMethodEntry() { return outerMethodEntry; }
 
 protected:
     friend class CodeEmitter;
-    StlList<std::pair<POINTER_SIZE_INT, uint16>* > locationList;
+    MemoryManager& memoryManager;
+    LocationMap locationMap;
     uint32 codeSize;
-    void* codeAddr;
-    void setCodeSize(uint32 size) { codeSize = size; }
-    void setCodeAddr(void* addr) { codeAddr = addr; }
-    void addLocation(std::pair<POINTER_SIZE_INT, uint16>* entry) {
-        locationList.push_back(entry);
+    POINTER_SIZE_INT codeAddr;
+    MethodMarkerPseudoInst* outerMethodEntry;
+    // inlineDepth == 1 means that CompiledMethod is inlined into irManager->getMethodDesc()
+    uint32 inlineDepth;
+
+    void addCodeSize(uint32 size) { codeSize += size; }
+
+    void includeInst(Inst* inst, uint64 bcOffset) {
+        if( inst->hasKind(Inst::Kind_PseudoInst)) {
+            return;
+        } else {
+            addCodeSize(inst->getCodeSize());
+        }
+
+        POINTER_SIZE_INT instStartAddr = (POINTER_SIZE_INT) inst->getCodeStartAddr();
+        assert(!locationMap.has(instStartAddr));
+        locationMap[instStartAddr] = (uint16)bcOffset;
     }
 private:
 
@@ -357,7 +384,12 @@
         uint8 * blockStartIp = ip;
         bb->setCodeOffset( blockStartIp-codeStreamStart );
         for (Inst* inst = (Inst*)bb->getFirstInst(); inst!=NULL; inst = inst->getNextInst())
{
-            if( inst->hasKind(Inst::Kind_PseudoInst)) continue;
+            if( inst->hasKind(Inst::Kind_PseudoInst)) {
+                
+                uint8 * instStartIp = ip;
+                inst->setCodeOffset( instStartIp-blockStartIp );
+                continue;
+            }
 
 #ifdef _EM64T_
             if (inst->hasKind(Inst::Kind_ControlTransferInst) && 
@@ -688,32 +720,40 @@
 
         for (Inst* inst = (Inst*)node->getFirstInst(); inst!=NULL; inst = inst->getNextInst())
{
             if (inst->getKind() == Inst::Kind_MethodEntryPseudoInst) {
+                // keep old method entry
+                MethodMarkerPseudoInst* oldMethodEntryInst = methMarkerInst;
+                assert(!oldMethodEntryInst || oldMethodEntryInst->getKind() == Inst::Kind_MethodEntryPseudoInst);
+                // set new methMarkerInst
                 methMarkerInst = (MethodMarkerPseudoInst*)inst;
-                inlineStack.push_back(methMarkerInst);
-                methInfo = new(memoryManager) CompiledMethodInfo(memoryManager);
-                methInfo->setCodeAddr(methMarkerInst->getCodeStartAddr());
+                inlineStack.push_back(methMarkerInst); 
+                // construct new inlined method info
+                methInfo = new(memoryManager) CompiledMethodInfo(memoryManager,
+                                                                 (POINTER_SIZE_INT)methMarkerInst->getCodeStartAddr(),
+                                                                 oldMethodEntryInst,
+                                                                 inlineStack.size());
+
                 methodLocationMap[methMarkerInst] = methInfo;
             } else if (inst->getKind() == Inst::Kind_MethodEndPseudoInst) {
                 methMarkerInst = (MethodMarkerPseudoInst*)inst;
                 assert(((MethodMarkerPseudoInst*)inlineStack.back())->getMethodDesc()
== methMarkerInst->getMethodDesc());
                 entryExitMap[methMarkerInst] = inlineStack.back();
-                if (methInfo != NULL) {
-                    Inst* entryInst = inlineStack.back();
-                    POINTER_SIZE_INT codeSize = (POINTER_SIZE_INT)entryInst->getCodeStartAddr()

-                            - (POINTER_SIZE_INT)methMarkerInst->getCodeStartAddr();
-                    methInfo->setCodeSize((uint32)codeSize);
-                }
                 inlineStack.pop_back();
                 methMarkerInst = NULL;
             } else {              //handle usual instructions
                 if (methMarkerInst != NULL) {    // inlined locations for methMarkerInst

                     assert(methInfo == methodLocationMap[methMarkerInst]);
+                    if( ! inst->hasKind(Inst::Kind_PseudoInst)) {
+                        instSizeMap[(POINTER_SIZE_INT) inst->getCodeStartAddr()] = inst->getCodeSize();
+                    }
                     uint64 instID = inst->getId();
                     uint64 bcOffset = bc2LIRMapHandler->getVectorEntry(instID);
-
-                    if (bcOffset != ILLEGAL_VALUE) {
-                        POINTER_SIZE_INT instStartAddr = (POINTER_SIZE_INT) inst->getCodeStartAddr();
-                        methInfo->addLocation(new(memoryManager) std::pair<POINTER_SIZE_INT,
uint16>(instStartAddr, (uint16)bcOffset));
+                    methInfo->includeInst(inst,bcOffset);
+                    // addLocation with ILLEGAL_VALUE for all outers
+                    MethodMarkerPseudoInst* outerEntry = methInfo->getOuterMethodEntry();
+                    while (outerEntry) {
+                        CompiledMethodInfo* outerInfo = methodLocationMap[outerEntry];
+                        outerInfo->includeInst(inst, ILLEGAL_VALUE);
+                        outerEntry = outerInfo->getOuterMethodEntry();
                     }
                 }
             }
@@ -752,6 +792,70 @@
     
 }
 
+void CodeEmitter::reportInlinedMethod(CompiledMethodInfo* methInfo, MethodMarkerPseudoInst*
methEntryInst) {
+    AddrLocation* addrLocationMap = new(memoryManager) AddrLocation[methInfo->locationMap.size()];
+
+    MethodDesc* method = methEntryInst->getMethodDesc();
+    MethodMarkerPseudoInst* outerEntry = methInfo->getOuterMethodEntry();
+    MethodDesc* outer = (outerEntry != NULL) ? outerEntry->getMethodDesc() : &irManager->getMethodDesc();
+
+    LocationMap::const_iterator lit, 
+                litStart = methInfo->locationMap.begin(),
+                litEnd = methInfo->locationMap.end();
+
+    POINTER_SIZE_INT methodStartAddr = litStart == litEnd ? methInfo->getCodeAddr() :
(*litStart).first;
+    POINTER_SIZE_INT prevAddr = 0;
+    uint32 methodSize = 0;
+    uint32 locationMapSize = 0;
+
+    for (lit = litStart; lit != litEnd; lit++) {
+
+        POINTER_SIZE_INT addr = (*lit).first;
+        uint16 bcOffset = (*lit).second;
+        assert( addr > prevAddr); // locationMap content must be ordered
+
+        if (addr != prevAddr + instSizeMap[prevAddr] && methodSize > 0) {
+            // gap in layout
+            assert(instSizeMap.has(prevAddr));
+            assert(addr > prevAddr + instSizeMap[prevAddr]);
+
+            // report already gathered
+            irManager->getCompilationInterface().sendCompiledMethodLoadEvent(method, outer,
methodSize,
+                            (void*)methodStartAddr, locationMapSize, addrLocationMap, NULL);
+            if (Log::isEnabled()) {
+                Log::out() << "Reporting Inlinee (part)  " << method->getParentType()->getName()
<< "."
+                                                           << method->getName()
<< " ";
+                Log::out() << "Outer = " << outer->getParentType()->getName()
<< "." << outer->getName();
+                Log::out() << " start=" << methodStartAddr << " size="
<< methodSize << ::std::endl;
+            }
+
+            // reset values
+            methodStartAddr = addr;
+            addrLocationMap += locationMapSize; // shift pointer
+            locationMapSize = 0;
+            methodSize = 0;
+
+        } 
+
+        // process current location
+        addrLocationMap[locationMapSize].start_addr = (void*)addr;
+        addrLocationMap[locationMapSize].location = bcOffset;
+        locationMapSize++;
+        methodSize += instSizeMap[addr];
+        prevAddr = addr;
+    }
+    // report final
+    irManager->getCompilationInterface().sendCompiledMethodLoadEvent(method, outer, methodSize,
+                    (void*)methodStartAddr, locationMapSize, addrLocationMap, NULL);
+    if (Log::isEnabled()) {
+        Log::out() << "Reporting Inlinee (final) " << method->getParentType()->getName()
<< "."
+                                                   << method->getName() <<
" ";
+        Log::out() << "Outer = " << outer->getParentType()->getName() <<
"." << outer->getName();
+        Log::out() << " start=" << methodStartAddr << " size=" <<
methodSize << ::std::endl;
+    }
+
+}
+
 void CodeEmitter::reportCompiledInlinees() {
     StlList<MethodMarkerPseudoInst*> inlineList(memoryManager);
     traversalInfo.resize(irManager->getFlowGraph()->getMaxNodeId() + 1, 0);
@@ -760,23 +864,23 @@
 
     StlMap<MethodMarkerPseudoInst*, CompiledMethodInfo* >::const_iterator i, 
             itEnd = methodLocationMap.end();
-    //std::cout << " * Method: " << irManager.getMethodDesc().getName() <<
std::endl;
-    for (i = methodLocationMap.begin(); i != itEnd; i++) {
-        MethodMarkerPseudoInst* metEntryInst = (MethodMarkerPseudoInst*)i->first;
-        CompiledMethodInfo* methInfo = (CompiledMethodInfo*)i->second;
-        AddrLocation* addrLocationMap = new(memoryManager) AddrLocation[methInfo->locationList.size()];
-
-        StlList<std::pair<POINTER_SIZE_INT, uint16>* >::const_iterator lit, 
-                litEnd = methInfo->locationList.end();
-        int j = 0;
-        for (lit = methInfo->locationList.begin(); lit != litEnd; lit++) {
-            addrLocationMap[j].start_addr = (void*)(*lit)->first;
-            addrLocationMap[j].location = (*lit)->second;
-        }
-        irManager->getCompilationInterface().sendCompiledMethodLoadEvent(metEntryInst->getMethodDesc(),

-                methInfo->codeSize, methInfo->codeAddr, (uint32)methInfo->locationList.size(),

-                addrLocationMap, NULL);
-    }
+
+    // send events according to inlining depth
+    // depth == 1 - the first level inlinees
+    bool found = false;
+    uint32 depth = 1;
+    do {
+        found = false;
+        for (i = methodLocationMap.begin(); i != itEnd; i++) {
+            MethodMarkerPseudoInst* methEntryInst = (MethodMarkerPseudoInst*)i->first;
+            CompiledMethodInfo* methInfo = (CompiledMethodInfo*)i->second;
+            if (depth == methInfo->getInlineDepth()) {
+                found = true;
+                reportInlinedMethod(methInfo, methEntryInst);
+            }
+        }
+        depth++;
+    } while (found);
 }
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h?view=diff&rev=507531&r1=507530&r2=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/VMInterface.h Wed Feb 14 05:55:31 2007
@@ -31,6 +31,7 @@
 
 #include "open/types.h"
 #include "jit_export.h"
+#include "jit_intf.h"
 #include <iostream>
 #include <ostream>
 #include "PlatformDependant.h"
@@ -49,7 +50,6 @@
 class PersistentInstructionId;
 class MemoryManager;
 class CompilationContext;
-struct AddrLocation;
 
 ///////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////////////
@@ -509,7 +509,7 @@
     virtual bool isCompileLoadEventRequired() = 0;
 
     // send compile
-    virtual void sendCompiledMethodLoadEvent(MethodDesc * methodDesc, 
+    virtual void sendCompiledMethodLoadEvent(MethodDesc* methodDesc, MethodDesc* outerDesc,
         uint32 codeSize, void* codeAddr, uint32 mapLength, 
         AddrLocation* addrLocationMap, void* compileInfo) = 0;
 
@@ -565,12 +565,6 @@
       * changes in JIT subcomponents interfaces CompilationContext struct is placed here.
       */
     CompilationContext* compilationContext;
-};
-
-// AddrLocation data structure should be put in VM-JIT interface
-struct AddrLocation {
-    void* start_addr;
-    uint16 location;
 };
 
 class DataInterface {

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp?view=diff&rev=507531&r1=507530&r2=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlJITInterface.cpp Wed Feb 14 05:55:31
2007
@@ -323,6 +323,9 @@
         false, // exe_do_code_mapping
         false, // exe_do_local_var_mapping
         false, // exe_insert_write_barriers
+        false, // exe_provide_access_to_this
+        false, // exe_restore_context_after_unwind
+        false, // exe_notify_compiled_method_load
     };
     return compilation_capabilities;
 }

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp?view=diff&rev=507531&r1=507530&r2=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.cpp Wed Feb 14 05:55:31
2007
@@ -994,17 +994,14 @@
     return mayInline == TRUE;
 }
 
-void DrlVMCompilationInterface::sendCompiledMethodLoadEvent(MethodDesc * methodDesc, 
+void DrlVMCompilationInterface::sendCompiledMethodLoadEvent(MethodDesc* methodDesc, MethodDesc*
outerDesc,
         uint32 codeSize, void* codeAddr, uint32 mapLength, 
         AddrLocation* addrLocationMap, void* compileInfo) {
-    // VM-JIT interface function should be called here instead of logging
-    if (Log::isEnabled()) {
-        Log::out() << "   ** Inlined method: " 
-                << methodDesc->getName() << std::endl;
-        Log::out() << "   ** Number of locations:" << mapLength 
-                << std::endl;
-    }
-    
+
+    Method_Handle method = (Method_Handle)getRuntimeMethodHandle(methodDesc);
+    Method_Handle outer  = (Method_Handle)getRuntimeMethodHandle(outerDesc);
+
+    compiled_method_load(method, codeSize, codeAddr, mapLength, addrLocationMap, compileInfo,
outer); 
 }
 
 bool DrlVMDataInterface::areReferencesCompressed() {

Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.h?view=diff&rev=507531&r1=507530&r2=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/vm/drl/DrlVMInterface.h Wed Feb 14 05:55:31
2007
@@ -552,11 +552,10 @@
     }
 
     bool isCompileLoadEventRequired() {
-        // additional compilation param is needed to handle this event
-        return false;
+        return compilation_params.exe_notify_compiled_method_load;
     }
 
-    virtual void sendCompiledMethodLoadEvent(MethodDesc * methodDesc, 
+    virtual void sendCompiledMethodLoadEvent(MethodDesc* methodDesc, MethodDesc* outerDesc,
         uint32 codeSize, void* codeAddr, uint32 mapLength, 
         AddrLocation* addrLocationMap, void* compileInfo);
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h?view=diff&rev=507531&r1=507530&r2=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h Wed Feb 14 05:55:31 2007
@@ -417,6 +417,7 @@
     Local_Var_Entry table[1];
 };
 
+class InlineInfo;
 
 struct Method : public Class_Member {
     friend void add_new_fake_method(Class* clss, Class* example, unsigned* next);
@@ -718,7 +719,37 @@
     // multiple breakpoints that are set in the same location by
     // different environments, it counts only unique locations
     uint32 pending_breakpoints;
+
+    /** Information about methods inlined to this. */
+    InlineInfo* _inline_info;
 public:
+
+    /**
+     * Gets inlined methods information.
+     * @return InlineInfo object pointer.
+     */
+    InlineInfo* get_inline_info() {
+        return _inline_info;
+    }
+
+    /**
+     * Adds information about inlined method.
+     * @param[in] method - method which is inlined
+     * @param[in] codeSize - size of inlined code block
+     * @param[in] codeAddr - size of inlined code block
+     * @param[in] mapLength - number of AddrLocation elements in addrLocationMap
+     * @param[in] addrLocationMap - native address to bytecode location
+     * correspondence table
+     */
+    void add_inline_info_entry(Method* method, uint32 codeSize, void* codeAddr,
+            uint32 mapLength, AddrLocation* addrLocationMap);
+
+    /**
+     * Sends JVMTI_EVENT_COMPILED_METHOD_LOAD event for every inline method 
+     * recorded in this InlineInfo object.
+     * @param[in] method - outer method this InlineInfo object belogs to.
+     */
+    void send_inlined_method_load_events(Method *method);
 
     unsigned get_line_number_table_size() {
         return (_line_number_table) ? _line_number_table->length : 0;

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/include/inline_info.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/inline_info.h?view=auto&rev=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/inline_info.h (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/inline_info.h Wed Feb 14 05:55:31 2007
@@ -0,0 +1,61 @@
+#ifndef __INLINE_INFO_H__
+#define __INLINE_INFO_H__
+
+#include <vector>
+#include "open/types.h"
+#include "jit_intf.h"
+#include "lock_manager.h"
+
+struct Method;
+
+/**
+ * Iformation about methods inlined to a given method.
+ * Instance of this class holds a collection of Entry objects.
+ */
+class InlineInfo
+{
+public:
+    /**
+     * Creates InlineInfo instance.
+     */
+    InlineInfo();
+
+    /**
+     * Adds information about inlined method.
+     * @param[in] method - method which is inlined
+     * @param[in] codeSize - size of inlined code block
+     * @param[in] codeAddr - size of inlined code block
+     * @param[in] mapLength - number of AddrLocation elements in addrLocationMap
+     * @param[in] addrLocationMap - native addresses to bytecode locations
+     *       correspondence table
+     */
+    void add(Method* method, uint32 codeSize, void* codeAddr, uint32 mapLength, 
+            AddrLocation* addrLocationMap);
+
+    /**
+     * Sends JVMTI_EVENT_COMPILED_METHOD_LOAD event for every inline method 
+     * recorded in this InlineInfo object.
+     * @param[in] method - outer method this InlineInfo object belogs to.
+     */
+    void send_compiled_method_load_event(Method *method);
+
+private:
+    /**
+     * Describes one inlined method code block.
+     */
+    struct Entry
+    {
+        Method* method;
+        uint32 codeSize;
+        void* codeAddr;
+        uint32 mapLength;
+        AddrLocation* addrLocationMap;
+    };
+
+    typedef std::vector<Entry>::iterator iterator;
+
+    std::vector<Entry> _entries;
+    Lock_Manager _lock;
+};
+
+#endif

Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/include/inline_info.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/include/inline_info.h
------------------------------------------------------------------------------
    svn:executable = *

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h?view=diff&rev=507531&r1=507530&r2=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jit_export.h Wed Feb 14 05:55:31 2007
@@ -176,6 +176,11 @@
     */
     Boolean  exe_restore_context_after_unwind : 1;
 
+    /**
+    * Sent CompileMethodLoad event when a method is compiled and loaded into memory 
+    */
+    Boolean  exe_notify_compiled_method_load : 1;
+
 } OpenMethodExecutionParams;
 
 

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h?view=diff&rev=507531&r1=507530&r2=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/include/jvmti_direct.h Wed Feb 14 05:55:31 2007
@@ -109,7 +109,12 @@
     
 void jvmti_send_vm_start_event(Global_Env *env, JNIEnv *jni_env);
 void jvmti_send_vm_init_event(Global_Env *env);
-void jvmti_send_compiled_method_load_event(Method *method);
+void jvmti_send_region_compiled_method_load_event(Method *method, uint32 codeSize, 
+                                  const void* codeAddr, uint32 mapLength, 
+                                  const AddrLocation* addrLocationMap, 
+                                  const void* compileInfo);
+void jvmti_send_chunks_compiled_method_load_event(Method *method);
+void jvmti_send_inlined_compiled_method_load_event(Method *method);
 void jvmti_send_dynamic_code_generated_event(const char *name, const void *address, jint
length);
 VMEXPORT void jvmti_send_contended_enter_or_entered_monitor_event(jobject obj, int isEnter);
 VMEXPORT void jvmti_send_wait_monitor_event(jobject obj, jlong timeout);

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp?view=diff&rev=507531&r1=507530&r2=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/Class.cpp Wed Feb 14 05:55:31
2007
@@ -40,6 +40,8 @@
 #include "cci.h"
 #include "interpreter.h"
 
+#include "inline_info.h"
+
 #ifdef _IPF_
 #include "vm_ipf.h"
 #endif // _IPF_
@@ -634,6 +636,7 @@
     _default_value = NULL;
 
     pending_breakpoints = 0;
+    _inline_info = NULL;
 } //Method::Method
 
 void Method::MethodClearInternals()
@@ -703,6 +706,8 @@
         _vtable_patch = _vtable_patch->next;
         STD_FREE(patch);
     }
+
+    delete _inline_info;
 }
 
 void Method::lock()
@@ -715,6 +720,21 @@
     _class->unlock();
 }
 
+void Method::add_inline_info_entry(Method* method, uint32 codeSize, void* codeAddr,
+        uint32 mapLength, AddrLocation* addrLocationMap) {
+    if (NULL == _inline_info) 
+        _inline_info = new InlineInfo();
+
+    _inline_info->add(method, codeSize, codeAddr, mapLength, 
+            addrLocationMap);
+}
+
+void Method::send_inlined_method_load_events(Method *method) {
+    if (NULL == _inline_info) 
+        return;
+
+    _inline_info->send_compiled_method_load_event(method);
+}
 
 ////////////////////////////////////////////////////////////////////
 // beginpointers between struct Class and java.lang.Class

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/inline_info.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/inline_info.cpp?view=auto&rev=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/inline_info.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/inline_info.cpp Wed Feb 14 05:55:31
2007
@@ -0,0 +1,39 @@
+#define LOG_DOMAIN "method.inline"
+#include "cxxlog.h"
+
+#include "inline_info.h"
+#include "class_member.h"
+#include "jvmti_direct.h"
+
+InlineInfo::InlineInfo(): _entries(0)
+{}
+
+void InlineInfo::add(Method* method, uint32 codeSize, void* codeAddr, 
+                     uint32 mapLength, AddrLocation* addrLocationMap)
+{
+    Entry entry = {method, codeSize, codeAddr, mapLength, addrLocationMap};
+ 
+    LMAutoUnlock au(& _lock);
+
+    TRACE("Adding Inlined method: " << method->get_class()->get_name()->bytes

+            << "." << method->get_name()->bytes 
+            << " " << method->get_descriptor()->bytes 
+            << "\taddress: " << codeAddr 
+            << " [" << codeSize << "]\t" 
+            << "mapLength: " << mapLength);
+
+   _entries.push_back(entry);
+} // InlineInfo::add
+
+void InlineInfo::send_compiled_method_load_event(Method *method)
+{
+    LMAutoUnlock au(& _lock);
+
+    for (iterator i = _entries.begin(); i != _entries.end(); i++) {
+        Entry& e = *i;
+        jvmti_send_region_compiled_method_load_event(e.method, e.codeSize,
+                e.codeAddr, e.mapLength, 
+                e.addrLocationMap, NULL);
+    }
+
+} // InlineInfo::send_compiled_method_load_event

Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/inline_info.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/src/class_support/inline_info.cpp
------------------------------------------------------------------------------
    svn:executable = *

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp?view=diff&rev=507531&r1=507530&r2=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jit/compile.cpp Wed Feb 14 05:55:31 2007
@@ -18,7 +18,7 @@
  * @author Intel, Alexei Fedotov
  * @version $Revision: 1.1.2.4.2.2.2.3 $
  */  
-#define LOG_DOMAIN "vm.core"
+#define LOG_DOMAIN "compile"
 #include "cxxlog.h"
 #include "vm_log.h"
 
@@ -582,7 +582,7 @@
 
 static JIT_Result compile_prepare_native_method(Method* method)
 {
-    TRACE2("compile", "compile_prepare_native_method(" << method_get_name(method) <<
")");
+    TRACE("compile_prepare_native_method(" << method_get_name(method) << ")");
 #ifdef VM_STATS
     VM_Statistics::get_vm_stats().num_native_methods++;
 #endif
@@ -642,8 +642,12 @@
     ch.env = VM_Global_State::loader_env;
     ch.jit = jit;
 
+    TRACE("compile_do_compilation_jit(): calling jit->compile_method_with_params() for
method " << method );
+
     JIT_Result res = jit->compile_method_with_params(&ch, method, flags);
 
+    TRACE("compile_do_compilation_jit(): returned from jit->compile_method_with_params()
for method " << method );
+
     if (JIT_SUCCESS != res) {
         if (!parallel_jit) {
             vm_env->p_jit_a_method_lock->_unlock();
@@ -676,7 +680,7 @@
 
     // Call TI callbacks
     if (ti->isEnabled() && ti->getPhase() == JVMTI_PHASE_LIVE) {
-        jvmti_send_compiled_method_load_event(method);
+        jvmti_send_chunks_compiled_method_load_event(method);
     }
     return JIT_SUCCESS;
 }
@@ -759,7 +763,7 @@
 {
     ASSERT_RAISE_AREA;
     ASSERT_NO_INTERPRETER;
-    TRACE2("compile", "compile_me " << method);
+    TRACE("compile_me " << method);
 
     GcFrame gc;
     compile_protect_arguments(method, &gc);
@@ -830,3 +834,26 @@
         list = next;
     }
 }
+
+VMEXPORT void compiled_method_load(Method_Handle method, uint32 codeSize, 
+                                  void* codeAddr, uint32 mapLength, 
+                                  AddrLocation* addrLocationMap, 
+                                  void* compileInfo, Method_Handle outer_method) 
+{
+    assert(method);
+    assert(outer_method);
+
+    outer_method->add_inline_info_entry(method, codeSize, codeAddr, mapLength,
+            addrLocationMap);
+
+    // Find TI environment
+    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
+
+    // Call TI callbacks
+    if (ti->isEnabled() && ti->getPhase() == JVMTI_PHASE_LIVE) {
+        jvmti_send_region_compiled_method_load_event(method, codeSize,
+            codeAddr, mapLength, addrLocationMap, NULL);
+    }
+}
+  
+

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp?view=diff&rev=507531&r1=507530&r2=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti.cpp Wed Feb 14 05:55:31 2007
@@ -780,6 +780,8 @@
     if (!ti->isEnabled())
         return;
 
+    flags->exe_notify_compiled_method_load = 1;
+
     flags->exe_do_code_mapping = flags->exe_do_local_var_mapping = 1;
 
     if (ti->get_global_capability(DebugUtilsTI::TI_GC_ENABLE_METHOD_ENTRY))

Modified: harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp?view=diff&rev=507531&r1=507530&r2=507531
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/jvmti/jvmti_event.cpp Wed Feb 14 05:55:31 2007
@@ -452,10 +452,30 @@
     oh_discard_local_handle(hThread);
 }
 
-void jvmti_send_compiled_method_load_event(Method *method)
+void jvmti_send_region_compiled_method_load_event(Method *method, uint32 codeSize, 
+                                  const void* codeAddr, uint32 mapLength, 
+                                  const AddrLocation* addrLocationMap, 
+                                  const void* compileInfo)
 {
     SuspendEnabledChecker sec;
 
+    if (codeSize <= 0 || NULL == codeAddr)
+        return;
+
+    // convert AddrLocation[] to jvmtiAddrLocationMap[]
+    jvmtiAddrLocationMap* jvmtiLocationMap = (jvmtiAddrLocationMap*) 
+            STD_MALLOC( mapLength * sizeof(jvmtiAddrLocationMap) );
+    for (uint32 i = 0; i < mapLength; i++) {
+        jlocation location = (jlocation) addrLocationMap[i].location;
+
+        if (location == 65535)
+            location = -1;
+
+        jvmtiLocationMap[i].location = location;
+
+        jvmtiLocationMap[i].start_address = addrLocationMap[i].start_addr;
+    }
+
     TIEnv *ti_env = VM_Global_State::loader_env->TI->getEnvironments();
     TIEnv *next_env;
     while (NULL != ti_env)
@@ -468,15 +488,12 @@
             if (NULL != func)
             {
                 TRACE2("jvmti.event.cml",
-                    "Callback JVMTI_EVENT_COMPILED_METHOD_LOAD called, method = " <<
+                    "Callback JVMTI_EVENT_COMPILED_METHOD_LOAD calling, method = " <<
                     method->get_class()->get_name()->bytes << "." <<
method->get_name()->bytes <<
                     method->get_descriptor()->bytes);
 
-                for (CodeChunkInfo* cci = method->get_first_JIT_specific_info();  cci;
 cci = cci->_next)
-                    if (cci->get_code_block_size() > 0 &&
-                        cci->get_code_block_addr() != NULL)
-                        func((jvmtiEnv*)ti_env, (jmethodID)method, cci->get_code_block_size(),
-                            cci->get_code_block_addr(), 0, NULL, NULL);
+                func((jvmtiEnv*)ti_env, (jmethodID)method, codeSize,
+                    codeAddr, mapLength, jvmtiLocationMap, NULL);
 
                 TRACE2("jvmti.event.cml",
                     "Callback JVMTI_EVENT_COMPILED_METHOD_LOAD finished, method = " <<
@@ -487,7 +504,90 @@
 
         ti_env = next_env;
     }
-}
+
+    STD_FREE(jvmtiLocationMap);
+} // jvmti_send_region_compiled_method_load_event
+
+void jvmti_send_inlined_compiled_method_load_event(Method *method)
+{
+    SuspendEnabledChecker sec;
+
+    method->send_inlined_method_load_events(method);
+} // jvmti_send_inlined_compiled_method_load_event
+
+void jvmti_send_chunks_compiled_method_load_event(Method *method)
+{
+    SuspendEnabledChecker sec;
+
+    TIEnv *ti_env = VM_Global_State::loader_env->TI->getEnvironments();
+    TIEnv *next_env;
+    while (NULL != ti_env)
+    {
+        next_env = ti_env->next;
+        if (ti_env->global_events[JVMTI_EVENT_COMPILED_METHOD_LOAD - JVMTI_MIN_EVENT_TYPE_VAL])
+        {
+            jvmtiEventCompiledMethodLoad func =
+                (jvmtiEventCompiledMethodLoad)ti_env->get_event_callback(JVMTI_EVENT_COMPILED_METHOD_LOAD);
+            if (NULL != func)
+            {
+                TRACE2("jvmti.event.cml",
+                    "Emitting JVMTI_EVENT_COMPILED_METHOD_LOAD for chuncks of " <<
+                    method->get_class()->get_name()->bytes << "." <<
method->get_name()->bytes <<
+                    method->get_descriptor()->bytes);
+
+                for (CodeChunkInfo* cci = method->get_first_JIT_specific_info();  cci;
 cci = cci->_next)
+                {
+                    jint code_size = cci->get_code_block_size();
+                    const void* code_addr = cci->get_code_block_addr();
+
+                    if ( code_size <= 0 || code_addr == NULL)
+                        continue;
+
+                    JIT* jit = cci->get_jit();
+
+                    jvmtiAddrLocationMap* jvmtiLocationMap = (jvmtiAddrLocationMap*) 
+                            STD_MALLOC( code_size * sizeof(jvmtiAddrLocationMap) );
+
+                    jint map_length = 0;
+
+                    for (int i = 0; i < code_size; i++)
+                    {
+                        NativeCodePtr ip = (NativeCodePtr) (((uint8*) code_addr) + i);
+                        uint16 bc = 12345;
+
+                        OpenExeJpdaError UNREF result =
+                            jit->get_bc_location_for_native(
+                                method, ip, &bc);
+
+                        jlocation location = (jlocation) bc;
+
+                        if (result != EXE_ERROR_NONE) 
+                            location = -1;
+
+                        if ( i == 0 || location != jvmtiLocationMap[map_length - 1].location
)
+                        {
+                            jvmtiLocationMap[map_length].location = location;
+                            jvmtiLocationMap[map_length].start_address = ip;
+                            map_length ++;
+                        }
+                    }
+
+                    func((jvmtiEnv*)ti_env, (jmethodID)method, code_size,
+                            code_addr, map_length, jvmtiLocationMap, NULL);
+
+                    STD_FREE(jvmtiLocationMap);
+                }
+
+                TRACE2("jvmti.event.cml",
+                    "Emitting JVMTI_EVENT_COMPILED_METHOD_LOAD done for chuncks of " <<
+                    method->get_class()->get_name()->bytes << "." <<
method->get_name()->bytes <<
+                    method->get_descriptor()->bytes);
+            }
+        }
+
+        ti_env = next_env;
+    }
+} // jvmti_send_chunks_compiled_method_load_event
 
 void jvmti_send_dynamic_code_generated_event(const char *name, const void *address, jint
length)
 {
@@ -512,6 +612,80 @@
     }
 }
 
+static jvmtiError generate_events_compiled_method_load(jvmtiEnv* env)
+{
+    // Capabilities checking
+    jvmtiCapabilities capa;
+    jvmtiGetCapabilities(env, &capa);
+    if (!capa.can_generate_compiled_method_load_events)
+        return JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
+
+    ClassLoader::LockLoadersTable();
+
+    /**
+    * First class loader is bootstrap class loader
+    */
+    int index = 0;
+    int cl_count = ClassLoader::GetClassLoaderNumber();
+    ClassLoader *classloader = VM_Global_State::loader_env->bootstrap_class_loader;
+    do
+    {
+        /**
+        * Create jclass handle for classes and set in jclass table
+        */
+        classloader->Lock();
+        ClassTable* tbl;
+        Class **klass;
+        ClassTable::iterator it;
+        tbl = classloader->GetLoadedClasses();
+        for(it = tbl->begin(); it != tbl->end(); it++)
+        {
+            klass = &it->second;
+            TRACE2("jvmti.event", "Class = " << (*klass)->get_name()->bytes);
+            if((*klass)->is_primitive())
+                continue;
+            if((*klass)->get_class_loader() != classloader)
+                continue;
+            if((*klass)->is_at_least_prepared())
+                for (int jjj = 0; jjj < (*klass)->get_number_of_methods(); jjj++)
+                {
+                    Method* method = (*klass)->get_method(jjj);
+                    TRACE2("jvmti.event", "    Method = " << method->get_name()->bytes
<<
+                        method->get_descriptor()->bytes <<
+                        (method->get_state() == Method::ST_Compiled ? " compiled" : "
not compiled"));
+                    if (method->get_state() == Method::ST_Compiled) {
+                        jvmti_send_chunks_compiled_method_load_event(method);
+                        jvmti_send_inlined_compiled_method_load_event(method);
+                    }
+                }
+        }
+        classloader->Unlock();
+
+        /**
+        * Get next class loader
+        */
+        if( index < cl_count ) {
+            classloader = (ClassLoader::GetClassLoaderTable())[index++];
+        } else {
+            break;
+        }
+    } while(true);
+
+    ClassLoader::UnlockLoadersTable();
+
+    return JVMTI_ERROR_NONE;
+} // generate_events_compiled_method_load
+
+static jvmtiError generate_events_dynamic_code_generated(jvmtiEnv* env)
+{
+    // FIXME: linked list usage without sync
+    for (DynamicCode *dcList = compile_get_dynamic_code_list();
+        NULL != dcList; dcList = dcList->next)
+        jvmti_send_dynamic_code_generated_event(dcList->name, dcList->address, dcList->length);
+
+    return JVMTI_ERROR_NONE;
+} // generate_events_dynamic_code_generated
+
 /*
  * Generate Events
  *
@@ -546,84 +720,15 @@
            72 == event_type || ((event_type >= 77) && (event_type <= 80)))
         return JVMTI_ERROR_INVALID_EVENT_TYPE;
 
-    if (JVMTI_EVENT_COMPILED_METHOD_LOAD != event_type &&
-        JVMTI_EVENT_DYNAMIC_CODE_GENERATED != event_type)
-        return JVMTI_ERROR_ILLEGAL_ARGUMENT;
-
-    if (JVMTI_EVENT_COMPILED_METHOD_LOAD == event_type)
-    {
-        // Capabilities checking
-        jvmtiCapabilities capa;
-        jvmtiGetCapabilities(env, &capa);
-        if (!capa.can_generate_compiled_method_load_events)
-            return JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
+    if (JVMTI_EVENT_COMPILED_METHOD_LOAD == event_type) {
+        return generate_events_compiled_method_load(env);
 
-        ClassLoader::LockLoadersTable();
-
-        /**
-         * First class loader is bootstrap class loader
-         */
-        int index = 0;
-        int cl_count = ClassLoader::GetClassLoaderNumber();
-        ClassLoader *classloader = VM_Global_State::loader_env->bootstrap_class_loader;
-        do
-        {
-            /**
-             * Create jclass handle for classes and set in jclass table
-             */
-            classloader->Lock();
-            ClassTable* tbl;
-            Class **klass;
-            ClassTable::iterator it;
-            tbl = classloader->GetLoadedClasses();
-            for(it = tbl->begin(); it != tbl->end(); it++)
-            {
-                klass = &it->second;
-                TRACE2("jvmti.event", "Class = " << (*klass)->get_name()->bytes);
-                if((*klass)->is_primitive())
-                    continue;
-                if((*klass)->get_class_loader() != classloader)
-                    continue;
-                if((*klass)->is_at_least_prepared())
-                    for (int jjj = 0; jjj < (*klass)->get_number_of_methods(); jjj++)
-                    {
-                        Method* method = (*klass)->get_method(jjj);
-                        TRACE2("jvmti.event", "    Method = " << method->get_name()->bytes
<<
-                            method->get_descriptor()->bytes <<
-                            (method->get_state() == Method::ST_Compiled ? " compiled"
: " not compiled"));
-                        if (method->get_state() == Method::ST_Compiled)
-                            jvmti_send_compiled_method_load_event(method);
-                    }
-            }
-            classloader->Unlock();
-
-            /**
-             * Get next class loader
-             */
-            if( index < cl_count ) {
-                classloader = (ClassLoader::GetClassLoaderTable())[index++];
-            } else {
-                break;
-            }
-        } while(true);
-
-        ClassLoader::UnlockLoadersTable();
-    }
-    else
-    {
-        Lock_Manager* dclock = VM_Global_State::loader_env->p_dclist_lock;
-        // Synchronizing access to dynamic code list
-        dclock->_lock();
-
-        for (DynamicCode *dcList = compile_get_dynamic_code_list();
-            NULL != dcList; dcList = dcList->next)
-            jvmti_send_dynamic_code_generated_event(dcList->name, dcList->address,
dcList->length);
-
-        dclock->_unlock();
+    } else if (JVMTI_EVENT_DYNAMIC_CODE_GENERATED == event_type) {
+        return generate_events_dynamic_code_generated(env);
     }
 
-    return JVMTI_ERROR_NONE;
-}
+    return JVMTI_ERROR_ILLEGAL_ARGUMENT;
+} // jvmtiGenerateEvents
 
 VMEXPORT void
 jvmti_process_method_entry_event(jmethodID method) {



Mime
View raw message