memory. All functions writing values into the data area return the offset
relative the begin of the code area (start of procedure).
- $Id: codegen-common.c 8215 2007-07-18 20:31:21Z michi $
-
*/
#include "toolbox/logging.h"
#include "native/jni.h"
+#include "native/localref.h"
#include "native/native.h"
#include "threads/threads-common.h"
bptr->branchrefs = NULL;
}
+ /* We need to clear all the patcher references from the codeinfo
+ since they all will be regenerated */
+
+ patcher_list_reset(code);
+
#if defined(ENABLE_REPLACEMENT)
code->rplpoints = NULL;
code->rplpointcount = 0;
if (opt_shownops)
PATCHER_NOPS;
- /* If the codegen provides a PACHER_LONGBRANCHES_NOPS macro, honour it. */
-
-#if defined(PATCHER_LONGBRANCHES_NOPS)
- if (CODEGENDATA_HAS_FLAG_LONGBRANCHES(cd)) {
- PATCHER_LONGBRANCHES_NOPS;
- }
-#endif
-
#if defined(ENABLE_JIT) && (defined(__I386__) || defined(__M68K__) || defined(__MIPS__) \
|| defined(__SPARC_64__) || defined(__X86_64__))
#if defined(ENABLE_JNI)
/* add current JNI local references table to this thread */
- lrt->capacity = LOCALREFTABLE_CAPACITY;
- lrt->used = 0;
- lrt->localframes = 1;
- lrt->prev = LOCALREFTABLE;
-
- /* clear the references array (memset is faster the a for-loop) */
-
- MSET(lrt->refs, 0, java_objectheader*, LOCALREFTABLE_CAPACITY);
-
- LOCALREFTABLE = lrt;
+ localref_table_add(lrt);
#endif
}
*******************************************************************************/
-java_objectheader *codegen_finish_native_call(u1 *datasp)
+java_object_t *codegen_finish_native_call(u1 *datasp)
{
- stackframeinfo *sfi;
- stackframeinfo **psfi;
-#if defined(ENABLE_JNI)
- localref_table *lrt;
- localref_table *plrt;
- s4 localframes;
-#endif
- java_objectheader *e;
+ stackframeinfo *sfi;
+ stackframeinfo **psfi;
+ java_handle_t *e;
/* get data structures from stack */
*psfi = sfi->prev;
#if defined(ENABLE_JNI)
- /* release JNI local references tables for this thread */
-
- lrt = LOCALREFTABLE;
-
- /* release all current local frames */
-
- for (localframes = lrt->localframes; localframes >= 1; localframes--) {
- /* get previous frame */
-
- plrt = lrt->prev;
-
- /* Clear all reference entries (only for tables allocated on
- the Java heap). */
-
- if (localframes > 1)
- MSET(&lrt->refs[0], 0, java_objectheader*, lrt->capacity);
-
- lrt->prev = NULL;
-
- /* set new local references table */
-
- lrt = plrt;
- }
-
- /* now store the previous local frames in the thread structure */
+ /* release JNI local references table for this thread */
- LOCALREFTABLE = lrt;
+ localref_frame_pop_all();
+ localref_table_remove();
#endif
/* get the exception and return it */