* dpas/dpas-parser.y (throw_builtin_exception): add static function
that makes jit_exception_builtin call.
+ * jit/jit-cache.c (_jit_cache_get_start_method): add function that
+ for an address in cache returns the start address of the block that
+ contains it.
+ * jit/jit-except.c (jit_stack_trace_get_offset): use
+ _jit_cache_get_start_method function instead of cache_start field.
+ * jit/jit-internal.h, jit/jit-function.c (jit_function_compile):
+ remove cache_start field to the jit_function struct.
+
2005-12-22 Aleksey Demakov <ademakov@gmail.com>
* jit/jit-rules-x86.sel: implement JIT_OP_MEMSET and JIT_OP_MEMCPY
return 1;
}
+void *_jit_cache_get_start_method(jit_cache_t cache, void *pc)
+{
+ /* TODO: This function is not currently aware of multiple regions. */
+ jit_cache_method_t node = cache->head.right;
+ while(node != &(cache->nil))
+ {
+ if(((unsigned char *)pc) < node->start)
+ {
+ node = GetLeft(node);
+ }
+ else if(((unsigned char *)pc) >= node->end)
+ {
+ node = GetRight(node);
+ }
+ else
+ {
+ return node->start;
+ }
+ }
+ return 0;
+}
+
void *_jit_cache_get_end_method(jit_cache_t cache, void *pc)
{
jit_cache_method_t parent_buf[16];
*/
void *_jit_cache_get_method(jit_cache_t cache, void *pc, void **cookie);
+/*
+ * Get the start of a method with a particular starting PC.
+ * Returns NULL if the PC could not be located.
+ * NOTE: This function is not currently aware of the
+ * possibility of multiple regions per function. To ensure
+ * correct results the ``pc'' argument has to be in the
+ * first region.
+ */
+void *_jit_cache_get_start_method(jit_cache_t cache, void *pc);
+
/*
* Get the end of a method with a particular starting PC.
* Returns NULL if the PC could not be located.
if (func)
{
#ifdef JIT_PROLOG_SIZE
- unsigned long offset = trace->items[posn] - func->cache_start;
- return _jit_cache_get_bytecode
- (cache, func->cache_start, offset, 0);
+ void *start = _jit_cache_get_start_method
+ (cache, func->entry_point);
#else
- unsigned long offset = trace->items[posn] - func->entry_point;
- return _jit_cache_get_bytecode
- (cache, func->entry_point, offset, 0);
+ void *start = func->entry_point;
#endif
+ unsigned long offset = trace->items[posn] - start;
+ return _jit_cache_get_bytecode(cache, start, offset, 0);
}
}
}
/* The function to call to perform on-demand compilation */
jit_on_demand_func on_demand;
- /* TODO: This field is used only if JIT_PROLOG_SIZE is defined.
- However the header that defines it is included after this one
- so "#ifdef JIT_PROLOG_SIZE" does not work here. */
- /* The start of the code cache. */
- void * cache_start;
-
#ifdef jit_redirector_size
/* Buffer that contains the redirector for this function.
Redirectors are used to support on-demand compilation */