harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gshiman...@apache.org
Subject svn commit: r597138 [14/15] - in /harmony/enhanced/drlvm/trunk: build/make/ build/make/components/vm/ vm/include/ vm/include/open/ vm/jitrino/src/codegenerator/ia32/ vm/port/src/encoder/ia32_em64t/ vm/port/src/lil/ia32/pim/ vm/tests/ncai/ vm/tests/ncai...
Date Wed, 21 Nov 2007 16:29:54 GMT
Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_methods.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_methods.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_methods.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_methods.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,137 @@
+/**
+ * @author Ilya Berezhniuk
+ * @version $Revision$
+ */
+
+//#include <memory.h>
+//#include <string.h>
+//#include <stdio.h>
+
+#define LOG_DOMAIN "ncai.methods"
+#include "cxxlog.h"
+#include "suspend_checker.h"
+#include "interpreter_exports.h"
+#include "jit_intf_cpp.h"
+#include "cci.h"
+
+#include "ncai_utils.h"
+#include "ncai_direct.h"
+#include "ncai_internal.h"
+
+
+ncaiError JNICALL
+ncaiGetMethodLocation(ncaiEnv *env, jmethodID method,
+    void** address_ptr, size_t* size_ptr)
+{
+    TRACE2("ncai.methods", "GetMethodLocation called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (address_ptr == NULL || size_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    if (method == NULL)
+        return NCAI_ERROR_INVALID_METHOD;
+
+    if (interpreter_enabled())
+        return NCAI_ERROR_INTERPRETER_USED;
+
+    Method* m = (Method*)method;
+
+    if (m->get_state() != Method::ST_Compiled)
+        return NCAI_ERROR_NOT_COMPILED;
+
+    *address_ptr = m->get_code_addr();
+
+    CodeChunkInfo* cci = m->get_first_JIT_specific_info();
+    *size_ptr = cci->get_code_block_size();
+
+    return NCAI_ERROR_NONE;
+}
+
+
+ncaiError JNICALL
+ncaiGetNativeLocation(ncaiEnv *env,
+    jmethodID method, jlocation location, void** address_ptr)
+{
+    TRACE2("ncai.methods", "GetNativeLocation called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (address_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    if (method == NULL)
+        return NCAI_ERROR_INVALID_METHOD;
+
+    if (interpreter_enabled())
+        return NCAI_ERROR_INTERPRETER_USED;
+
+    Method* m = (Method*)method;
+
+    if (m->get_state() != Method::ST_Compiled)
+        return NCAI_ERROR_NOT_COMPILED;
+
+#if defined (__INTEL_COMPILER)
+#pragma warning( push )
+#pragma warning (disable:1683) // to get rid of remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type
+#endif
+
+    if (location < 0 || unsigned(location) >= m->get_byte_code_size())
+        return NCAI_ERROR_INVALID_LOCATION;
+
+#if defined (__INTEL_COMPILER)
+#pragma warning( pop )
+#endif
+
+    // Find native location
+    NativeCodePtr np = NULL;
+
+    for (CodeChunkInfo* cci = m->get_first_JIT_specific_info();
+         cci; cci = cci->_next)
+    {
+        JIT *jit = cci->get_jit();
+        OpenExeJpdaError res = jit->get_native_location_for_bc(m,
+            (uint16)location, &np);
+        if (res == EXE_ERROR_NONE)
+            break;
+    }
+
+    if (NULL == np)
+        return NCAI_ERROR_INVALID_LOCATION;
+
+    *address_ptr = (void*)np;
+    return NCAI_ERROR_NONE;
+}
+
+
+ncaiError JNICALL
+ncaiIsMethodCompiled(ncaiEnv *env,
+    jmethodID method, jboolean* is_compiled_ptr)
+{
+    TRACE2("ncai.methods", "IsMethodCompiled called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (is_compiled_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    if (method == NULL)
+        return NCAI_ERROR_INVALID_METHOD;
+
+    if (interpreter_enabled())
+        return NCAI_ERROR_INTERPRETER_USED;
+
+    Method* m = (Method*)method;
+
+    *is_compiled_ptr =
+        (jboolean)(m->get_state() == Method::ST_Compiled);
+
+    return NCAI_ERROR_NONE;
+}

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

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_modules.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_modules.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_modules.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_modules.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,661 @@
+/**
+ * @author Petr Ivanov
+ * @version $Revision$
+ */
+
+#include <memory.h>
+#include <string.h>
+#include <stdio.h>
+
+#define LOG_DOMAIN "ncai.modules"
+#include "cxxlog.h"
+#include "environment.h"
+#include "natives_support.h"
+#include "native_modules.h"
+#include "open/hythread_ext.h"
+#include "ncai_utils.h"
+#include "ncai_direct.h"
+#include "ncai_internal.h"
+
+
+static ncaiError ncai_get_all_modules(ncaiModule* list, int* retCount);
+static bool is_module_in_list(NCAIEnv* ncai_env, ncaiModule module);
+static ncaiError ncai_get_module_info(ncaiModule module, ncaiModuleInfo *info_ptr);
+static ncaiError ncai_transform_modules_to_array(ncaiModule, ncaiModule**, int);
+static void ncai_clean_dead_modules_from_global_list(ncaiModule*);
+static void ncai_set_global_list_modules_dead(ncaiModule modules);
+static void ncai_mark_JNI_modules(ncaiModule modules);
+static ncaiError ncai_alloc_module(ncaiModule* dest);
+static void ncai_dealloc_module(ncaiModule module);
+
+
+ncaiError JNICALL
+ncaiGetAllLoadedModules (ncaiEnv *env,
+        jint *count_ptr,
+        ncaiModule **modules_ptr)
+{
+    TRACE2("ncai.modules", "GetAllLoadedModules called");
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    ncaiError res =
+        ncai_get_all_loaded_modules(env, count_ptr, modules_ptr);
+
+    TRACE2("ncai.modules", "GetAllLoadedModules returned");
+    return res;
+}
+
+ncaiError JNICALL
+ncaiGetModuleInfo (ncaiEnv *env,
+        ncaiModule module,
+        ncaiModuleInfo *info_ptr)
+{
+    TRACE2("ncai.modules", "GetModuleInfo called");
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (module == NULL || info_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    if (module->info == NULL)
+        return NCAI_ERROR_ILLEGAL_ARGUMENT;
+
+    LMAutoUnlock aulock(((NCAIEnv*)env)->env_lock);
+
+    if (!is_module_in_list((NCAIEnv*)env, module))
+    {
+        TRACE2("ncai.modules", "GetModuleInfo: module was not found in previously obtained list");
+        return NCAI_ERROR_INVALID_MODULE;
+    }
+
+    ncaiError err = ncai_get_module_info(module, info_ptr);
+
+    TRACE2("ncai.modules", "GetModuleInfo returned");
+    return err;
+}
+
+///////////////////////
+//Functions for internal use
+///////////////////////
+
+ncaiError
+ncai_get_all_loaded_modules(ncaiEnv *env,
+    jint *count_ptr, ncaiModule **modules_ptr)
+{
+    if (modules_ptr == NULL || count_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    NCAIEnv* ncai_env = (NCAIEnv*)env;
+    GlobalNCAI* ncai = VM_Global_State::loader_env->NCAI;
+    jint count = 0;
+    ncaiError res;
+
+    Lock_Manager* plock = env ? ncai_env->env_lock : &ncai->mod_lock;
+    ncaiModule* pmodules = env ? &ncai_env->modules : &ncai->modules;
+
+    LMAutoUnlock aulock(plock);
+
+    //gets the list of all modules from OS
+    res = ncai_get_all_modules(pmodules, &count);
+    if (res != NCAI_ERROR_NONE)
+        return res;
+
+    ncai_transform_modules_to_array(*pmodules, modules_ptr, count);
+    *count_ptr = count;
+
+    return NCAI_ERROR_NONE;
+}
+
+///////////////////////
+//Helper functions
+///////////////////////
+
+static bool is_module_in_list(NCAIEnv* ncai_env, ncaiModule module)
+{
+    assert(ncai_env);
+    ncaiModule modules = ncai_env->modules;
+
+    for (ncaiModule cur = modules; cur; cur = cur->next)
+    {
+        if (cur == module)
+            return true;
+    }
+
+    return false;
+}
+
+static ncaiError ncai_get_module_info(ncaiModule module, ncaiModuleInfo *info_ptr)
+{
+    ncaiModuleInfo mod_info;
+    ncaiSegmentInfo* seg_info = NULL;
+    seg_info = (ncaiSegmentInfo*)ncai_alloc(sizeof(ncaiSegmentInfo)*
+                                        (module->info->segment_count));
+    if (seg_info == NULL)
+        return NCAI_ERROR_OUT_OF_MEMORY;
+
+    for (size_t i = 0; i < module->info->segment_count; i++)
+    {
+        seg_info[i] = module->info->segments[i];
+    }
+
+    mod_info.kind = module->info->kind;
+    mod_info.name = strdup(module->info->name);
+    assert(mod_info.name);
+    mod_info.filename = strdup(module->info->filename);
+    assert(mod_info.filename);
+    mod_info.segment_count = module->info->segment_count;
+    mod_info.segments = seg_info;
+
+    *info_ptr = mod_info;
+
+    return NCAI_ERROR_NONE;
+}
+
+static void ncai_identify_module_is_VM(ncaiModule module)
+{
+    char* vm_modules[] = {"java", "vmcore", "harmonyvm", "em", "interpreter",
+        "gc", "gc_cc", "VMI", "vmi", "encoder", "jitrino", "hythr"};
+
+    for (size_t i = 0; i < sizeof(vm_modules)/sizeof(vm_modules[0]); i++)
+    {
+        if(strcmp(module->info->name, vm_modules[i]) == 0)
+        {
+            module->info->kind = NCAI_MODULE_VM_INTERNAL;
+            return;
+        }
+    }
+}
+
+static void ncai_set_global_list_modules_dead(ncaiModule modules)
+{
+    for( ; modules != NULL; modules = modules->next)
+    {
+        modules->isAlive = false;
+    }
+}
+
+static ncaiError ncai_transform_modules_to_array(ncaiModule list, ncaiModule** retArray, int count)
+{
+    ncaiModule* array;
+
+    array = (ncaiModule*) ncai_alloc(sizeof(ncaiModule) * count);
+
+    if (array == NULL)
+        return NCAI_ERROR_OUT_OF_MEMORY;
+
+    int i = 0;
+    for (ncaiModule current = list;
+         current != NULL; i++, current = current->next)
+    {
+        array[i] = current;
+    }
+
+    *retArray = array;
+    return NCAI_ERROR_NONE;
+}
+
+static void ncai_clean_dead_modules_from_global_list(ncaiModule* modules)
+{
+    // Address of 'next' in previous list item or address of list root
+    // Is a place where current->next must be placed when removing item
+    ncaiModule* plast_next = modules;
+
+    for (ncaiModule current = *modules; current != NULL;)
+    {
+        if (!current->isAlive)
+        {
+            *plast_next = current->next;
+            ncaiModule next = current->next;
+            ncai_dealloc_module(current);
+            current = next;
+        }
+        else
+        {
+            plast_next = &current->next;
+            current = current->next;
+        }
+    }
+}
+
+
+static void ncai_mark_JNI_modules(ncaiModule modules)
+{
+// natives_is_library_loaded_slow is used instead of natives_is_library_loaded
+// because natives_support module still receives both full and relative paths
+// FIXME: This is workaround, short file names without paths are compared
+    for ( ; modules != NULL; modules = modules->next)
+    {
+        if (modules->info->kind == NCAI_MODULE_OTHER &&
+            natives_is_library_loaded_slow(modules->info->filename))
+        {
+            modules->info->kind = NCAI_MODULE_JNI_LIBRARY;
+        }
+    }
+}
+
+static bool ncai_is_same_module(ncaiModule ncai_mod, native_module_t* module)
+{
+    if (ncai_mod->info->segment_count != module->seg_count)
+        return false;
+
+    if (strcmp(ncai_mod->info->filename, module->filename) != 0)
+        return false;
+
+    for (size_t i = 0; i < module->seg_count; i++)
+    {
+        if (ncai_mod->info->segments[i].base_address != module->segments[i].base ||
+            ncai_mod->info->segments[i].size != module->segments[i].size)
+        {
+            return false;
+        }
+    }
+
+    return true;
+}
+
+static ncaiModule ncai_find_module_in_global_list(ncaiModule modules,
+                native_module_t* module)
+{
+    for (ncaiModule current = modules;
+         current != NULL;
+         current = current->next)
+    {
+        if (ncai_is_same_module(current, module))
+            return current;
+    }
+
+    return NULL;
+}
+
+static ncaiError ncai_fill_module(ncaiModule* modulePtr, native_module_t* src)
+{
+    ncaiError error;
+    ncaiModule module;
+
+    error = ncai_alloc_module(&module);
+    if ( error != NCAI_ERROR_NONE)
+        return error;
+
+    module->info->segments =
+        (ncaiSegmentInfo*)ncai_alloc(sizeof(ncaiSegmentInfo)*src->seg_count);
+
+    if (module->info->segments == NULL)
+    {
+        ncai_dealloc_module(module);
+        return NCAI_ERROR_OUT_OF_MEMORY;
+    }
+
+    module->info->kind = NCAI_MODULE_OTHER;
+    module->info->segment_count = src->seg_count;
+
+    size_t pathsize = strlen(src->filename) + 1;
+    module->info->filename = (char*)ncai_alloc(pathsize);
+    if (module->info->filename == NULL)
+    {
+        ncai_dealloc_module(module);
+        return NCAI_ERROR_OUT_OF_MEMORY;
+    }
+
+    memcpy(module->info->filename, src->filename, pathsize);
+
+    module->info->name = ncai_parse_module_name(module->info->filename);
+
+    if (module->info->name == NULL)
+    {
+        ncai_dealloc_module(module);
+        return NCAI_ERROR_OUT_OF_MEMORY;
+    }
+
+    for (size_t i = 0; i < src->seg_count; i++)
+    {
+        if (src->segments[i].type == SEGMENT_TYPE_CODE)
+            module->info->segments[i].kind = NCAI_SEGMENT_CODE;
+        else if (src->segments[i].type == SEGMENT_TYPE_DATA)
+            module->info->segments[i].kind = NCAI_SEGMENT_DATA;
+        else
+            module->info->segments[i].kind = NCAI_SEGMENT_UNKNOWN;
+
+        module->info->segments[i].base_address = src->segments[i].base;
+        module->info->segments[i].size = src->segments[i].size;
+    }
+
+    module->isAlive = true;
+
+    *modulePtr = module;
+    return NCAI_ERROR_NONE;
+}
+
+static ncaiError ncai_add_module(ncaiModule* list, native_module_t* module)
+{
+    ncaiError error = NCAI_ERROR_NONE;
+
+    ncaiModule found =
+        ncai_find_module_in_global_list(*list, module);
+
+    if (found)
+    {
+        found->isAlive = true;
+    }
+    else
+    {
+        ncaiModule ncai_module;
+        error = ncai_fill_module(&ncai_module, module);
+
+        if (error == NCAI_ERROR_NONE)
+        {
+            ncai_module->next = *list;
+            *list = ncai_module;
+            ncai_identify_module_is_VM(ncai_module);
+        }
+    }
+
+    return error;
+}
+
+static ncaiError ncai_get_all_modules(ncaiModule* list, int* retCount)
+{
+    native_module_t* modules = NULL;
+    int mod_count;
+
+    ncai_set_global_list_modules_dead(*list);
+
+    bool result = get_all_native_modules(&modules, &mod_count);
+
+    if (!result)
+        return NCAI_ERROR_INTERNAL;
+
+    for (native_module_t* cur = modules; cur; cur = cur->next)
+    {
+        ncaiError error = ncai_add_module(list, cur);
+
+        if (error != NCAI_ERROR_NONE)
+        {
+            clear_native_modules(&modules);
+            return error;
+        }
+    }
+
+    clear_native_modules(&modules);
+    ncai_clean_dead_modules_from_global_list(list);
+    ncai_mark_JNI_modules(*list);
+
+    if (retCount)
+        *retCount = mod_count;
+
+    return NCAI_ERROR_NONE;
+}
+
+
+//allocates the memory for module, except for segments - those must be allocated, when the segments information is known.
+static ncaiError ncai_alloc_module(ncaiModule* dest)
+{
+    assert(dest);
+
+    ncaiModule module = (ncaiModule)ncai_alloc(sizeof(_ncaiModule));
+
+    if (module == NULL)
+        return NCAI_ERROR_OUT_OF_MEMORY;
+
+    module->next = NULL;
+    module->info = (ncaiModuleInfo*)ncai_alloc(sizeof(ncaiModuleInfo));
+
+    if (module->info == NULL)
+    {
+        ncai_free(module);
+        return NCAI_ERROR_OUT_OF_MEMORY;
+    }
+
+    *dest = module;
+    return NCAI_ERROR_NONE;
+}
+
+static void ncai_dealloc_module(ncaiModule module)
+{
+    assert(module);
+
+    if (module->info->name)
+        ncai_free(module->info->name);
+
+    if (module->info->filename)
+        ncai_free(module->info->filename);
+
+    if (module->info->segments)
+        ncai_free(module->info->segments);
+
+    if (module->info)
+        ncai_free(module->info);
+
+    ncai_free(module);
+}
+
+void clean_all_modules(ncaiModule* pmodules)
+{
+    while (*pmodules)
+    {
+        ncaiModule current = *pmodules;
+        *pmodules = current->next;
+        ncai_dealloc_module(current);
+    }
+}
+
+// Functions are in natives_support.cpp
+void lowercase_buf(char* name);
+char* short_name(const char* name, char* buf);
+
+// Returns true if short names are equal
+static bool
+compare_modules_by_short_name(ncaiModule module, const char* sh_name)
+{
+    char buf[_MAX_PATH + 1];
+
+    if (short_name(module->info->filename, buf) == NULL)
+        return false; // Error case
+
+    return (strcmp(buf, sh_name) == 0);
+}
+
+// Searches provided module list for a specified name
+// Must be called under modules lock
+static ncaiModule find_module_by_name(ncaiModule modules, const char* name)
+{
+    char name_buf[_MAX_PATH + 1];
+
+    if (short_name(name, name_buf) == NULL)
+        return NULL;
+
+    for(ncaiModule module = modules; module; module = module->next)
+    {
+        ncaiModuleInfo* info = module->info;
+
+        if (compare_modules_by_short_name(module, name_buf))
+            return module;
+    }
+
+    return NULL;
+}
+
+static bool is_same_modules(ncaiModule mod1, ncaiModule mod2)
+{
+    assert(mod1 && mod2);
+
+    ncaiModuleInfo* info1 = mod1->info;
+    ncaiModuleInfo* info2 = mod2->info;
+
+    if (info1->segment_count != info2->segment_count)
+        return false;
+
+    for (size_t i = 0; i < info1->segment_count; i++)
+    {
+        if (info1->segments[i].base_address != info2->segments[i].base_address ||
+            info1->segments[i].size != info2->segments[i].size)
+        {
+            return false;
+        }
+    }
+
+    return (strcmp(info1->filename, info2->filename) == 0);
+}
+
+static ncaiModule
+ncai_find_module_in_list(ncaiModule modules, ncaiModule module)
+{
+    for (ncaiModule current = modules;
+         current != NULL;
+         current = current->next)
+    {
+        if (is_same_modules(current, module))
+            return current;
+    }
+
+    return NULL;
+}
+
+static void
+find_init_module_record(NCAIEnv* env, ncaiModule module, ncaiModule* found)
+{
+    if (*found)
+        return;
+
+    ncaiModule* pmodules = &env->modules;
+
+    *found = ncai_find_module_in_list(*pmodules, module);
+
+    if (*found == NULL)
+    {
+        ncaiError err = ncai_get_all_modules(pmodules, NULL);
+        assert(err == NCAI_ERROR_NONE);
+
+        *found = ncai_find_module_in_list(*pmodules, module);
+        assert(*found);
+    }
+}
+
+typedef void (JNICALL * ncaiModLU)
+        (ncaiEnv *env, ncaiThread thread, ncaiModule module);
+
+static void report_loaded_unloaded_module(ncaiModule module, bool loaded)
+{
+    DebugUtilsTI *ti = VM_Global_State::loader_env->TI;
+
+    hythread_t hythread = hythread_self();
+    ncaiThread thread = reinterpret_cast<ncaiThread>(hythread);
+
+    bool suspend_enabled = hythread_is_suspend_enabled();
+
+    if (!suspend_enabled)
+        hythread_suspend_enable();
+
+    TIEnv *ti_env = ti->getEnvironments();
+    TIEnv *next_ti_env;
+
+    const char* trace_text = loaded ? "ModuleLoad" : "ModuleUnload";
+
+    while (NULL != ti_env)
+    {
+        next_ti_env = ti_env->next;
+
+        NCAIEnv* env = ti_env->ncai_env;
+
+        if (NULL == env)
+        {
+            ti_env = next_ti_env;
+            continue;
+        }
+
+        ncaiModuleLoad func_l =
+            (ncaiModuleLoad)env->get_event_callback(NCAI_EVENT_MODULE_LOAD);
+        ncaiModuleLoad func_u =
+            (ncaiModuleUnload)env->get_event_callback(NCAI_EVENT_MODULE_UNLOAD);
+
+        ncaiModule env_module = NULL;
+        ncaiModLU func = loaded ? (ncaiModLU)func_l : (ncaiModLU)func_u;
+        ncaiEventKind event =
+            loaded ? NCAI_EVENT_MODULE_LOAD : NCAI_EVENT_MODULE_UNLOAD;
+
+        if (NULL != func)
+        {
+            if (env->global_events[event - NCAI_MIN_EVENT_TYPE_VAL])
+            {
+                TRACE2("ncai.modules",
+                    "Calling global " << trace_text << " callback for module "
+                    << module->info->name);
+
+                find_init_module_record(env, module, &env_module);
+                func((ncaiEnv*)env, thread, env_module);
+
+                TRACE2("ncai.modules",
+                    "Finished global " << trace_text << " callback for module "
+                    << module->info->name);
+
+                ti_env = next_ti_env;
+                continue;
+            }
+
+            ncaiEventThread* next_et;
+            ncaiEventThread* first_et =
+                env->event_threads[event - NCAI_MIN_EVENT_TYPE_VAL];
+
+            for (ncaiEventThread* et = first_et; NULL != et; et = next_et)
+            {
+                next_et = et->next;
+
+                if (et->thread == thread)
+                {
+                    TRACE2("ncai.modules",
+                        "Calling local " << trace_text << " callback for module "
+                        << module->info->name);
+
+                    find_init_module_record(env, module, &env_module);
+                    func((ncaiEnv*)env, thread, env_module);
+
+                    TRACE2("ncai.modules",
+                        "Finished local " << trace_text << " callback for module "
+                        << module->info->name);
+                }
+                et = next_et;
+            }
+        }
+        ti_env = next_ti_env;
+    }
+
+    if (!suspend_enabled)
+        hythread_suspend_disable();
+}
+
+void ncai_library_load_callback(const char* name)
+{
+    GlobalNCAI* ncai = VM_Global_State::loader_env->NCAI;
+
+    if (!ncai->isEnabled())
+        return;
+
+    LMAutoUnlock lock(&ncai->mod_lock);
+
+    ncaiError err = ncai_get_all_modules(&ncai->modules, NULL);
+    assert(err == NCAI_ERROR_NONE);
+
+    ncaiModule module = find_module_by_name(ncai->modules, name);
+    assert(module);
+
+    report_loaded_unloaded_module(module, true);
+}
+
+void ncai_library_unload_callback(const char* name)
+{
+    GlobalNCAI* ncai = VM_Global_State::loader_env->NCAI;
+
+    if (!ncai->isEnabled())
+        return;
+
+    LMAutoUnlock lock(&ncai->mod_lock);
+
+    ncaiError err = ncai_get_all_modules(&ncai->modules, NULL);
+    assert(err == NCAI_ERROR_NONE);
+
+    ncaiModule module = find_module_by_name(ncai->modules, name);
+    assert(module);
+
+    report_loaded_unloaded_module(module, false);
+}

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

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_registers.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_registers.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_registers.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_registers.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,103 @@
+/**
+ * @author Ilya Berezhniuk
+ * @version $Revision$
+ */
+
+#define LOG_DOMAIN "ncai.registers"
+#include "cxxlog.h"
+
+#include "suspend_checker.h"
+#include "open/ncai_thread.h"
+//#include "ncai_utils.h"
+#include "ncai_internal.h"
+#include "ncai_direct.h"
+
+
+ncaiError JNICALL
+ncaiGetRegisterCount(ncaiEnv* env, jint* count_ptr)
+{
+    TRACE2("ncai.registers", "GetRegisterCount called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (count_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    *count_ptr = ncai_get_reg_table_size();
+    return NCAI_ERROR_NONE;
+}
+
+ncaiError JNICALL
+ncaiGetRegisterInfo(ncaiEnv *env, jint reg_number, ncaiRegisterInfo* info_ptr)
+{
+    TRACE2("ncai.registers", "GetRegisterInfo called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (reg_number < 0 || (size_t)reg_number >= ncai_get_reg_table_size())
+        return NCAI_ERROR_ACCESS_DENIED; // FIXME Select proper error code
+
+    if (info_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    info_ptr->name = g_ncai_reg_table[reg_number].name;
+    info_ptr->size = g_ncai_reg_table[reg_number].size;
+
+    return NCAI_ERROR_NONE;
+}
+
+ncaiError JNICALL
+ncaiGetRegisterValue(ncaiEnv *env, ncaiThread thread,
+    jint reg_number, void *buf)
+{
+    TRACE2("ncai.registers", "GetRegisterValue called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (reg_number < 0 || (size_t)reg_number >= ncai_get_reg_table_size())
+        return NCAI_ERROR_ACCESS_DENIED;
+
+    if (buf == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    hythread_t hythread = reinterpret_cast<hythread_t>(thread);
+
+    if (hythread_get_suspend_count_native(hythread) <= 0)
+        return NCAI_ERROR_THREAD_NOT_SUSPENDED;
+
+    ncai_get_register_value(hythread, reg_number, buf);
+
+    return NCAI_ERROR_NONE;
+}
+
+ncaiError JNICALL
+ncaiSetRegisterValue(ncaiEnv *env, ncaiThread thread,
+    jint reg_number, void *buf)
+{
+    TRACE2("ncai.registers", "SetRegisterValue called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (reg_number < 0 || (size_t)reg_number >= ncai_get_reg_table_size())
+        return NCAI_ERROR_ACCESS_DENIED;
+
+    if (buf == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    hythread_t hythread = reinterpret_cast<hythread_t>(thread);
+
+    if (hythread_get_suspend_count_native(hythread) <= 0)
+        return NCAI_ERROR_THREAD_NOT_SUSPENDED;
+
+    ncai_set_register_value(hythread, reg_number, buf);
+
+    return NCAI_ERROR_NONE;
+}

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

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_signals.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_signals.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_signals.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_signals.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,133 @@
+/**
+ * @author Ilya Berezhniuk
+ * @version $Revision$
+ */
+
+#define LOG_DOMAIN "ncai.signal"
+#include "cxxlog.h"
+#include "suspend_checker.h"
+#include "jvmti_internal.h"
+#include "environment.h"
+
+#include "ncai_utils.h"
+#include "ncai_direct.h"
+#include "ncai_internal.h"
+
+
+ncaiError JNICALL
+ncaiGetSignalCount(ncaiEnv *env, jint* count_ptr)
+{
+    TRACE2("ncai.signal", "GetSignalCount called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (count_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    *count_ptr = (jint)ncai_get_signal_count();
+    return NCAI_ERROR_NONE;
+}
+
+ncaiError JNICALL
+ncaiGetSignalInfo(ncaiEnv *env, jint signal, ncaiSignalInfo* info_ptr)
+{
+    TRACE2("ncai.signal", "GetSignalInfo called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (info_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    if (!ncai_is_signal_in_range(signal))
+        return NCAI_ERROR_ILLEGAL_ARGUMENT;
+
+    char* name = ncai_get_signal_name(signal);
+    if (name == NULL)
+        return NCAI_ERROR_ILLEGAL_ARGUMENT;
+
+    size_t name_size = ncai_get_signal_name_size(signal);
+    char* out_name = (char*)ncai_alloc(name_size);
+
+    if (out_name == NULL)
+        return NCAI_ERROR_OUT_OF_MEMORY;
+
+    memcpy(out_name, name, name_size);
+    info_ptr->name = out_name;
+    return NCAI_ERROR_NONE;
+}
+
+void ncai_process_signal_event(NativeCodePtr addr,
+        jint code, bool is_internal, bool* p_handled)
+{
+    if (!GlobalNCAI::isEnabled())
+        return;
+
+    DebugUtilsTI* ti = VM_Global_State::loader_env->TI;
+
+    hythread_t hythread = hythread_self();
+    ncaiThread thread = reinterpret_cast<ncaiThread>(hythread);
+    bool skip_handler = false;
+
+    TIEnv* next_env;
+    for (TIEnv* env = ti->getEnvironments(); env; env = next_env)
+    {
+        next_env = env->next;
+        NCAIEnv* ncai_env = env->ncai_env;
+
+        if (NULL == ncai_env)
+            continue;
+
+        ncaiSignal func =
+            (ncaiSignal)ncai_env->get_event_callback(NCAI_EVENT_SIGNAL);
+
+        if (NULL != func)
+        {
+            if (ncai_env->global_events[NCAI_EVENT_SIGNAL - NCAI_MIN_EVENT_TYPE_VAL])
+            {
+                TRACE2("ncai.signal", "Calling global Signal callback, address = "
+                    << addr << ", code = " << (void*)(size_t)code);
+
+                jboolean is_h = *p_handled;
+                func((ncaiEnv*)ncai_env, thread, (void*)addr, code, is_internal, &is_h);
+
+                if (!(*p_handled) && is_h)
+                    skip_handler = true;
+
+                TRACE2("ncai.signal", "Finished global Signal callback, address = "
+                    << addr << ", code = " << (void*)(size_t)code);
+
+                continue;
+            }
+
+            ncaiEventThread* next_et;
+            ncaiEventThread* first_et =
+                ncai_env->event_threads[NCAI_EVENT_SIGNAL - NCAI_MIN_EVENT_TYPE_VAL];
+
+            for (ncaiEventThread* et = first_et; NULL != et; et = next_et)
+            {
+                next_et = et->next;
+
+                if (et->thread == thread)
+                {
+                    TRACE2("ncai.signal", "Calling local Signal callback, address = "
+                        << addr << ", code = " << (void*)(size_t)code);
+
+                    jboolean is_h = *p_handled;
+                    func((ncaiEnv*)ncai_env, thread, (void*)addr, code, is_internal, &is_h);
+
+                    if (!(*p_handled) && is_h)
+                        skip_handler = true;
+
+                    TRACE2("ncai.signal", "Finished local Signal callback, address = "
+                        << addr << ", code = " << (void*)(size_t)code);
+                }
+
+                et = next_et;
+            }
+        }
+    }
+}

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

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_stack.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_stack.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_stack.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_stack.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,160 @@
+/**
+ * @author Ilya Berezhniuk
+ * @version $Revision$
+ */
+
+#define LOG_DOMAIN "ncai.stack"
+#include "cxxlog.h"
+
+#include "suspend_checker.h"
+#include "interpreter_exports.h"
+#include "open/ncai_thread.h"
+
+#include "native_stack.h"
+#include "ncai_utils.h"
+#include "ncai_direct.h"
+#include "ncai_internal.h"
+
+
+static ncaiError walk_native_stack(hythread_t thread,
+    int* pcount, int max_depth, native_frame_t* frame_array);
+
+
+ncaiError JNICALL
+ncaiGetFrameCount(ncaiEnv *env, ncaiThread thread, jint *count_ptr)
+{
+    TRACE2("ncai.stack", "GetFrameCount called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (thread == NULL)
+        return NCAI_ERROR_INVALID_THREAD;
+
+    if (count_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    hythread_t hythread = reinterpret_cast<hythread_t>(thread);
+
+    int count = 0;
+    ncaiError err = walk_native_stack(hythread, &count, -1, NULL);
+
+    if (err != NCAI_ERROR_NONE)
+        return err;
+
+    *count_ptr = count;
+    return NCAI_ERROR_NONE;
+}
+
+
+ncaiError JNICALL
+ncaiGetStackTrace(ncaiEnv *env, ncaiThread thread, jint depth,
+    ncaiFrameInfo* frame_buffer, jint *count_ptr)
+{
+    TRACE2("ncai.stack", "GetStackTrace called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (thread == NULL)
+        return NCAI_ERROR_INVALID_THREAD;
+
+    if (count_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    if (depth < 0)
+        return NCAI_ERROR_ILLEGAL_ARGUMENT;
+
+    if (depth == 0)
+    {
+        *count_ptr = 0;
+        return NCAI_ERROR_NONE;
+    }
+
+    if (frame_buffer == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    native_frame_t* frame_array =
+        (native_frame_t*)ncai_alloc(sizeof(native_frame_t)*depth);
+
+    if (!frame_array)
+        return NCAI_ERROR_OUT_OF_MEMORY;
+
+    hythread_t hythread = reinterpret_cast<hythread_t>(thread);
+
+    int count = 0;
+    ncaiError err = walk_native_stack(hythread, &count, depth, frame_array);
+    assert(count >= 0);
+
+    if (err != NCAI_ERROR_NONE)
+    {
+        ncai_free(frame_array);
+        return err;
+    }
+
+    for (jint i = 0; i < count; i++)
+    {
+        frame_buffer[i].java_frame_depth = frame_array[i].java_depth;
+        frame_buffer[i].pc_address = frame_array[i].ip;
+        frame_buffer[i].frame_address = frame_array[i].frame;
+        frame_buffer[i].stack_address = frame_array[i].stack;
+        frame_buffer[i].return_address = NULL;
+
+        if (i > 0)
+            frame_buffer[i - 1].return_address = frame_array[i].ip;
+    }
+
+    ncai_free(frame_array);
+    *count_ptr = count;
+    return NCAI_ERROR_NONE;
+}
+
+
+static ncaiError walk_native_stack(hythread_t thread,
+    int* pcount, int max_depth, native_frame_t* frame_array)
+{
+    if (!hythread_is_alive(thread))
+                return NCAI_ERROR_THREAD_NOT_ALIVE;
+
+    int suspend_count = hythread_get_suspend_count_native(thread);
+    hythread_t hself = hythread_self();
+
+    Registers regs;
+    int count = 0;
+    VM_thread* vm_thread;
+
+    if (hself == thread) //Current thread is not suspended
+    {
+        assert(suspend_count <= 0);
+
+        vm_thread = p_TLS_vmthread;
+
+        if (vm_thread == NULL)
+            return NCAI_ERROR_THREAD_NOT_ALIVE;
+
+        if (!vm_thread->jvmti_thread.flag_ncai_handler)
+            return NCAI_ERROR_THREAD_NOT_SUSPENDED;
+
+        regs = *((Registers*)vm_thread->jvmti_thread.jvmti_saved_exception_registers);
+    }
+    else
+    {
+        if (suspend_count <= 0)
+            return NCAI_ERROR_THREAD_NOT_SUSPENDED;
+
+        // We know that the thread is suspended
+        bool res = ncai_get_generic_registers(thread, &regs);
+
+        if (!res)
+            return NCAI_ERROR_INTERNAL;
+
+        vm_thread = jthread_get_vm_thread(thread);
+    }
+
+    *pcount = walk_native_stack_registers(&regs,
+                    vm_thread, max_depth, frame_array);
+
+    return NCAI_ERROR_NONE;
+}

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

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_step.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_step.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_step.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_step.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,584 @@
+/**
+ * @author Ilya Berezhniuk
+ * @version $Revision$
+ */
+
+#define LOG_DOMAIN "ncai.step"
+#include "cxxlog.h"
+#include "suspend_checker.h"
+#include "jvmti_break_intf.h"
+#include "classloader.h"
+
+#include "open/ncai_thread.h"
+#include "ncai_utils.h"
+#include "ncai_direct.h"
+#include "ncai_internal.h"
+
+
+static void ncai_send_single_step_events(DebugUtilsTI* ti,
+                    ncaiThread thread, NativeCodePtr addr);
+// Clean up postponed SS breakpoints list
+static void clear_pp_breakpoints(NCAISingleStepState* sss);
+// Check if instruction should not be reported in STEP_OUT mode (RET instruction)
+static bool ncai_do_not_report_step_out(NCAISingleStepState* sss);
+
+
+// Callback function for NCAI breakpoint processing
+static bool ncai_process_single_step_event(TIEnv *ti_env,
+                        const VMBreakPoint* bp, const POINTER_SIZE_INT data)
+{
+    TRACE2("ncai.step", "SINGLE STEP BREAKPOINT occured, address = " << bp->addr);
+    assert(ti_env == NULL);
+    assert(bp);
+    assert(bp->addr);
+
+    VM_thread* vm_thread = p_TLS_vmthread;
+    assert(vm_thread);
+    if (!vm_thread)
+        return false;
+
+    jvmti_thread_t jvmti_thread = &vm_thread->jvmti_thread;
+
+    // This check works for current thread only
+    if (jvmti_thread->flag_ncai_handler) // Recursion
+        return true;
+
+    jvmti_thread->flag_ncai_handler = true;
+
+    DebugUtilsTI* ti = VM_Global_State::loader_env->TI;
+    GlobalNCAI* ncai = VM_Global_State::loader_env->NCAI;
+    VMBreakPoints* vm_brpt = ti->vm_brpt;
+    NativeCodePtr addr = bp->addr;
+
+    vm_brpt->lock();
+    NCAISingleStepState* sss = jvmti_thread->ncai_ss;
+
+    if (!sss)
+    {
+        vm_brpt->unlock();
+        jvmti_thread->flag_ncai_handler = false;
+        return false;
+    }
+
+    ncaiStepMode step_mode = ncai_get_thread_ss_mode(jvmti_thread);
+    bool suspend_enabled = true;
+
+    vm_brpt->unlock();
+
+    if (!ncai->step_enabled)
+    {
+        TRACE2("ncai.step", "SINGLE STEP skipped due to disabling");
+    }
+    else if (step_mode == NCAI_STEP_OUT && ncai_do_not_report_step_out(sss))
+    {
+        TRACE2("ncai.step", "SINGLE STEP skipped due to unwanted instruction for NCAI_STEP_OUT");
+    }
+    else if (step_mode == NCAI_STEP_OFF)
+    {
+        TRACE2("ncai.step", "SINGLE STEP skipped due to NCAI_STEP_OFF");
+    }
+    else
+    {
+        ncaiModuleKind type = ncai_get_target_address_type(addr);
+
+        if (type == NCAI_MODULE_JNI_LIBRARY)
+        {
+            suspend_enabled = hythread_is_suspend_enabled();
+
+            if (!suspend_enabled)
+                hythread_suspend_enable();
+
+            hythread_t hythread = hythread_self();
+            ncaiThread thread = reinterpret_cast<ncaiThread>(hythread);
+            assert(vm_thread == jthread_get_vm_thread(hythread));
+
+            ncai_send_single_step_events(ti, thread, addr);
+        }
+    }
+
+    // Set breakpoints on instructions after the current one
+    ncai_setup_single_step(ncai, bp, jvmti_thread);
+
+    if (!suspend_enabled)
+        hythread_suspend_disable();
+
+    jvmti_thread->flag_ncai_handler = false;
+    return true;
+}
+
+static inline bool ncai_do_not_report_step_out(NCAISingleStepState* sss)
+{
+    return !sss->flag_out;
+}
+
+static void ncai_send_single_step_events(DebugUtilsTI* ti,
+                    ncaiThread thread, NativeCodePtr addr)
+{
+    TIEnv* env = ti->getEnvironments();
+    TIEnv* next_env;
+
+    while (NULL != env)
+    {
+        next_env = env->next;
+        NCAIEnv* ncai_env = env->ncai_env;
+
+        if (NULL == ncai_env)
+        {
+            env = next_env;
+            continue;
+        }
+
+        ncaiStep func =
+            (ncaiStep)ncai_env->get_event_callback(NCAI_EVENT_STEP);
+
+        if (NULL != func)
+        {
+            if (ncai_env->global_events[NCAI_EVENT_STEP - NCAI_MIN_EVENT_TYPE_VAL])
+            {
+                TRACE2("ncai.step", "Calling global SingleStep callback for address = " << addr);
+
+                func((ncaiEnv*)ncai_env, thread, (void*)addr);
+
+                TRACE2("ncai.step", "Finished global SingleStep callback for address = " << addr);
+
+                env = next_env;
+                continue;
+            }
+
+            ncaiEventThread* next_et;
+            ncaiEventThread* first_et =
+                ncai_env->event_threads[NCAI_EVENT_STEP - NCAI_MIN_EVENT_TYPE_VAL];
+
+            for (ncaiEventThread* et = first_et; NULL != et; et = next_et)
+            {
+                next_et = et->next;
+
+                if (et->thread == thread)
+                {
+                    TRACE2("ncai.step", "Calling local SingleStep callback for address = " << addr);
+
+                    func((ncaiEnv*)ncai_env, thread, (void*)addr);
+
+                    TRACE2("ncai.step", "Finished local SingleStep callback for address = " << addr);
+                }
+
+                et = next_et;
+            }
+        }
+
+        env = next_env;
+    }
+}
+
+ncaiModuleKind ncai_get_target_address_type(void* addr)
+{
+    jint count;
+    ncaiModule *modules;
+
+    ncaiError err = ncai_get_all_loaded_modules(NULL, &count, &modules);
+    assert(err == NCAI_ERROR_NONE);
+
+    ncaiModuleKind kind = NCAI_MODULE_OTHER;
+    bool found = false;
+
+    for (jint mod_index = 0; mod_index < count; mod_index++)
+    {
+        ncaiModuleInfo* info = modules[mod_index]->info;
+
+        for (size_t num = 0; !found && num < info->segment_count; num++)
+        {
+            ncaiSegmentInfo* seg = info->segments + num;
+
+            if (seg->base_address <= addr &&
+                (char*)seg->base_address + seg->size > addr)
+            {
+                found = true;
+                kind = info->kind;
+                break;
+            }
+        }
+    }
+
+    ncai_free(modules);
+    return kind;
+}
+
+static bool step_suspend_thread(NCAIEnv* env, hythread_t thread)
+{
+    if (thread == hythread_self())
+        return true;
+
+    if (!jthread_get_vm_thread(thread))
+        return false; // will be enabled in THREAD_START event
+
+    return (ncaiSuspendThread((ncaiEnv*)env, (ncaiThread)thread) == NCAI_ERROR_NONE);
+}
+
+static void step_resume_thread(NCAIEnv* env, hythread_t thread)
+{
+    if (thread == hythread_self())
+        return;
+
+    if (!jthread_get_vm_thread(thread))
+        return;
+
+    ncaiResumeThread((ncaiEnv*)env, (ncaiThread)thread);
+}
+
+bool ncai_start_thread_single_step(NCAIEnv* env, hythread_t thread)
+{
+    vm_thread_t vm_thread = jthread_get_vm_thread(thread);
+
+    if (!vm_thread)
+        return false;
+
+    // Suspend thread
+    if (!step_suspend_thread(env, thread))
+        return false;
+
+    VMBreakPoints* vm_brpt = env->ti_env->vm->vm_env->TI->vm_brpt;
+    VMLocalBreak* local_bp = vm_brpt->find_thread_local_break(vm_thread);
+
+    if (!local_bp)
+    {
+        step_resume_thread(env, thread);
+        return false;
+    }
+
+    VMBreakPoint* bp = local_bp->local_bp;
+    jvmti_thread_t jvmti_thread = &vm_thread->jvmti_thread;
+
+    ncai_check_alloc_ss_data(jvmti_thread);
+
+    if (jvmti_thread->ncai_ss->breakpoints)
+        jvmti_thread->ncai_ss->breakpoints->remove_all_reference();
+    else
+    {
+        jvmti_thread->ncai_ss->breakpoints =
+            vm_brpt->new_intf(NULL, ncai_process_single_step_event,
+            PRIORITY_NCAI_STEP_BREAKPOINT, false);
+        assert(jvmti_thread->ncai_ss->breakpoints);
+    }
+
+    jvmti_thread->ncai_ss->flag_out = false;
+    GlobalNCAI* ncai = VM_Global_State::loader_env->NCAI;
+    ncai_setup_single_step(ncai, bp, jvmti_thread);
+
+    // Resume thread
+    step_resume_thread(env, thread);
+    return true;
+}
+
+ncaiError ncai_start_single_step(NCAIEnv* env)
+{
+    TRACE2("ncai.step", "ncai_start_single_step called");
+    SuspendEnabledChecker sec;
+
+    GlobalNCAI* ncai = VM_Global_State::loader_env->NCAI;
+
+    if (ncai->step_enabled) // single step is enabled already
+        return NCAI_ERROR_NONE;
+
+    ncaiThread* threads;
+    jint thread_count;
+
+    ncaiError err = ncaiGetAllThreads((ncaiEnv*)env, &thread_count, &threads);
+
+    if (err != NCAI_ERROR_NONE)
+        return err;
+
+    assert(thread_count > 0);
+
+    VMBreakPoints* vm_brpt = env->ti_env->vm->vm_env->TI->vm_brpt;
+    LMAutoUnlock lock(vm_brpt->get_lock());
+
+    ncai->step_enabled = true;
+
+    for (jint i = 0; i < thread_count; i++)
+    {
+        ncai_start_thread_single_step(env, (hythread_t)threads[i]);
+    }
+
+    return NCAI_ERROR_NONE;
+}
+
+void ncai_stop_thread_single_step(jvmti_thread_t jvmti_thread)
+{
+    VMBreakPoints* vm_brpt = VM_Global_State::loader_env->TI->vm_brpt;
+    NCAISingleStepState* sss = jvmti_thread->ncai_ss;
+    assert(sss);
+
+    if (jvmti_thread->ncai_ss->breakpoints)
+    {
+        jvmti_thread->ncai_ss->breakpoints->remove_all_reference();
+        vm_brpt->release_intf(jvmti_thread->ncai_ss->breakpoints);
+    }
+
+    clear_pp_breakpoints(jvmti_thread->ncai_ss);
+    ncai_free(jvmti_thread->ncai_ss);
+    jvmti_thread->ncai_ss = NULL;
+}
+
+ncaiError ncai_stop_single_step(NCAIEnv* env)
+{
+    TRACE2("ncai.step", "ncai_stop_single_step called");
+    SuspendEnabledChecker sec;
+
+    GlobalNCAI* ncai = VM_Global_State::loader_env->NCAI;
+
+    if (!ncai->step_enabled) // single step is disabled already
+        return NCAI_ERROR_NONE;
+
+    ncaiThread* threads;
+    jint thread_count;
+
+    ncaiError err = ncaiGetAllThreads((ncaiEnv*)env, &thread_count, &threads);
+
+    if (err != NCAI_ERROR_NONE)
+        return err;
+
+    assert(thread_count > 0);
+
+    VMBreakPoints* vm_brpt = env->ti_env->vm->vm_env->TI->vm_brpt;
+    LMAutoUnlock lock(vm_brpt->get_lock());
+
+    ncai->step_enabled = false;
+
+    for (jint i = 0; i < thread_count; i++)
+    {
+        hythread_t hy_thread = (hythread_t)threads[i];
+        vm_thread_t vm_thread = jthread_get_vm_thread(hy_thread);
+
+        if (!vm_thread)
+            continue;
+
+        jvmti_thread_t jvmti_thread = &vm_thread->jvmti_thread;
+
+        if (!jvmti_thread->ncai_ss)
+            continue;
+
+        // Suspend thread
+        if (!step_suspend_thread(env, hy_thread))
+            continue;
+
+        ncai_stop_thread_single_step(jvmti_thread);
+
+        // Resume thread
+        step_resume_thread(env, hy_thread);
+    }
+
+    return NCAI_ERROR_NONE;
+}
+
+void ncai_check_alloc_ss_data(jvmti_thread_t jvmti_thread)
+{
+    if (jvmti_thread->ncai_ss)
+        return;
+
+    jvmti_thread->ncai_ss =
+        (NCAISingleStepState*)ncai_alloc(sizeof(NCAISingleStepState));
+    assert(jvmti_thread->ncai_ss);
+
+    jvmti_thread->ncai_ss->breakpoints = NULL;
+    jvmti_thread->ncai_ss->pplist = NULL;
+    jvmti_thread->ncai_ss->step_mode = NCAI_STEP_INTO;
+    jvmti_thread->ncai_ss->use_local_mode = true;
+    jvmti_thread->ncai_ss->flag_out = false;
+}
+
+// Infrastructure to store postponed single step breakpoints
+// which are used to continue single stepping after returning to JNI code from
+// VM or managed code
+
+struct st_pending_ss
+{
+    st_pending_ss*  next;
+    Method*         m;
+    size_t          count;
+    void*           addrs[1];
+};
+
+
+static void add_pp_breakpoints(Method* m, bool is_dummy)
+{
+    TRACE2("ncai.step.pp", "Storing postponed SS breakpoints entering method = " <<
+         m << ", is_dummy = " << (is_dummy ? "true" : "false"));
+
+    VM_thread* vm_thread = p_TLS_vmthread;
+    assert(vm_thread);
+
+    NCAISingleStepState* sss = vm_thread->jvmti_thread.ncai_ss;
+    assert(sss && sss->breakpoints);
+
+    size_t count = 0;
+
+    VMBreakPointRef* ref;
+
+    if (!is_dummy)
+    {
+        for (ref = sss->breakpoints->get_reference();
+             ref; ref = sss->breakpoints->get_next_reference(ref))
+        {
+            assert(ref->bp->addr);
+            count++;
+        }
+    }
+
+    st_pending_ss* pp =
+        (st_pending_ss*)STD_MALLOC(sizeof(st_pending_ss) + (count-1)*sizeof(void*));
+
+    pp->count = count;
+    pp->m = m;
+    pp->next = sss->pplist;
+    sss->pplist = pp;
+
+    if (is_dummy)
+        return;
+
+    count = 0;
+    for (ref = sss->breakpoints->get_reference();
+         ref; ref = sss->breakpoints->get_next_reference(ref))
+    {
+        pp->addrs[count++] = ref->bp->addr;
+    }
+}
+
+static void set_pp_breakpoints(Method* m)
+{
+    VM_thread* vm_thread = p_TLS_vmthread;
+    assert(vm_thread);
+
+    NCAISingleStepState* sss = vm_thread->jvmti_thread.ncai_ss;
+    assert(sss && sss->breakpoints);
+
+    TRACE2("ncai.step.pp", "Re-enabling postponed SS breakpoints exitting method = " <<
+            m << ", is_dummy = " << ((sss->pplist->count == 0) ? "true" : "false"));
+
+    if (!sss->pplist) // SS was enabled later than MethodEntry has occured
+        return;
+
+    assert(sss->pplist->m == m); // There should be exactly the same record
+
+    st_pending_ss* ptr = sss->pplist;
+
+    if (sss->pplist->count != 0) // Is not a dummy record
+    {
+        // Check that we've returned to non-JNI code from JNI method
+        for (VMBreakPointRef* ref = sss->breakpoints->get_reference();
+             ref; ref = sss->breakpoints->get_next_reference(ref))
+        {
+            assert(ref->bp->addr);
+            ncaiModuleKind type = ncai_get_target_address_type(ref->bp->addr);
+            assert(type != NCAI_MODULE_JNI_LIBRARY);
+        }
+
+        sss->breakpoints->remove_all_reference();
+    }
+
+    for (size_t i = 0; i < ptr->count; i++)
+    { // Setting up postponed breakpoints
+        sss->breakpoints->add_reference(ptr->addrs[i], 0);
+    }
+
+    sss->pplist = ptr->next;
+    STD_FREE(ptr);
+}
+
+static void clear_pp_breakpoints(NCAISingleStepState* sss)
+{
+    assert(sss);
+
+    if (!sss->pplist) // There are no postponed breakpoints
+        return;
+
+    while (sss->pplist)
+    {
+        st_pending_ss* ptr = sss->pplist;
+        sss->pplist = ptr->next;
+        STD_FREE(ptr);
+    }
+}
+
+
+void ncai_step_native_method_entry(Method* m)
+{
+    TRACE2("ncai.step", "Setting up SS breakpoint to "
+        << "metod entry for method: " << (void*)m);
+
+    assert(m->is_native());
+
+    VM_thread* vm_thread = p_TLS_vmthread;
+
+    if (!vm_thread)
+        return;
+
+    jvmti_thread_t jvmti_thread = &vm_thread->jvmti_thread;
+
+    ncaiStepMode step_mode = ncai_get_thread_ss_mode(jvmti_thread);
+    if (step_mode != NCAI_STEP_INTO && step_mode != NCAI_STEP_OFF)
+        return;
+
+    VMBreakPoints* vm_brpt = VM_Global_State::loader_env->TI->vm_brpt;
+
+    vm_brpt->lock();
+    NCAISingleStepState* sss = jvmti_thread->ncai_ss;
+
+    if (!sss || !sss->breakpoints)
+    {
+        vm_brpt->unlock();
+        return;
+    }
+
+    Class_Handle klass = method_get_class((Method_Handle)m);
+    ClassLoader* loader = (ClassLoader*)class_get_class_loader(klass);
+    GenericFunctionPointer func = loader->LookupNative((Method_Handle)m);
+    assert(func);
+
+    ncaiModuleKind type = ncai_get_target_address_type((void*)func);
+
+    if (type == NCAI_MODULE_VM_INTERNAL)
+    {
+        TRACE2("ncai.step", "Skipping, method is VM_INTERNAL");
+
+        add_pp_breakpoints(m, true);
+        vm_brpt->unlock();
+        return;
+    }
+
+    add_pp_breakpoints(m, false);
+
+    TRACE2("ncai.step", "Method entry address: " << (void*)func);
+    sss->breakpoints->remove_all_reference();
+    sss->breakpoints->add_reference((void*)func, 0);
+    vm_brpt->unlock();
+}
+
+void ncai_step_native_method_exit(Method* m)
+{
+    assert(m->is_native());
+
+    VM_thread* vm_thread = p_TLS_vmthread;
+
+    if (!vm_thread)
+        return;
+
+    jvmti_thread_t jvmti_thread = &vm_thread->jvmti_thread;
+
+    ncaiStepMode step_mode = ncai_get_thread_ss_mode(jvmti_thread);
+    if (step_mode != NCAI_STEP_INTO && step_mode != NCAI_STEP_OFF)
+        return;
+
+    VMBreakPoints* vm_brpt = VM_Global_State::loader_env->TI->vm_brpt;
+
+    vm_brpt->lock();
+    NCAISingleStepState* sss = jvmti_thread->ncai_ss;
+
+    if (!sss || !sss->breakpoints)
+    {
+        vm_brpt->unlock();
+        return;
+    }
+
+    set_pp_breakpoints(m);
+    vm_brpt->unlock();
+}

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

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_thread.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_thread.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_thread.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/ncai_thread.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,301 @@
+/**
+ * @author Ilya Berezhniuk
+ * @version $Revision$
+ */
+
+#define LOG_DOMAIN "ncai.thread"
+#include "cxxlog.h"
+
+#include "suspend_checker.h"
+#include "ncai_utils.h"
+#include <open/jthread.h>
+#include <open/ncai_thread.h>
+//#include "lock_manager.h"
+#include "Class.h"
+#include "jni_utils.h"
+#include "jvmti_internal.h"
+#include "ncai_internal.h"
+#include "ncai_direct.h"
+
+
+static bool ncai_thread_is_alive(hythread_t hythread);
+
+
+//////////////////////////////////////////////////////////////////////////////
+//  Interface functions
+//////////////////////////////////////////////////////////////////////////////
+
+ncaiError JNICALL
+ncaiGetAllThreads(ncaiEnv *env, jint *count_ptr, ncaiThread **threads_ptr)
+{
+    TRACE2("ncai.thread", "GetAllThreads called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (threads_ptr == NULL || count_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    hythread_group_t* groups;
+    int group_count;
+    IDATA status;
+    int i, res_count = 0;
+
+    status = hythread_group_get_list(&groups, &group_count);
+
+    if (status != TM_ERROR_NONE)
+        return NCAI_ERROR_INTERNAL;
+
+    for (i = 0; i < group_count; i++)
+    {
+        hythread_t cur_thread;
+        hythread_iterator_t iterator = hythread_iterator_create(groups[i]);
+
+        while (iterator && (cur_thread = hythread_iterator_next(&iterator)))
+        {
+            if (ncai_thread_is_alive(cur_thread))
+                res_count++;
+        }
+
+        hythread_iterator_release(&iterator);
+    }
+
+    ncaiThread* res_threads =
+        (ncaiThread*)ncai_alloc(sizeof(void*)*res_count);
+
+    if (res_threads == NULL)
+        return NCAI_ERROR_OUT_OF_MEMORY;
+
+    int index = 0;
+
+    for (i = 0; i < group_count; i++)
+    {
+        hythread_t cur_thread;
+        hythread_iterator_t iterator = hythread_iterator_create(groups[i]);
+
+        while (iterator && (cur_thread = hythread_iterator_next(&iterator)))
+        {
+            if (index >= res_count)
+                break; // some threads were created between two cycles
+
+            if (!ncai_thread_is_alive(cur_thread))
+                continue;
+
+            res_threads[index] = (ncaiThread)cur_thread;
+            ++index;
+        }
+
+        hythread_iterator_release(&iterator);
+    }
+
+    *threads_ptr = res_threads;
+    *count_ptr = index;
+    return NCAI_ERROR_NONE;
+}
+
+ncaiError JNICALL
+ncaiGetThreadInfo(ncaiEnv *env, ncaiThread thread, ncaiThreadInfo *info_ptr)
+{
+    TRACE2("ncai.thread", "ncaiGetThreadsInfo called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (info_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    if (thread == NULL)
+        return NCAI_ERROR_INVALID_THREAD;
+
+    hythread_t hythread = reinterpret_cast<hythread_t>(thread);
+
+    if (!ncai_thread_is_alive(hythread))
+        return NCAI_ERROR_THREAD_NOT_ALIVE;
+
+    jthread java_thread = jthread_get_java_thread(hythread);
+
+    if (java_thread != NULL)
+    {
+        JNIEnv* jni_env = jthread_get_vm_thread(hythread)->jni_env;
+        jclass cl = GetObjectClass(jni_env, java_thread);
+        jmethodID id = jni_env->GetMethodID(cl, "getName","()Ljava/lang/String;");
+        jstring  name = jni_env->CallObjectMethod(java_thread, id);
+        info_ptr->name = (char *)jni_env->GetStringUTFChars(name, NULL);
+
+        info_ptr->kind = NCAI_THREAD_JAVA;
+        return NCAI_ERROR_NONE;
+    }
+
+    info_ptr->kind = NCAI_THREAD_VM_INTERNAL;
+
+    char* name_int = "native_0x";
+    size_t name_len = strlen(name_int) + 4 + 1;
+    info_ptr->name = (char*)ncai_alloc(name_len);
+    assert(info_ptr->name);
+    sprintf(info_ptr->name, "%s%04X", name_int, hythread_get_id(hythread));
+
+    return NCAI_ERROR_NONE;
+}
+
+ncaiError JNICALL
+ncaiGetThreadHandle(ncaiEnv *env, jthread thread, ncaiThread *thread_ptr)
+{
+    TRACE2("ncai.thread", "GetThreadHandle called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (thread_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    if (thread == NULL)
+        return NCAI_ERROR_INVALID_THREAD;
+
+    hythread_t hythread = jthread_get_native_thread(thread);
+
+    if (hythread == NULL)
+        return NCAI_ERROR_INVALID_THREAD;
+
+    *thread_ptr = reinterpret_cast<ncaiThread>(hythread);
+
+    return NCAI_ERROR_NONE;
+}
+
+ncaiError JNICALL
+ncaiGetThreadObject(ncaiEnv *env, ncaiThread thread, jthread *thread_ptr)
+{
+    TRACE2("ncai.thread", "GetThreadObject called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (thread_ptr == NULL)
+        return NCAI_ERROR_NULL_POINTER;
+
+    if (thread == NULL)
+        return NCAI_ERROR_INVALID_THREAD;
+
+    hythread_t hythread = reinterpret_cast<hythread_t>(thread);
+
+    if (!ncai_thread_is_alive(hythread))
+        return NCAI_ERROR_THREAD_NOT_ALIVE;
+
+    jthread java_thread = jthread_get_java_thread(hythread);
+
+    *thread_ptr = java_thread;
+
+    return NCAI_ERROR_NONE;
+}
+
+ncaiError JNICALL
+ncaiSuspendThread(ncaiEnv *env, ncaiThread thread)
+{
+    TRACE2("ncai.thread", "SuspendThread called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (thread == NULL)
+        return NCAI_ERROR_INVALID_THREAD;
+
+    hythread_t hythread = reinterpret_cast<hythread_t>(thread);
+
+    if (!ncai_thread_is_alive(hythread))
+        return NCAI_ERROR_THREAD_NOT_ALIVE;
+
+    IDATA status = hythread_suspend_thread_native(hythread);
+
+    if (status != TM_ERROR_NONE)
+        return NCAI_ERROR_INTERNAL;
+
+    return NCAI_ERROR_NONE;
+}
+
+ncaiError JNICALL
+ncaiResumeThread(ncaiEnv *env, ncaiThread thread)
+{
+    TRACE2("ncai.thread", "ResumeThread called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (thread == NULL)
+        return NCAI_ERROR_INVALID_THREAD;
+
+    hythread_t hythread = reinterpret_cast<hythread_t>(thread);
+
+    if (!ncai_thread_is_alive(hythread))
+        return NCAI_ERROR_THREAD_NOT_ALIVE;
+
+    IDATA status = hythread_resume_thread_native(hythread);
+
+    if (status != TM_ERROR_NONE)
+        return NCAI_ERROR_INTERNAL;
+
+    return NCAI_ERROR_NONE;
+}
+
+ncaiError JNICALL
+ncaiTerminateThread(ncaiEnv *env, ncaiThread thread)
+{
+    TRACE2("ncai.thread", "TerminateThread called");
+    SuspendEnabledChecker sec;
+
+    if (env == NULL)
+        return NCAI_ERROR_INVALID_ENVIRONMENT;
+
+    if (thread == NULL)
+        return NCAI_ERROR_INVALID_THREAD;
+
+    hythread_t hythread = reinterpret_cast<hythread_t>(thread);
+
+    hythread_t self = hythread_self();
+
+    if (hythread == self)
+        return NCAI_ERROR_INVALID_THREAD;
+
+    assert(thread);
+
+    // grab hythread global lock
+    hythread_global_lock();
+
+    if (!ncai_thread_is_alive(hythread))
+    {
+        hythread_global_unlock();
+        return NCAI_ERROR_THREAD_NOT_ALIVE;
+    }
+
+    IDATA UNUSED status = jthread_vm_detach(jthread_get_vm_thread(hythread));
+    assert(status == TM_ERROR_NONE);
+
+    hythread_cancel(hythread);
+
+    // release hythread global lock
+    hythread_global_unlock();
+
+    return NCAI_ERROR_NONE;
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+// Helper functions
+//////////////////////////////////////////////////////////////////////////////
+
+static bool ncai_thread_is_alive(hythread_t hythread)
+{
+    if (!hythread)
+        return false;
+
+    vm_thread_t vm_thread = jthread_get_vm_thread(hythread);
+
+    if (!vm_thread || !vm_thread->java_thread)
+        return false;
+
+    return hythread_is_alive(hythread);
+}

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

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_memory_linux.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_memory_linux.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_memory_linux.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_memory_linux.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,287 @@
+/**
+ * @author Ilya Berezhniuk
+ * @version $Revision$
+ */
+#include <sys/mman.h>
+#include <limits.h>
+
+#include "port_vmem.h"
+#ifdef _IA32_
+#include "encoder.h"
+#include "jit_intf_cpp.h"
+#endif // #ifdef _IA32_
+#include "nogc.h"
+#include "dump.h"
+#include "ncai_direct.h"
+#include "ncai_internal.h"
+
+
+typedef void* (__cdecl *get_return_address_stub_type)();
+
+
+#ifdef _IA32_
+
+static get_return_address_stub_type gen_get_return_address_stub()
+{
+    static get_return_address_stub_type addr = NULL;
+
+    if (addr)
+        return addr;
+
+    const int stub_size = 0x04;
+    char *stub = (char *)malloc_fixed_code_for_jit(stub_size, DEFAULT_CODE_ALIGNMENT, CODE_BLOCK_HEAT_COLD, CAA_Allocate);
+#ifdef _DEBUG
+    memset(stub, 0xcc /*int 3*/, stub_size);
+#endif
+    char *ss = stub;
+
+    M_Base_Opnd m1(esp_reg, 0);
+    ss = mov(ss,  eax_opnd,  m1);
+    ss = ret(ss);
+
+    addr = (get_return_address_stub_type)stub;
+    assert(ss - stub <= stub_size);
+
+    /*
+       The following code will be generated:
+
+        mov         eax,dword ptr [esp]
+        ret
+    */
+
+    DUMP_STUB(stub, "get_return_address", ss - stub);
+
+    return addr;
+}
+#endif // #ifdef _IA32_
+
+
+ncaiError ncai_read_memory_internal(void* addr, size_t size, void* buf, bool UNUSED calc_pass = false)
+{
+#ifndef _IA32_
+    // SIGSEGV processing is not implemented for EM64T/IPF
+    memcpy(buf, addr, size);
+    return NCAI_ERROR_NONE;
+#else // #ifndef _IA32_
+
+static void* read_memory_1st_label = NULL;
+static void* read_memory_2nd_label = NULL;
+
+    char dummy_str[3];
+
+    if (calc_pass)
+    {
+        addr = dummy_str;
+        buf = dummy_str;
+        *dummy_str = 'a'; // To avoid warnings
+        size = 1;
+    }
+
+    jvmti_thread_t jvmti_thread = &p_TLS_vmthread->jvmti_thread;
+
+    unsigned char* src_ptr = (unsigned char*)addr;
+    unsigned char* dest_ptr = (unsigned char*)buf;
+
+    jvmti_thread->violation_flag = 1;
+    jvmti_thread->violation_restart_address = read_memory_1st_label;
+
+    size_t i;
+    for (i = 0; i < size; i++)
+    {
+        *dest_ptr = *src_ptr;
+
+        void* label = (gen_get_return_address_stub())();
+        read_memory_1st_label = label;
+
+        if (jvmti_thread->violation_flag == 0)
+            break;
+
+        ++src_ptr;
+        ++dest_ptr;
+    }
+
+    if (jvmti_thread->violation_flag == 0 || calc_pass)
+    {
+        if (!calc_pass)
+        {
+            size_t* page_sizes = port_vmem_page_sizes();
+            size_t page_size = page_sizes[0];
+
+            POINTER_SIZE_INT start =
+                ((POINTER_SIZE_INT)addr + i) & ~(page_size - 1);
+            POINTER_SIZE_INT pastend =
+                ((POINTER_SIZE_INT)addr + size + page_size - 1) & ~(page_size - 1);
+
+            int result = mprotect((void*)start, pastend - start,
+                                    PROT_READ | PROT_WRITE | PROT_EXEC);
+
+            if (result == EAGAIN)
+            {
+                timespec delay = {0, 10};
+                nanosleep(&delay, NULL);
+                result = mprotect((void*)start, pastend - start,
+                                    PROT_READ | PROT_WRITE | PROT_EXEC);
+            }
+
+            if (result != 0)
+                return NCAI_ERROR_ACCESS_DENIED;
+        }
+
+        if (calc_pass)
+            ++size;
+
+        jvmti_thread->violation_flag = 1;
+        jvmti_thread->violation_restart_address = read_memory_2nd_label;
+
+        for (; i < size; i++)
+        {
+            *dest_ptr++ = *src_ptr++;
+
+            void* label = (gen_get_return_address_stub())();
+            read_memory_2nd_label = label;
+
+            if (jvmti_thread->violation_flag == 0)
+                return NCAI_ERROR_ACCESS_DENIED;
+        }
+    }
+
+    jvmti_thread->violation_flag = 0;
+    return NCAI_ERROR_NONE;
+#endif // #ifndef _IA32_
+}
+
+
+ncaiError ncai_read_memory(void* addr, size_t size, void* buf)
+{
+    if (!buf || !addr)
+        return NCAI_ERROR_NULL_POINTER;
+
+    if (size == 0)
+        return NCAI_ERROR_ILLEGAL_ARGUMENT;
+
+    if (p_TLS_vmthread == NULL)
+        return NCAI_ERROR_INTERNAL;
+
+    if (ncai_read_memory_internal(NULL, 0, NULL, true) != NCAI_ERROR_NONE)
+        return NCAI_ERROR_INTERNAL;
+
+    return ncai_read_memory_internal(addr, size, buf, false);
+}
+
+
+static ncaiError ncai_write_memory_internal(void* addr, size_t size, void* buf, bool UNUSED calc_pass = false)
+{
+#ifndef _IA32_
+    // SIGSEGV processing is not implemented for EM64T/IPF
+    memcpy(addr, buf, size);
+    return NCAI_ERROR_NONE;
+#else // #ifndef _IA32_
+
+static void* write_memory_1st_label = NULL;
+static void* write_memory_2nd_label = NULL;
+
+    char dummy_str[3];
+
+    if (calc_pass)
+    {
+        addr = dummy_str;
+        buf = dummy_str;
+        *dummy_str = 'a'; // To avoid warnings
+        size = 1;
+    }
+
+    jvmti_thread_t jvmti_thread = &p_TLS_vmthread->jvmti_thread;
+
+    unsigned char* src_ptr = (unsigned char*)buf;
+    unsigned char* dest_ptr = (unsigned char*)addr;
+
+    jvmti_thread->violation_flag = 1;
+    jvmti_thread->violation_restart_address = write_memory_1st_label;
+
+    size_t i;
+    for (i = 0; i < size; i++)
+    {
+        *dest_ptr = *src_ptr;
+
+        void* label = (gen_get_return_address_stub())();
+        write_memory_1st_label = label;
+
+        if (jvmti_thread->violation_flag == 0)
+            break;
+
+        ++src_ptr;
+        ++dest_ptr;
+    }
+
+    if (jvmti_thread->violation_flag == 0 || calc_pass)
+    {
+        if (!calc_pass)
+        {
+            size_t* page_sizes = port_vmem_page_sizes();
+            size_t page_size = page_sizes[0];
+
+            POINTER_SIZE_INT start =
+                ((POINTER_SIZE_INT)addr + i) & ~(page_size - 1);
+            POINTER_SIZE_INT pastend =
+                ((POINTER_SIZE_INT)addr + size + page_size - 1) & ~(page_size - 1);
+
+            int result = mprotect((void*)start, pastend - start,
+                                    PROT_READ | PROT_WRITE | PROT_EXEC);
+
+            if (result == EAGAIN)
+            {
+                timespec delay = {0, 10};
+                nanosleep(&delay, NULL);
+                result = mprotect((void*)start, pastend - start,
+                                    PROT_READ | PROT_WRITE | PROT_EXEC);
+            }
+
+            if (result != 0)
+                return NCAI_ERROR_ACCESS_DENIED;
+        }
+
+        if (calc_pass)
+            ++size;
+
+        jvmti_thread->violation_flag = 1;
+        jvmti_thread->violation_restart_address = write_memory_2nd_label;
+
+        for (; i < size; i++)
+        {
+            *dest_ptr++ = *src_ptr++;
+
+            void* label = (gen_get_return_address_stub())();
+            write_memory_2nd_label = label;
+
+            if (jvmti_thread->violation_flag == 0)
+                return NCAI_ERROR_ACCESS_DENIED;
+        }
+    }
+
+#ifdef _IPF_
+    asm volatile ("mf" ::: "memory");
+#else
+    __asm__("mfence");
+#endif
+
+    jvmti_thread->violation_flag = 0;
+    return NCAI_ERROR_NONE;
+#endif // #ifndef _IA32_
+}
+
+ncaiError ncai_write_memory(void* addr, size_t size, void* buf)
+{
+    if (!buf || !addr)
+        return NCAI_ERROR_NULL_POINTER;
+
+    if (size == 0)
+        return NCAI_ERROR_ILLEGAL_ARGUMENT;
+
+    if (p_TLS_vmthread == NULL)
+        return NCAI_ERROR_INTERNAL;
+
+    if (ncai_write_memory_internal(NULL, 0, NULL, true) != NCAI_ERROR_NONE)
+        return NCAI_ERROR_INTERNAL;
+
+    return ncai_write_memory_internal(addr, size, buf, false);
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_memory_linux.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_memory_win.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_memory_win.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_memory_win.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_memory_win.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,49 @@
+/**
+ * @author Ilya Berezhniuk
+ * @version $Revision$
+ */
+#include "ncai_direct.h"
+#include "ncai_internal.h"
+
+
+ncaiError ncai_read_memory(void* addr, size_t size, void* buf)
+{
+    if (!buf || !addr)
+        return NCAI_ERROR_NULL_POINTER;
+
+    if (size == 0)
+        return NCAI_ERROR_ILLEGAL_ARGUMENT;
+
+    SIZE_T bytes_read;
+
+    BOOL result = ReadProcessMemory(GetCurrentProcess(),
+                                    addr, buf, size, &bytes_read);
+    assert(bytes_read == size);
+
+    if (!result)
+        return NCAI_ERROR_ACCESS_DENIED;
+
+    return NCAI_ERROR_NONE;
+}
+
+ncaiError ncai_write_memory(void* addr, size_t size, void* buf)
+{
+    if (!buf || !addr)
+        return NCAI_ERROR_NULL_POINTER;
+
+    if (size == 0)
+        return NCAI_ERROR_ILLEGAL_ARGUMENT;
+
+    SIZE_T bytes_written;
+
+    BOOL result = WriteProcessMemory(GetCurrentProcess(),
+                                    addr, buf, size, &bytes_written);
+    assert(bytes_written == size);
+
+    if (!result)
+        return NCAI_ERROR_ACCESS_DENIED;
+
+    FlushInstructionCache(GetCurrentProcess(), addr, size);
+
+    return NCAI_ERROR_NONE;
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_memory_win.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_modules_linux.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_modules_linux.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_modules_linux.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_modules_linux.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,45 @@
+/**
+ * @author Petr Ivanov
+ * @version $Revision$
+ */
+
+#include <memory.h>
+#include <string.h>
+#include "ncai_utils.h"
+#include "ncai_internal.h"
+
+
+char* ncai_parse_module_name(char* filepath)
+{
+    size_t length = 0;
+    char* filename = strrchr(filepath, '/');
+    filename = filename ? (filename + 1) : filepath;
+    char* dot_so = strstr(filename, ".so");
+
+    if (dot_so != NULL) // We have shared library, cut off 'lib' too
+    {
+        if (memcmp(filename, "lib", 3) == 0)
+            filename += 3;
+
+        length = dot_so - filename;
+    }
+    else
+    {
+        dot_so = strstr(filename, ".exe");
+
+        if (dot_so != NULL)
+            length = dot_so - filename;
+        else
+            length = strlen(filename);
+    }
+
+    char* ret = (char*)ncai_alloc(length + 1);
+
+    if (ret)
+    {
+        memcpy(ret, filename, length);
+        ret[length] = '\0';
+    }
+
+    return ret;
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_modules_linux.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_modules_win.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_modules_win.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_modules_win.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_modules_win.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,45 @@
+/**
+ * @author Petr Ivanov
+ * @version $Revision$
+ */
+
+#include <memory.h>
+#include <string.h>
+#include "ncai_utils.h"
+#include "ncai_internal.h"
+
+
+char* ncai_parse_module_name(char* filepath)
+{
+    size_t length = 0;
+    char* filename = strrchr(filepath, '\\');
+
+    if (filename)
+    {
+        filename = filename + 1;
+        length = strlen(filename);
+        size_t dot_len = length - 4;
+        char* dot_pos = filename + dot_len;
+
+        if (strcmp(dot_pos, ".dll") == 0 ||
+            strcmp(dot_pos, ".exe") == 0)
+        {
+            length = dot_len;
+        }
+    }
+    else
+    {
+        filename = filepath;
+        length = strlen(filename);
+    }
+
+    char* ret = (char*)ncai_alloc(length + 1);
+    if (ret)
+    {
+        memcpy(ret, filename, length);
+        ret[length] = '\0';
+    }
+
+    return ret;
+}
+

Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_modules_win.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_signals_linux.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_signals_linux.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_signals_linux.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_signals_linux.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,110 @@
+/**
+ * @author Ilya Berezhniuk
+ * @version $Revision$
+ */
+
+#include "ncai_utils.h"
+#include "ncai_direct.h"
+#include "ncai_internal.h"
+
+#define STR_AND_SIZE(_x_) _x_, (strlen(_x_) + 1)
+
+struct st_signal_info
+{
+    jint    signal;
+    char*   name;
+    size_t  name_size;
+};
+
+static st_signal_info sig_table[] = {
+    {SIGHUP,     STR_AND_SIZE("SIGHUP")},
+    {SIGINT,     STR_AND_SIZE("SIGINT")},
+    {SIGQUIT,    STR_AND_SIZE("SIGQUIT")},
+    {SIGILL,     STR_AND_SIZE("SIGILL")},
+    {SIGTRAP,    STR_AND_SIZE("SIGTRAP")},
+    {SIGABRT,    STR_AND_SIZE("SIGABRT")},
+    {SIGFPE,     STR_AND_SIZE("SIGFPE")},
+    {SIGKILL,    STR_AND_SIZE("SIGKILL")},
+    {SIGSEGV,    STR_AND_SIZE("SIGSEGV")},
+    {SIGPIPE,    STR_AND_SIZE("SIGPIPE")},
+    {SIGALRM,    STR_AND_SIZE("SIGALRM")},
+    {SIGTERM,    STR_AND_SIZE("SIGTERM")},
+    {SIGUSR1,    STR_AND_SIZE("SIGUSR1")},
+    {SIGUSR2,    STR_AND_SIZE("SIGUSR2")},
+    {SIGCHLD,    STR_AND_SIZE("SIGCHLD")},
+    {SIGCONT,    STR_AND_SIZE("SIGCONT")},
+    {SIGSTOP,    STR_AND_SIZE("SIGSTOP")},
+    {SIGTSTP,    STR_AND_SIZE("SIGTSTP")},
+    {SIGTTIN,    STR_AND_SIZE("SIGTTIN")},
+    {SIGTTOU,    STR_AND_SIZE("SIGTTOU")},
+};
+
+size_t ncai_get_signal_count()
+{
+    return sizeof(sig_table)/sizeof(sig_table[0]);
+}
+
+static st_signal_info* find_signal(jint sig)
+{
+    for (size_t i = 0; i < ncai_get_signal_count(); i++)
+    {
+        if (sig_table[i].signal == sig)
+            return &sig_table[i];
+    }
+
+    return NULL;
+}
+
+jint ncai_get_min_signal()
+{
+    static int min_sig_value = sig_table[1].signal;
+
+    if (min_sig_value != sig_table[1].signal)
+        return min_sig_value;
+
+    min_sig_value = sig_table[0].signal;
+
+    for (size_t i = 1; i < ncai_get_signal_count(); i++)
+    {
+        if (sig_table[i].signal < min_sig_value)
+            min_sig_value = sig_table[i].signal;
+    }
+
+    return min_sig_value;
+}
+
+jint ncai_get_max_signal()
+{
+    static int max_sig_value = -1;
+
+    if (max_sig_value != -1)
+        return max_sig_value;
+
+    max_sig_value = sig_table[0].signal;
+
+    for (size_t i = 1; i < ncai_get_signal_count(); i++)
+    {
+        if (sig_table[i].signal > max_sig_value)
+            max_sig_value = sig_table[i].signal;
+    }
+
+    return max_sig_value;
+}
+
+char* ncai_get_signal_name(jint signal)
+{
+    st_signal_info* psig = find_signal(signal);
+    return psig ? psig->name : NULL;
+}
+
+size_t ncai_get_signal_name_size(jint signal)
+{
+    st_signal_info* psig = find_signal(signal);
+    return psig ? psig->name_size : 0;
+}
+
+bool ncai_is_signal_in_range(jint signal)
+{
+    return (signal >= ncai_get_min_signal() ||
+            signal <= ncai_get_max_signal());
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_signals_linux.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_signals_win.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_signals_win.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_signals_win.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_signals_win.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,92 @@
+/**
+ * @author Ilya Berezhniuk
+ * @version $Revision$
+ */
+
+#include "ncai_utils.h"
+#include "ncai_direct.h"
+#include "ncai_internal.h"
+
+#define STR_AND_SIZE(_x_) _x_, (strlen(_x_) + 1)
+
+struct st_signal_info
+{
+    uint32  signal;
+    char*   name;
+    size_t  name_size;
+};
+
+static st_signal_info sig_table[] = {
+    {0x40010005, STR_AND_SIZE("DBG_CONTROL_C")},
+    {0x40010008, STR_AND_SIZE("DBG_CONTROL_BREAK")},
+    {0x80000002, STR_AND_SIZE("EXCEPTION_DATATYPE_MISALIGNMENT")},
+    {0xC0000005, STR_AND_SIZE("EXCEPTION_ACCESS_VIOLATION")},
+    {0xC0000006, STR_AND_SIZE("EXCEPTION_IN_PAGE_ERROR")},
+    {0xC0000017, STR_AND_SIZE("STATUS_NO_MEMORY")},
+    {0xC000001D, STR_AND_SIZE("EXCEPTION_ILLEGAL_INSTRUCTION")},
+    {0xC0000025, STR_AND_SIZE("EXCEPTION_NONCONTINUABLE_EXCEPTION")},
+    {0xC0000026, STR_AND_SIZE("EXCEPTION_INVALID_DISPOSITION")},
+    {0xC000008C, STR_AND_SIZE("EXCEPTION_ARRAY_BOUNDS_EXCEEDED")},
+    {0xC000008D, STR_AND_SIZE("EXCEPTION_FLT_DENORMAL_OPERAND")},
+    {0xC000008E, STR_AND_SIZE("EXCEPTION_FLT_DIVIDE_BY_ZERO")},
+    {0xC000008F, STR_AND_SIZE("EXCEPTION_FLT_INEXACT_RESULT")},
+    {0xC0000090, STR_AND_SIZE("EXCEPTION_FLT_INVALID_OPERATION")},
+    {0xC0000091, STR_AND_SIZE("EXCEPTION_FLT_OVERFLOW")},
+    {0xC0000092, STR_AND_SIZE("EXCEPTION_FLT_STACK_CHECK")},
+    {0xC0000093, STR_AND_SIZE("EXCEPTION_FLT_UNDERFLOW")},
+    {0xC0000094, STR_AND_SIZE("EXCEPTION_INT_DIVIDE_BY_ZERO")},
+    {0xC0000095, STR_AND_SIZE("EXCEPTION_INT_OVERFLOW")},
+    {0xC0000096, STR_AND_SIZE("EXCEPTION_PRIV_INSTRUCTION")},
+    {0xC00000FD, STR_AND_SIZE("EXCEPTION_STACK_OVERFLOW")},
+    {0xC0000135, STR_AND_SIZE("STATUS_DLL_NOT_FOUND")},
+    {0xC0000138, STR_AND_SIZE("STATUS_ORDINAL_NOT_FOUND")},
+    {0xC0000139, STR_AND_SIZE("STATUS_ENTRYPOINT_NOT_FOUND")},
+    {0xC0000142, STR_AND_SIZE("STATUS_DLL_INIT_FAILED")},
+    {0xC06D007E, STR_AND_SIZE("MODULE_NOT_FOUND")},
+    {0xC06D007F, STR_AND_SIZE("PROCEDURE_NOT_FOUND")},
+    {0xE06D7363, STR_AND_SIZE("CPP_EXCEPTION")},
+};
+
+size_t ncai_get_signal_count()
+{
+    return sizeof(sig_table)/sizeof(sig_table[0]);
+}
+
+static st_signal_info* find_signal(jint sig)
+{
+    for (size_t i = 0; i < ncai_get_signal_count(); i++)
+    {
+        if ((jint)sig_table[i].signal == sig)
+            return &sig_table[i];
+    }
+
+    return NULL;
+}
+
+uint32 ncai_get_min_signal()
+{
+    return sig_table[0].signal;
+}
+
+uint32 ncai_get_max_signal()
+{
+    return sig_table[ncai_get_signal_count() - 1].signal;
+}
+
+char* ncai_get_signal_name(jint signal)
+{
+    st_signal_info* psig = find_signal(signal);
+    return psig ? psig->name : NULL;
+}
+
+size_t ncai_get_signal_name_size(jint signal)
+{
+    st_signal_info* psig = find_signal(signal);
+    return psig ? psig->name_size : 0;
+}
+
+bool ncai_is_signal_in_range(jint signal)
+{
+    return ((uint32)signal >= ncai_get_min_signal() ||
+            (uint32)signal <= ncai_get_max_signal());
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_signals_win.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_step_em64t.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_step_em64t.cpp?rev=597138&view=auto
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_step_em64t.cpp (added)
+++ harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_step_em64t.cpp Wed Nov 21 08:29:40 2007
@@ -0,0 +1,26 @@
+/**
+ * @author Ilya Berezhniuk
+ * @version $Revision$
+ */
+
+#define LOG_DOMAIN "ncai.step"
+#include "cxxlog.h"
+#include "jvmti_break_intf.h"
+
+#include "ncai_utils.h"
+#include "ncai_direct.h"
+#include "ncai_internal.h"
+
+
+void ncai_setup_single_step(GlobalNCAI* ncai,
+            const VMBreakPoint* bp, jvmti_thread_t jvmti_thread)
+{
+    TRACE2("ncai.step", "Setup predicted single step breakpoints: "
+        << "not implemented for em64t");
+}
+
+void ncai_setup_signal_step(jvmti_thread_t jvmti_thread, NativeCodePtr addr)
+{
+    TRACE2("ncai.step", "Setting up single step in exception handler: "
+        << "not implemented for em64t");
+}

Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/src/ncai/utils/ncai_step_em64t.cpp
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message