From: Christian Thalinger Date: Wed, 25 Jun 2008 11:49:51 +0000 (+0200) Subject: * Merged with tip. X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=eeb47fef67768a700bf4e6cdf94a8f23cab46ee5;hp=67b61c19e64fcdc4780d3b8fda58b551fa7b377e;p=cacao.git * Merged with tip. --- diff --git a/src/mm/boehm-gc/include/gc.h b/src/mm/boehm-gc/include/gc.h index 1dab4c214..19a657105 100644 --- a/src/mm/boehm-gc/include/gc.h +++ b/src/mm/boehm-gc/include/gc.h @@ -242,11 +242,6 @@ GC_API unsigned long GC_time_limit; */ GC_API void GC_init(void); -/* Added for cacao */ -int GC_signum1(); -int GC_signum2(); -/* cacao END */ - /* * general purpose allocation routines, with roughly malloc calling conv. * The atomic versions promise that no relevant pointers are contained diff --git a/src/mm/boehm-gc/pthread_stop_world.c b/src/mm/boehm-gc/pthread_stop_world.c index 85fa531cb..30ad9bef5 100644 --- a/src/mm/boehm-gc/pthread_stop_world.c +++ b/src/mm/boehm-gc/pthread_stop_world.c @@ -372,9 +372,6 @@ int GC_suspend_all() return n_live_threads; } -void lock_stopworld(int); -void unlock_stopworld(); - void GC_stop_world() { int i; @@ -561,16 +558,4 @@ void GC_stop_init() { } } -/* Added for cacao */ -int GC_signum1() -{ - return SIG_SUSPEND; -} - -int GC_signum2() -{ - return SIG_THR_RESTART; -} -/* cacao END */ - #endif diff --git a/src/threads/Makefile.am b/src/threads/Makefile.am index b6cf86dd5..1aa9df94f 100644 --- a/src/threads/Makefile.am +++ b/src/threads/Makefile.am @@ -49,8 +49,6 @@ noinst_LTLIBRARIES = \ if ENABLE_THREADS libthreads_la_SOURCES = \ - critical.c \ - critical.h \ lock-common.h \ mutex.h \ threadlist.c \ diff --git a/src/threads/critical.c b/src/threads/critical.c deleted file mode 100644 index 51c331747..000000000 --- a/src/threads/critical.c +++ /dev/null @@ -1,169 +0,0 @@ -/* src/threads/critical.c - restartable critical sections - - Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel, - C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, - E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, - J. Wenninger, Institut f. Computersprachen - TU Wien - - This file is part of CACAO. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - -*/ - - -#include "config.h" - -#include -#include - -#include "vm/types.h" - -#include "threads/critical.h" - -#include "toolbox/avl.h" - - -/* the AVL tree containing the critical sections */ - -static avl_tree_t *criticaltree; - - -/* prototypes *****************************************************************/ - -static int critical_comparator(const void *treenode, const void *node); - - -/* critical_init *************************************************************** - - Init global data structures. - -*******************************************************************************/ - -void critical_init(void) -{ - criticaltree = avl_create(&critical_comparator); -} - - -/* critical_comparator ********************************************************* - - Comparison function for AVL tree of critical section. - - IN: - treenode....node in the tree - node........node to compare with tree-node - - RETURN VALUE: - -1, 0, +1 for (pa <, ==, > pb) - -*******************************************************************************/ - -static int critical_comparator(const void *treenode, const void *node) -{ - const critical_section_node_t *treecsn; - const critical_section_node_t *csn; - - treecsn = treenode; - csn = node; - -#ifdef __S390__ -# define ADDR_MASK(x) ((u1 *)((s4)(x) & 0x7FFFFFFF)) -#else -# define ADDR_MASK(x) (x) -#endif - - /* compare for avl_find if we have found an entry */ - - if ( - (ADDR_MASK(treecsn->start) <= ADDR_MASK(csn->start)) && - (ADDR_MASK(csn->start) < ADDR_MASK(treecsn->end)) - ) - return 0; - - /* these are for walking the tree */ - - if (ADDR_MASK(treecsn->start) < ADDR_MASK(csn->start)) - return -1; - else - return 1; - -#undef ADDR_MASK -} - - -/* critical_section_register *************************************************** - - Register a critical section. - - IN: - csn....node for the critical section - -*******************************************************************************/ - -void critical_section_register(critical_section_node_t *csn) -{ - (void) avl_insert(criticaltree, csn); -} - - -/* critical_find_restart_point ************************************************* - - Find a restart point for the given PC, in case it is in a critical - section. - - IN: - pc.........PC - - OUT: - PC of the restart point, or - NULL if the given mcodeptr is not in a critical section - -*******************************************************************************/ - -u1 *critical_find_restart_point(u1 *pc) -{ - critical_section_node_t csnpc; - const critical_section_node_t *csn; - - /* fill the temporary node for comparison */ - - csnpc.start = pc; - - /* see if there's an entry for that PC */ - - csn = avl_find(criticaltree, &csnpc); - - if (csn == NULL) - return NULL; - - return csn->restart; -} - - -/* - * These are local overrides for various environment variables in Emacs. - * Please do not remove this and leave it at the end of the file, where - * Emacs will automagically detect them. - * --------------------------------------------------------------------- - * Local variables: - * mode: c - * indent-tabs-mode: t - * c-basic-offset: 4 - * tab-width: 4 - * End: - * vim:noexpandtab:sw=4:ts=4: - */ diff --git a/src/threads/critical.h b/src/threads/critical.h deleted file mode 100644 index 7bb2917c3..000000000 --- a/src/threads/critical.h +++ /dev/null @@ -1,86 +0,0 @@ -/* src/threads/native/critical.h - restartable critical sections - - Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel, - C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, - E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, - J. Wenninger, Institut f. Computersprachen - TU Wien - - This file is part of CACAO. - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2, or (at - your option) any later version. - - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. - - Contact: cacao@cacaojvm.org - - Authors: Stefan Ring - Edwin Steiner - - Changes: Christian Thalinger - -*/ - - -#ifndef _CRITICAL_H -#define _CRITICAL_H - -#include "config.h" - -#include /* required on some older Darwin systems for ucontext.h */ -#include - - -/* forward typedefs ***********************************************************/ - -typedef struct critical_section_node_t critical_section_node_t; - - -/* critical_section_node_t ***************************************************** - - A node representing a restartable critical section. - -*******************************************************************************/ - -struct critical_section_node_t { - u1 *start; - u1 *end; - u1 *restart; -}; - - -/* functions ******************************************************************/ - -void critical_init(void); -void critical_section_register(critical_section_node_t *); -u1 *critical_find_restart_point(u1*); - -/* this is a machine dependent function (see src/vm/jit/$(ARCH_DIR)/md.c) */ -void md_critical_section_restart(ucontext_t *_uc); - -#endif /* _CRITICAL_H */ - - -/* - * These are local overrides for various environment variables in Emacs. - * Please do not remove this and leave it at the end of the file, where - * Emacs will automagically detect them. - * --------------------------------------------------------------------- - * Local variables: - * mode: c - * indent-tabs-mode: t - * c-basic-offset: 4 - * tab-width: 4 - * End: - * vim:noexpandtab:sw=4:ts=4: - */ diff --git a/src/threads/posix/thread-posix.c b/src/threads/posix/thread-posix.c index d64e18d5e..8a19e1e7c 100644 --- a/src/threads/posix/thread-posix.c +++ b/src/threads/posix/thread-posix.c @@ -185,13 +185,6 @@ static int sem_destroy(sem_t *sem) #endif /* defined(__DARWIN__) */ -/* internally used constants **************************************************/ - -/* CAUTION: Do not change these values. Boehm GC code depends on them. */ -#define STOPWORLD_FROM_GC 1 -#define STOPWORLD_FROM_CLASS_NUMBERING 2 - - /* startupinfo ***************************************************************** Struct used to pass info from threads_start_thread to @@ -238,21 +231,11 @@ static mutex_t mutex_gc; static mutex_t mutex_join; static pthread_cond_t cond_join; -/* this is one of the STOPWORLD_FROM_ constants, telling why the world is */ -/* being stopped */ -static volatile int stopworldwhere; - #if defined(ENABLE_GC_CACAO) - /* semaphore used for acknowleding thread suspension */ static sem_t suspend_ack; -#if defined(__IRIX__) -static mutex_t suspend_ack_lock = MUTEX_INITIALIZER; -static pthread_cond_t suspend_cond = PTHREAD_COND_INITIALIZER; #endif -#endif /* ENABLE_GC_CACAO */ - /* mutexes used by the fake atomic instructions */ #if defined(USE_FAKE_ATOMIC_INSTRUCTIONS) mutex_t _cas_lock = MUTEX_INITIALIZER; @@ -340,187 +323,6 @@ void threads_sem_post(sem_t *sem) } -/* lock_stopworld ************************************************************** - - Enter the stopworld lock, specifying why the world shall be stopped. - - IN: - where........ STOPWORLD_FROM_GC (1) from within GC - STOPWORLD_FROM_CLASS_NUMBERING (2) class numbering - -******************************************************************************/ - -void lock_stopworld(int where) -{ - mutex_lock(&stopworldlock); -/* stopworldwhere = where; */ -} - - -/* unlock_stopworld ************************************************************ - - Release the stopworld lock. - -******************************************************************************/ - -void unlock_stopworld(void) -{ -/* stopworldwhere = 0; */ - mutex_unlock(&stopworldlock); -} - -/* XXX We disable that whole bunch of code until we have the exact-GC - running. Some of it may only be needed by the old Boehm-based - suspension handling. */ - -#if 0 - -#if !defined(__DARWIN__) -/* Caller must hold threadlistlock */ -static s4 threads_cast_sendsignals(s4 sig) -{ - threadobject *t; - threadobject *self; - s4 count; - - self = THREADOBJECT; - - /* iterate over all started threads */ - - count = 0; - - for (t = threadlist_first(); t != NULL; t = threadlist_next(t)) { - /* don't send the signal to ourself */ - - if (t == self) - continue; - - /* don't send the signal to NEW threads (because they are not - completely initialized) */ - - if (t->state == THREAD_STATE_NEW) - continue; - - /* send the signal */ - - pthread_kill(t->tid, sig); - - /* increase threads count */ - - count++; - } - - return count; -} - -#else - -static void threads_cast_darwinstop(void) -{ - threadobject *tobj = mainthreadobj; - threadobject *self = THREADOBJECT; - - do { - if (tobj != self) - { - thread_state_flavor_t flavor = MACHINE_THREAD_STATE; - mach_msg_type_number_t thread_state_count = MACHINE_THREAD_STATE_COUNT; -#if defined(__I386__) - i386_thread_state_t thread_state; -#else - ppc_thread_state_t thread_state; -#endif - mach_port_t thread = tobj->mach_thread; - kern_return_t r; - - r = thread_suspend(thread); - - if (r != KERN_SUCCESS) - vm_abort("thread_suspend failed"); - - r = thread_get_state(thread, flavor, (natural_t *) &thread_state, - &thread_state_count); - - if (r != KERN_SUCCESS) - vm_abort("thread_get_state failed"); - - md_critical_section_restart((ucontext_t *) &thread_state); - - r = thread_set_state(thread, flavor, (natural_t *) &thread_state, - thread_state_count); - - if (r != KERN_SUCCESS) - vm_abort("thread_set_state failed"); - } - - tobj = tobj->next; - } while (tobj != mainthreadobj); -} - -static void threads_cast_darwinresume(void) -{ - threadobject *tobj = mainthreadobj; - threadobject *self = THREADOBJECT; - - do { - if (tobj != self) - { - mach_port_t thread = tobj->mach_thread; - kern_return_t r; - - r = thread_resume(thread); - - if (r != KERN_SUCCESS) - vm_abort("thread_resume failed"); - } - - tobj = tobj->next; - } while (tobj != mainthreadobj); -} - -#endif - -#if defined(__IRIX__) -static void threads_cast_irixresume(void) -{ - mutex_lock(&suspend_ack_lock); - pthread_cond_broadcast(&suspend_cond); - mutex_unlock(&suspend_ack_lock); -} -#endif - -#if defined(ENABLE_GC_BOEHM) && !defined(__DARWIN__) -static void threads_sigsuspend_handler(ucontext_t *_uc) -{ - int sig; - sigset_t sigs; - - /* XXX TWISTI: this is just a quick hack */ -#if defined(ENABLE_JIT) - md_critical_section_restart(_uc); -#endif - - /* Do as Boehm does. On IRIX a condition variable is used for wake-up - (not POSIX async-safe). */ -#if defined(__IRIX__) - mutex_lock(&suspend_ack_lock); - threads_sem_post(&suspend_ack); - pthread_cond_wait(&suspend_cond, &suspend_ack_lock); - mutex_unlock(&suspend_ack_lock); -#elif defined(__CYGWIN__) - /* TODO */ - assert(0); -#else - - sig = GC_signum2(); - sigfillset(&sigs); - sigdelset(&sigs, sig); - sigsuspend(&sigs); -#endif -} -#endif - - /* threads_stopworld *********************************************************** Stops the world from turning. All threads except the calling one @@ -529,6 +331,7 @@ static void threads_sigsuspend_handler(ucontext_t *_uc) *******************************************************************************/ +#if defined(ENABLE_GC_CACAO) void threads_stopworld(void) { #if !defined(__DARWIN__) && !defined(__CYGWIN__) @@ -538,7 +341,7 @@ void threads_stopworld(void) s4 count, i; #endif - lock_stopworld(STOPWORLD_FROM_CLASS_NUMBERING); + mutex_lock(&stopworldlock); /* lock the threads lists */ @@ -589,6 +392,7 @@ void threads_stopworld(void) non-signaled NEW threads can't change their state and execute code. */ } +#endif /* threads_startworld ********************************************************** @@ -597,6 +401,7 @@ void threads_stopworld(void) *******************************************************************************/ +#if defined(ENABLE_GC_CACAO) void threads_startworld(void) { #if !defined(__DARWIN__) && !defined(__CYGWIN__) @@ -654,9 +459,8 @@ void threads_startworld(void) threadlist_unlock(); - unlock_stopworld(); + mutex_unlock(&stopworldlock); } - #endif @@ -1409,8 +1213,6 @@ bool thread_detach_current_thread(void) } -#if defined(ENABLE_GC_CACAO) - /* threads_suspend_thread ****************************************************** Suspend the passed thread. Execution stops until the thread @@ -1457,6 +1259,7 @@ bool threads_suspend_thread(threadobject *thread, s4 reason) *******************************************************************************/ +#if defined(ENABLE_GC_CACAO) void threads_suspend_ack(u1* pc, u1* sp) { threadobject *thread; @@ -1506,6 +1309,7 @@ void threads_suspend_ack(u1* pc, u1* sp) /* release the suspendmutex */ mutex_unlock(&(thread->suspendmutex)); } +#endif /* threads_resume_thread ******************************************************* @@ -1514,6 +1318,7 @@ void threads_suspend_ack(u1* pc, u1* sp) *******************************************************************************/ +#if defined(ENABLE_GC_CACAO) bool threads_resume_thread(threadobject *thread) { /* acquire the suspendmutex */ @@ -1535,9 +1340,9 @@ bool threads_resume_thread(threadobject *thread) return true; } - #endif + /* threads_join_all_threads **************************************************** Join all non-daemon threads. diff --git a/src/threads/thread.c b/src/threads/thread.c index 0bd495dda..307562094 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -55,7 +55,6 @@ # include "native/include/java_lang_VMThread.h" #endif -#include "threads/critical.h" #include "threads/lock-common.h" #include "threads/threadlist.h" #include "threads/thread.h" diff --git a/src/vm/jit/alpha/codegen.c b/src/vm/jit/alpha/codegen.c index e30d7d601..aa8990283 100644 --- a/src/vm/jit/alpha/codegen.c +++ b/src/vm/jit/alpha/codegen.c @@ -2709,9 +2709,6 @@ gen_method: superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); /* if class is not resolved, check which code to call */ @@ -2783,8 +2780,6 @@ gen_method: M_ALD(REG_ITMP2, s1, OFFSET(java_object_t, vftbl)); M_ALD(REG_ITMP3, REG_PV, disp); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval)); /* if (s1 != REG_ITMP1) { */ /* M_ILD(REG_ITMP1, REG_ITMP3, OFFSET(vftbl_t, baseval)); */ @@ -2800,8 +2795,6 @@ gen_method: M_ALD(REG_ITMP3, REG_PV, disp); M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - /* } */ M_CMPULE(REG_ITMP2, REG_ITMP3, REG_ITMP3); emit_classcast_check(cd, iptr, BRANCH_EQ, REG_ITMP3, s1); @@ -2869,9 +2862,6 @@ gen_method: supervftbl = super->vftbl; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); d = codegen_reg_of_dst(jd, iptr, REG_ITMP2); @@ -2954,14 +2944,10 @@ gen_method: M_ALD(REG_ITMP1, s1, OFFSET(java_object_t, vftbl)); M_ALD(REG_ITMP2, REG_PV, disp); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1); M_CMPULE(REG_ITMP1, REG_ITMP2, d); diff --git a/src/vm/jit/alpha/freebsd/md-os.c b/src/vm/jit/alpha/freebsd/md-os.c index 10deba916..8aa259a9a 100644 --- a/src/vm/jit/alpha/freebsd/md-os.c +++ b/src/vm/jit/alpha/freebsd/md-os.c @@ -1,9 +1,7 @@ -/* src/vm/jit/alpha/freebsd/md.c - machine dependent Alpha FreeBSD functions +/* src/vm/jit/alpha/freebsd/md-os.c - machine dependent Alpha FreeBSD functions - Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel, - C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, - E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, - J. Wenninger, Institut f. Computersprachen - TU Wien + Copyright (C) 1996-2005, 2006, 2008 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -22,12 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Contact: cacao@cacaojvm.org - - Authors: Christian Thalinger - - Changes: - */ @@ -95,22 +87,6 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p) } -#if defined(ENABLE_THREADS) -void thread_restartcriticalsection(ucontext_t *_uc) -{ - mcontext_t *_mc; - void *critical; - - _mc = &_uc->uc_mcontext; - - critical = critical_find_restart_point((void *) _mc->mc_regs[R_PC]); - - if (critical) - _mc->mc_regs[R_PC] = (ptrint) critical; -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/alpha/linux/md-os.c b/src/vm/jit/alpha/linux/md-os.c index afe391d11..daad38ff3 100644 --- a/src/vm/jit/alpha/linux/md-os.c +++ b/src/vm/jit/alpha/linux/md-os.c @@ -275,32 +275,6 @@ void md_executionstate_write(executionstate_t *es, void *context) } -/* md_critical_section_restart ************************************************* - - Search the critical sections tree for a matching section and set - the PC to the restart point, if necessary. - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void md_critical_section_restart(ucontext_t *_uc) -{ - mcontext_t *_mc; - u1 *pc; - u1 *npc; - - _mc = &_uc->uc_mcontext; - - pc = (u1 *) _mc->sc_pc; - - npc = critical_find_restart_point(pc); - - if (npc != NULL) - _mc->sc_pc = (ptrint) npc; -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/arm/codegen.c b/src/vm/jit/arm/codegen.c index 00a37a242..387822a68 100644 --- a/src/vm/jit/arm/codegen.c +++ b/src/vm/jit/arm/codegen.c @@ -2402,9 +2402,6 @@ bool codegen_emit(jitdata *jd) superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); /* if class is not resolved, check which code to call */ @@ -2508,16 +2505,12 @@ bool codegen_emit(jitdata *jd) M_LDR_INTERN(REG_ITMP2, s1, OFFSET(java_object_t, vftbl)); M_DSEG_LOAD(REG_ITMP3, disp); - CODEGEN_CRITICAL_SECTION_START; - M_LDR_INTERN(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_LDR_INTERN(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, baseval)); M_SUB(REG_ITMP2, REG_ITMP2, REG_ITMP3); M_DSEG_LOAD(REG_ITMP3, disp); M_LDR_INTERN(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_CMP(REG_ITMP2, REG_ITMP3); emit_classcast_check(cd, iptr, BRANCH_UGT, 0, s1); @@ -2582,9 +2575,6 @@ bool codegen_emit(jitdata *jd) superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); d = codegen_reg_of_dst(jd, iptr, REG_ITMP2); @@ -2707,14 +2697,10 @@ bool codegen_emit(jitdata *jd) M_LDR_INTERN(REG_ITMP1, s1, OFFSET(java_object_t, vftbl)); M_DSEG_LOAD(REG_ITMP2, disp); - CODEGEN_CRITICAL_SECTION_START; - M_LDR_INTERN(REG_ITMP1, REG_ITMP1, OFFSET(vftbl_t, baseval)); M_LDR_INTERN(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_LDR_INTERN(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_SUB(REG_ITMP1, REG_ITMP1, REG_ITMP3); M_CMP(REG_ITMP1, REG_ITMP2); /* If d == REG_ITMP2, then it's destroyed */ diff --git a/src/vm/jit/arm/linux/md-os.c b/src/vm/jit/arm/linux/md-os.c index 37aaabcdc..a9e3e9a9c 100644 --- a/src/vm/jit/arm/linux/md-os.c +++ b/src/vm/jit/arm/linux/md-os.c @@ -309,32 +309,6 @@ void md_executionstate_write(executionstate_t *es, void *context) } -/* md_critical_section_restart ************************************************* - - Search the critical sections tree for a matching section and set - the PC to the restart point, if necessary. - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void md_critical_section_restart(ucontext_t *_uc) -{ - scontext_t *_sc; - u1 *pc; - u1 *npc; - - _sc = &_uc->uc_mcontext; - - pc = (u1 *) _sc->arm_pc; - - npc = critical_find_restart_point(pc); - - if (npc != NULL) - _sc->arm_pc = (ptrint) npc; -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/asmpart.h b/src/vm/jit/asmpart.h index 8dea3aacc..ba688b10f 100644 --- a/src/vm/jit/asmpart.h +++ b/src/vm/jit/asmpart.h @@ -1,9 +1,7 @@ /* src/vm/jit/asmpart.h - prototypes for machine specfic functions - Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel, - C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, - E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, - J. Wenninger, Institut f. Computersprachen - TU Wien + Copyright (C) 1996-2005, 2006, 2007, 2008 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -34,10 +32,6 @@ #include "vm/types.h" -#if defined(ENABLE_THREADS) -# include "threads/critical.h" -#endif - #include "vm/global.h" #include "vm/vm.h" diff --git a/src/vm/jit/codegen-common.c b/src/vm/jit/codegen-common.c index 045a44c86..5c2f9480c 100644 --- a/src/vm/jit/codegen-common.c +++ b/src/vm/jit/codegen-common.c @@ -187,7 +187,6 @@ void codegen_setup(jitdata *jd) #endif cd->brancheslabel = list_create_dump(OFFSET(branch_label_ref_t, linkage)); - cd->listcritical = list_create_dump(OFFSET(critical_section_ref_t, linkage)); cd->linenumbers = list_create_dump(OFFSET(linenumbertable_list_entry_t, linkage)); } @@ -229,7 +228,6 @@ static void codegen_reset(jitdata *jd) #endif cd->brancheslabel = list_create_dump(OFFSET(branch_label_ref_t, linkage)); - cd->listcritical = list_create_dump(OFFSET(critical_section_ref_t, linkage)); cd->linenumbers = list_create_dump(OFFSET(linenumbertable_list_entry_t, linkage)); /* We need to clear the mpc and the branch references from all @@ -497,164 +495,6 @@ void codegen_branch_label_add(codegendata *cd, s4 label, s4 condition, s4 reg, u } -/* codegen_critical_section_new ************************************************ - - Allocates a new critical-section reference and adds it to the - critical-section list. - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void codegen_critical_section_new(codegendata *cd) -{ - list_t *l; - critical_section_ref_t *csr; - s4 mpc; - - /* Get the critical section list. */ - - l = cd->listcritical; - - /* calculate the current mpc */ - - mpc = cd->mcodeptr - cd->mcodebase; - - csr = DNEW(critical_section_ref_t); - - /* We only can set restart right now, as start and end are set by - the following, corresponding functions. */ - - csr->start = -1; - csr->end = -1; - csr->restart = mpc; - - /* Add the branch to the list. */ - - list_add_last(l, csr); -} -#endif - - -/* codegen_critical_section_start ********************************************** - - Set the start-point of the current critical section (which is the - last element of the list). - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void codegen_critical_section_start(codegendata *cd) -{ - list_t *l; - critical_section_ref_t *csr; - s4 mpc; - - /* Get the critical section list. */ - - l = cd->listcritical; - - /* calculate the current mpc */ - - mpc = cd->mcodeptr - cd->mcodebase; - - /* Get the current critical section. */ - - csr = list_last(l); - - /* set the start point */ - - assert(csr->start == -1); - - csr->start = mpc; -} -#endif - - -/* codegen_critical_section_end ************************************************ - - Set the end-point of the current critical section (which is the - last element of the list). - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void codegen_critical_section_end(codegendata *cd) -{ - list_t *l; - critical_section_ref_t *csr; - s4 mpc; - - /* Get the critical section list. */ - - l = cd->listcritical; - - /* calculate the current mpc */ - - mpc = cd->mcodeptr - cd->mcodebase; - - /* Get the current critical section. */ - - csr = list_last(l); - - /* set the end point */ - - assert(csr->end == -1); - - csr->end = mpc; -} -#endif - - -/* codegen_critical_section_finish ********************************************* - - Finish the critical sections, create the critical section nodes for - the AVL tree and insert them into the tree. - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -static void codegen_critical_section_finish(jitdata *jd) -{ - codeinfo *code; - codegendata *cd; - list_t *l; - critical_section_ref_t *csr; - critical_section_node_t *csn; - - /* get required compiler data */ - - code = jd->code; - cd = jd->cd; - - /* Get the critical section list. */ - - l = cd->listcritical; - - /* iterate over all critical sections */ - - for (csr = list_first(l); csr != NULL; csr = list_next(l, csr)) { - /* check if all points are set */ - - assert(csr->start != -1); - assert(csr->end != -1); - assert(csr->restart != -1); - - /* allocate tree node */ - - csn = NEW(critical_section_node_t); - - csn->start = code->entrypoint + csr->start; - csn->end = code->entrypoint + csr->end; - csn->restart = code->entrypoint + csr->restart; - - /* insert into the tree */ - - critical_section_register(csn); - } -} -#endif - - /* codegen_set_replacement_point_notrap **************************************** Record the position of a non-trappable replacement point. @@ -861,12 +701,6 @@ void codegen_finish(jitdata *jd) dseg_resolve_datareferences(jd); #endif -#if defined(ENABLE_THREADS) - /* create cirtical sections */ - - codegen_critical_section_finish(jd); -#endif - /* flush the instruction and data caches */ md_cacheflush(code->mcode, code->mcodelength); diff --git a/src/vm/jit/codegen-common.h b/src/vm/jit/codegen-common.h index cf1ad7d77..c85c8d537 100644 --- a/src/vm/jit/codegen-common.h +++ b/src/vm/jit/codegen-common.h @@ -1,9 +1,7 @@ /* src/vm/jit/codegen-common.h - architecture independent code generator stuff - Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel, - C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, - E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, - J. Wenninger, Institut f. Computersprachen - TU Wien + Copyright (C) 1996-2005, 2006, 2007, 2008 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -33,7 +31,6 @@ typedef struct codegendata codegendata; typedef struct branchref branchref; typedef struct branch_label_ref_t branch_label_ref_t; -typedef struct critical_section_ref_t critical_section_ref_t; typedef struct jumpref jumpref; typedef struct dataref dataref; typedef struct exceptionref exceptionref; @@ -133,7 +130,6 @@ struct codegendata { #endif list_t *brancheslabel; - list_t *listcritical; /* list of critical sections */ list_t *linenumbers; /* list of line numbers */ methodinfo *method; @@ -180,16 +176,6 @@ struct branch_label_ref_t { }; -/* critical_section_ref_t *****************************************************/ - -struct critical_section_ref_t { - s4 start; /* relative offset to method entry-point */ - s4 end; - s4 restart; - listnode_t linkage; -}; - - /* jumpref ********************************************************************/ struct jumpref { @@ -291,20 +277,6 @@ java_object_t *codegen_finish_native_call(u1 *currentsp, u1 *pv); s4 codegen_reg_of_var(u2 opcode, varinfo *v, s4 tempregnum); s4 codegen_reg_of_dst(jitdata *jd, instruction *iptr, s4 tempregnum); -#if defined(ENABLE_THREADS) -void codegen_critical_section_new(codegendata *cd); -void codegen_critical_section_start(codegendata *cd); -void codegen_critical_section_end(codegendata *cd); - -# define CODEGEN_CRITICAL_SECTION_NEW codegen_critical_section_new(cd) -# define CODEGEN_CRITICAL_SECTION_START codegen_critical_section_start(cd) -# define CODEGEN_CRITICAL_SECTION_END codegen_critical_section_end(cd) -#else -# define CODEGEN_CRITICAL_SECTION_NEW /* no-op */ -# define CODEGEN_CRITICAL_SECTION_START /* no-op */ -# define CODEGEN_CRITICAL_SECTION_END /* no-op */ -#endif - #if defined(ENABLE_SSA) void codegen_emit_phi_moves(jitdata *jd, basicblock *bptr); #endif diff --git a/src/vm/jit/i386/codegen.c b/src/vm/jit/i386/codegen.c index 5123b4b23..9b49b4fe6 100644 --- a/src/vm/jit/i386/codegen.c +++ b/src/vm/jit/i386/codegen.c @@ -3104,9 +3104,6 @@ gen_method: supervftbl = super->vftbl; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); /* if class is not resolved, check which code to call */ @@ -3179,8 +3176,6 @@ gen_method: M_MOV_IMM(supervftbl, REG_ITMP3); - CODEGEN_CRITICAL_SECTION_START; - M_ILD32(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval)); /* if (s1 != REG_ITMP1) { */ @@ -3197,8 +3192,6 @@ gen_method: M_MOV_IMM(supervftbl, REG_ITMP3); M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - /* } */ M_CMP(REG_ITMP3, REG_ITMP2); @@ -3259,9 +3252,6 @@ gen_method: supervftbl = super->vftbl; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); d = codegen_reg_of_dst(jd, iptr, REG_ITMP2); @@ -3345,14 +3335,10 @@ gen_method: M_MOV_IMM(supervftbl, REG_ITMP2); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, diffval)); M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval)); - CODEGEN_CRITICAL_SECTION_END; - M_ISUB(REG_ITMP2, REG_ITMP1); M_CLR(d); /* may be REG_ITMP2 */ M_CMP(REG_ITMP3, REG_ITMP1); diff --git a/src/vm/jit/i386/cygwin/md-os.c b/src/vm/jit/i386/cygwin/md-os.c index bd96c8bdd..d62914755 100644 --- a/src/vm/jit/i386/cygwin/md-os.c +++ b/src/vm/jit/i386/cygwin/md-os.c @@ -1,9 +1,7 @@ /* src/vm/jit/i386/cygwin/md-os.c - machine dependent i386 Windows functions - Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel, - C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, - E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, - J. Wenninger, Institut f. Computersprachen - TU Wien + Copyright (C) 1996-2005, 2006, 2008 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -22,12 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Contact: cacao@cacaojvm.org - - Authors: Michael Starzinger - - Changes: - */ @@ -73,14 +65,6 @@ void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p) } -#if defined(ENABLE_THREADS) -void thread_restartcriticalsection(ucontext_t *uc) -{ - assert(0); -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/i386/darwin/md-os.c b/src/vm/jit/i386/darwin/md-os.c index 344c58205..26e86b21d 100644 --- a/src/vm/jit/i386/darwin/md-os.c +++ b/src/vm/jit/i386/darwin/md-os.c @@ -353,34 +353,6 @@ void md_executionstate_write(executionstate_t *es, void *context) } -/* md_critical_section_restart ************************************************* - - Search the critical sections tree for a matching section and set - the PC to the restart point, if necessary. - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void thread_restartcriticalsection(ucontext_t *_uc) -{ - mcontext_t _mc; - i386_thread_state_t *_ss; - u1 *pc; - void *rpc; - - _mc = _uc->uc_mcontext; - _ss = &_mc->__ss; - - pc = (u1 *) _ss->__eip; - - rpc = critical_find_restart_point(pc); - - if (rpc != NULL) - _ss->__eip = (ptrint) rpc; -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/i386/freebsd/md-os.c b/src/vm/jit/i386/freebsd/md-os.c index 4eebf6987..e9886e392 100644 --- a/src/vm/jit/i386/freebsd/md-os.c +++ b/src/vm/jit/i386/freebsd/md-os.c @@ -1,9 +1,7 @@ /* src/vm/jit/i386/freebsd/md-os.c - machine dependent i386 FreeBSD functions - Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel, - C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, - E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, - J. Wenninger, Institut f. Computersprachen - TU Wien + Copyright (C) 1996-2005, 2006, 2008 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -22,12 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Contact: cacao@cacaojvm.org - - Authors: Christian Thalinger - - Changes: - */ @@ -103,19 +95,6 @@ void md_signal_handler_sigfpe(int sig, siginfo_t *siginfo, void *_p) } -#if defined(ENABLE_THREADS) -void thread_restartcriticalsection(ucontext_t *uc) -{ - void *critical; - - critical = critical_find_restart_point((void *) uc->uc_mcontext.mc_eip); - - if (critical) - uc->uc_mcontext.mc_eip = (ptrint) critical; -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/i386/linux/md-os.c b/src/vm/jit/i386/linux/md-os.c index 17630b051..d445e4798 100644 --- a/src/vm/jit/i386/linux/md-os.c +++ b/src/vm/jit/i386/linux/md-os.c @@ -354,32 +354,6 @@ void md_executionstate_write(executionstate_t *es, void *context) } -/* md_critical_section_restart ************************************************* - - Search the critical sections tree for a matching section and set - the PC to the restart point, if necessary. - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void md_critical_section_restart(ucontext_t *_uc) -{ - mcontext_t *_mc; - u1 *pc; - u1 *npc; - - _mc = &_uc->uc_mcontext; - - pc = (u1 *) _mc->gregs[REG_EIP]; - - npc = critical_find_restart_point(pc); - - if (npc != NULL) - _mc->gregs[REG_EIP] = (ptrint) npc; -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/m68k/codegen.c b/src/vm/jit/m68k/codegen.c index 41bd7c7f7..f62c9b734 100644 --- a/src/vm/jit/m68k/codegen.c +++ b/src/vm/jit/m68k/codegen.c @@ -1994,9 +1994,6 @@ nowperformreturn: superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ATMP1); d = codegen_reg_of_dst(jd, iptr, REG_ITMP2); @@ -2060,14 +2057,10 @@ nowperformreturn: M_ALD(REG_ATMP1, s1, OFFSET(java_object_t, vftbl)); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP1, REG_ATMP1, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP3, REG_ATMP2, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP2, REG_ATMP2, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_ISUB(REG_ITMP3, REG_ITMP1); M_ICMP(REG_ITMP2, REG_ITMP1); M_BHI(4); @@ -2119,9 +2112,6 @@ nowperformreturn: superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ATMP1); assert(VAROP(iptr->s1)->type == TYPE_ADR); @@ -2181,14 +2171,10 @@ nowperformreturn: M_ALD(REG_ATMP2, s1, OFFSET(java_object_t, vftbl)); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP3, REG_ATMP2, OFFSET(vftbl_t, baseval)); /* REG_ITMP3 == sub->vftbl->baseval */ M_ILD(REG_ITMP1, REG_ATMP3, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP2, REG_ATMP3, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_ISUB(REG_ITMP1, REG_ITMP3); M_ICMP(REG_ITMP2, REG_ITMP3); /* XXX was CMPU */ diff --git a/src/vm/jit/mips/codegen.c b/src/vm/jit/mips/codegen.c index cbb334513..b51b8d675 100644 --- a/src/vm/jit/mips/codegen.c +++ b/src/vm/jit/mips/codegen.c @@ -3236,9 +3236,6 @@ gen_method: superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); /* if class is not resolved, check which code to call */ @@ -3309,8 +3306,6 @@ gen_method: M_ALD(REG_ITMP2, s1, OFFSET(java_object_t, vftbl)); M_ALD(REG_ITMP3, REG_PV, disp); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval)); /* if (s1 != REG_ITMP1) { */ /* M_ILD(REG_ITMP1, REG_ITMP3, OFFSET(vftbl_t, baseval)); */ @@ -3325,8 +3320,6 @@ gen_method: M_ALD(REG_ITMP3, REG_PV, disp); M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - /* } */ M_CMPULT(REG_ITMP3, REG_ITMP2, REG_ITMP3); emit_classcast_check(cd, iptr, ICMD_IFNE, REG_ITMP3, s1); @@ -3391,9 +3384,6 @@ gen_method: superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); d = codegen_reg_of_dst(jd, iptr, REG_ITMP2); @@ -3471,14 +3461,10 @@ gen_method: M_ALD(REG_ITMP1, s1, OFFSET(java_object_t, vftbl)); M_ALD(REG_ITMP2, REG_PV, disp); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1); M_CMPULT(REG_ITMP2, REG_ITMP1, d); M_XOR_IMM(d, 1, d); diff --git a/src/vm/jit/mips/irix/md-os.c b/src/vm/jit/mips/irix/md-os.c index d14fb611e..f2bea4b9b 100644 --- a/src/vm/jit/mips/irix/md-os.c +++ b/src/vm/jit/mips/irix/md-os.c @@ -1,9 +1,7 @@ /* src/vm/jit/mips/irix/md-os.c - machine dependent MIPS IRIX functions - Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel, - C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, - E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, - J. Wenninger, Institut f. Computersprachen - TU Wien + Copyright (C) 1996-2005, 2006, 2007, 2008 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -145,34 +143,6 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p) } -/* md_critical_section_restart ************************************************* - - Search the critical sections tree for a matching section and set - the PC to the restart point, if necessary. - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void md_critical_section_restart(ucontext_t *_uc) -{ - mcontext_t *_mc; - u1 *pc; - u1 *npc; - - _mc = &_uc->uc_mcontext; - - pc = (u1 *) _mc->gregs[CTX_EPC]; - - npc = critical_find_restart_point(pc); - - if (npc != NULL) { - log_println("md_critical_section_restart: pc=%p, npc=%p", pc, npc); - _mc->gregs[CTX_EPC] = (ptrint) npc; - } -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/mips/linux/md-os.c b/src/vm/jit/mips/linux/md-os.c index aebc1666a..ff49c55de 100644 --- a/src/vm/jit/mips/linux/md-os.c +++ b/src/vm/jit/mips/linux/md-os.c @@ -354,41 +354,6 @@ void md_executionstate_write(executionstate_t* es, void* context) } -/* md_critical_section_restart ************************************************* - - Search the critical sections tree for a matching section and set - the PC to the restart point, if necessary. - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void md_critical_section_restart(ucontext_t *_uc) -{ - mcontext_t *_mc; - u1 *pc; - u1 *npc; - - _mc = &_uc->uc_mcontext; - -#if defined(__UCLIBC__) - pc = (u1 *) (ptrint) _mc->gpregs[CTX_EPC]; -#else - pc = (u1 *) (ptrint) _mc->pc; -#endif - - npc = critical_find_restart_point(pc); - - if (npc != NULL) { -#if defined(__UCLIBC__) - _mc->gpregs[CTX_EPC] = (ptrint) npc; -#else - _mc->pc = (ptrint) npc; -#endif - } -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/mips/uclinux/md-os.c b/src/vm/jit/mips/uclinux/md-os.c index a28d2d1bc..c5f89b3a1 100644 --- a/src/vm/jit/mips/uclinux/md-os.c +++ b/src/vm/jit/mips/uclinux/md-os.c @@ -1,9 +1,7 @@ /* src/vm/jit/mips/uclinux/md-os.c - machine dependent MIPS uClinux functions - Copyright (C) 2007 R. Grafl, A. Krall, C. Kruegel, - C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, - E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, - J. Wenninger, Institut f. Computersprachen - TU Wien + Copyright (C) 2007, 2008 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -71,21 +69,6 @@ void md_signal_handler_sigusr2(int sig, siginfo_t *siginfo, void *_p) } -/* md_critical_section_restart ************************************************* - - Search the critical sections tree for a matching section and set - the PC to the restart point, if necessary. - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void md_critical_section_restart(ucontext_t *_uc) -{ - vm_abort("md_critical_section_restart: IMPLEMENT ME!"); -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/powerpc/codegen.c b/src/vm/jit/powerpc/codegen.c index 378a7279e..7adbc03b5 100644 --- a/src/vm/jit/powerpc/codegen.c +++ b/src/vm/jit/powerpc/codegen.c @@ -2439,9 +2439,6 @@ gen_method: superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); /* if class is not resolved, check which code to call */ @@ -2514,16 +2511,12 @@ gen_method: M_ALD(REG_ITMP2, s1, OFFSET(java_object_t, vftbl)); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_ALD(REG_ITMP2, REG_PV, disp); if (s1 != REG_ITMP1) { M_ILD(REG_ITMP1, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_ISUB(REG_ITMP3, REG_ITMP1, REG_ITMP3); } else { @@ -2531,8 +2524,6 @@ gen_method: M_ISUB(REG_ITMP3, REG_ITMP2, REG_ITMP3); M_ALD(REG_ITMP2, REG_PV, disp); M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval)); - - CODEGEN_CRITICAL_SECTION_END; } M_CMPU(REG_ITMP3, REG_ITMP2); emit_classcast_check(cd, iptr, BRANCH_GT, REG_ITMP3, s1); @@ -2594,9 +2585,6 @@ gen_method: superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); d = codegen_reg_of_dst(jd, iptr, REG_ITMP2); @@ -2675,14 +2663,10 @@ gen_method: M_ALD(REG_ITMP1, s1, OFFSET(java_object_t, vftbl)); M_ALD(REG_ITMP2, REG_PV, disp); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_ISUB(REG_ITMP1, REG_ITMP3, REG_ITMP1); M_CMPU(REG_ITMP1, REG_ITMP2); M_CLR(d); diff --git a/src/vm/jit/powerpc/darwin/md-os.c b/src/vm/jit/powerpc/darwin/md-os.c index 44b0f73d8..b5fd3498a 100644 --- a/src/vm/jit/powerpc/darwin/md-os.c +++ b/src/vm/jit/powerpc/darwin/md-os.c @@ -251,34 +251,6 @@ void md_signal_handler_sigusr2(int sig, siginfo_t *siginfo, void *_p) } -/* md_critical_section_restart ************************************************* - - Search the critical sections tree for a matching section and set - the PC to the restart point, if necessary. - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void md_critical_section_restart(ucontext_t *_uc) -{ - mcontext_t _mc; - ppc_thread_state_t *_ss; - u1 *pc; - u1 *npc; - - _mc = _uc->uc_mcontext; - _ss = &_mc->ss; - - pc = (u1 *) _ss->srr0; - - npc = critical_find_restart_point(pc); - - if (npc != NULL) - _ss->srr0 = (ptrint) npc; -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/powerpc/linux/md-os.c b/src/vm/jit/powerpc/linux/md-os.c index beab97d87..d56123600 100644 --- a/src/vm/jit/powerpc/linux/md-os.c +++ b/src/vm/jit/powerpc/linux/md-os.c @@ -380,39 +380,6 @@ void md_executionstate_write(executionstate_t *es, void *context) } -/* md_critical_section_restart ************************************************* - - Search the critical sections tree for a matching section and set - the PC to the restart point, if necessary. - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void md_critical_section_restart(ucontext_t *_uc) -{ - mcontext_t *_mc; - unsigned long *_gregs; - u1 *pc; - u1 *npc; - -#if defined(__UCLIBC__) - _mc = &(_uc->uc_mcontext); - _gregs = _mc->regs->gpr; -#else - _mc = _uc->uc_mcontext.uc_regs; - _gregs = _mc->gregs; -#endif - - pc = (u1 *) _gregs[PT_NIP]; - - npc = critical_find_restart_point(pc); - - if (npc != NULL) - _gregs[PT_NIP] = (ptrint) npc; -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/powerpc/netbsd/md-os.c b/src/vm/jit/powerpc/netbsd/md-os.c index 695508830..e28f9a3f9 100644 --- a/src/vm/jit/powerpc/netbsd/md-os.c +++ b/src/vm/jit/powerpc/netbsd/md-os.c @@ -1,9 +1,7 @@ /* src/vm/jit/powerpc/netbsd/md-os.c - machine dependent PowerPC NetBSD functions - Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel, - C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, - E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, - J. Wenninger, Institut f. Computersprachen - TU Wien + Copyright (C) 1996-2005, 2006, 2008 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -22,12 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - Contact: cacao@cacaojvm.org - - Authors: Christian Thalinger - - Changes: - */ @@ -92,14 +84,6 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p) } -#if defined(ENABLE_THREADS) -void thread_restartcriticalsection(ucontext_t *uc) -{ - /* XXX set pc to restart address */ -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/powerpc64/codegen.c b/src/vm/jit/powerpc64/codegen.c index f9cd0fbe6..be082d70c 100644 --- a/src/vm/jit/powerpc64/codegen.c +++ b/src/vm/jit/powerpc64/codegen.c @@ -2204,10 +2204,6 @@ gen_method: superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) { - CODEGEN_CRITICAL_SECTION_NEW; - } - s1 = emit_load_s1(jd, iptr, REG_ITMP1); /* if class is not resolved, check which code to call */ @@ -2276,16 +2272,12 @@ gen_method: M_ALD(REG_ITMP2, s1, OFFSET(java_object_t, vftbl)); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_ALD(REG_ITMP2, REG_PV, disp); if (s1 != REG_ITMP1) { M_ILD(REG_ITMP1, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_SUB(REG_ITMP3, REG_ITMP1, REG_ITMP3); M_EXTSW(REG_ITMP3, REG_ITMP3); } else { @@ -2294,9 +2286,6 @@ gen_method: M_EXTSW(REG_ITMP3, REG_ITMP3); M_ALD(REG_ITMP2, REG_PV, disp); M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval)); - - CODEGEN_CRITICAL_SECTION_END; - } M_CMPU(REG_ITMP3, REG_ITMP2); emit_classcast_check(cd, iptr, BRANCH_GT, REG_ITMP3, s1); @@ -2373,10 +2362,6 @@ gen_method: superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) { - CODEGEN_CRITICAL_SECTION_NEW; - } - s1 = emit_load_s1(jd, iptr, REG_ITMP1); d = codegen_reg_of_dst(jd, iptr, REG_ITMP2); if (s1 == d) { @@ -2453,14 +2438,10 @@ gen_method: M_ALD(REG_ITMP1, s1, OFFSET(java_object_t, vftbl)); M_ALD(REG_ITMP2, REG_PV, disp); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_SUB(REG_ITMP1, REG_ITMP3, REG_ITMP1); M_EXTSW(REG_ITMP1, REG_ITMP1); M_CMPU(REG_ITMP1, REG_ITMP2); diff --git a/src/vm/jit/powerpc64/linux/md-os.c b/src/vm/jit/powerpc64/linux/md-os.c index 8b292f1ad..d978a70e4 100644 --- a/src/vm/jit/powerpc64/linux/md-os.c +++ b/src/vm/jit/powerpc64/linux/md-os.c @@ -179,32 +179,6 @@ void md_signal_handler_sigusr2(int sig, siginfo_t *siginfo, void *_p) #endif -/* md_critical_section_restart ************************************************* - - Search the critical sections tree for a matching section and set - the PC to the restart point, if necessary. - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void md_critical_section_restart(ucontext_t *_uc) -{ - mcontext_t *_mc; - u1 *pc; - u1 *npc; - - _mc = &(_uc->uc_mcontext); - - pc = (u1 *) _mc->gp_regs[PT_NIP]; - - npc = critical_find_restart_point(pc); - - if (npc != NULL) - _mc->gp_regs[PT_NIP] = (ptrint) npc; -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/s390/codegen.c b/src/vm/jit/s390/codegen.c index 37de06900..4392759b9 100644 --- a/src/vm/jit/s390/codegen.c +++ b/src/vm/jit/s390/codegen.c @@ -3003,9 +3003,6 @@ gen_method: supervftbl = super->vftbl; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); /* if class is not resolved, check which code to call */ @@ -3083,8 +3080,6 @@ gen_method: } #if 1 - CODEGEN_CRITICAL_SECTION_START; - /* REG_ITMP3 := baseval(s1) */ M_ALD(REG_ITMP2, s1, OFFSET(java_object_t, vftbl)); M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval)); @@ -3100,8 +3095,6 @@ gen_method: M_ALD_DSEG(REG_ITMP2, disp); M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_CMPU(REG_ITMP3, REG_ITMP2); /* Unsigned compare */ /* M_CMPULE(REG_ITMP2, REG_ITMP3, REG_ITMP3); itmp3 = (itmp2 <= itmp3) */ @@ -3111,16 +3104,12 @@ gen_method: M_ALD(REG_ITMP2, s1, OFFSET(java_object_t, vftbl)); M_ALD_DSEG(REG_ITMP3, disp); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, baseval)); M_ISUB(REG_ITMP3, REG_ITMP2); M_ALD_DSEG(REG_ITMP3, disp); M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_CMPU(REG_ITMP2, REG_ITMP3); /* Unsigned compare */ /* M_CMPULE(REG_ITMP2, REG_ITMP3, REG_ITMP3); itmp3 = (itmp2 <= itmp3) */ /* M_BEQZ(REG_ITMP3, 0); branch if (! itmp) -> branch if > */ @@ -3223,9 +3212,6 @@ gen_method: # define LABEL_EXIT_INTERFACE_DONE BRANCH_LABEL_5 # define LABEL_EXIT_CLASS_NULL BRANCH_LABEL_6 - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); d = codegen_reg_of_dst(jd, iptr, REG_ITMP2); if (s1 == d) { @@ -3327,14 +3313,10 @@ gen_method: M_ALD(REG_ITMP1, s1, OFFSET(java_object_t, vftbl)); M_ALD_DSEG(REG_ITMP2, disp); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_ISUB(REG_ITMP3, REG_ITMP1); /* itmp1 := itmp1 (sub.baseval) - itmp3 (super.baseval) */ M_CMPU(REG_ITMP1, REG_ITMP2); /* d := (uint)REG_ITMP1 <= (uint)REG_ITMP2 */ diff --git a/src/vm/jit/s390/md.c b/src/vm/jit/s390/md.c index 3959f0a91..b21bbb871 100644 --- a/src/vm/jit/s390/md.c +++ b/src/vm/jit/s390/md.c @@ -412,27 +412,6 @@ void md_executionstate_write(executionstate_t* es, void* context) } -#if defined(ENABLE_THREADS) -void md_critical_section_restart(ucontext_t *_uc) -{ - mcontext_t *_mc; - u1 *pc; - void *npc; - - _mc = &_uc->uc_mcontext; - - pc = (u1 *)_mc->psw.addr; - - npc = critical_find_restart_point(pc); - - if (npc != NULL) { - log_println("%s: pc=%p, npc=%p", __FUNCTION__, pc, npc); - _mc->psw.addr = (ptrint) npc; - } -} -#endif - - /* md_jit_method_patch_address ************************************************* Gets the patch address of the currently compiled method. The offset diff --git a/src/vm/jit/sparc64/codegen.c b/src/vm/jit/sparc64/codegen.c index d13339a8a..f753e04bd 100644 --- a/src/vm/jit/sparc64/codegen.c +++ b/src/vm/jit/sparc64/codegen.c @@ -2671,9 +2671,6 @@ gen_method: superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); /* if class is not resolved, check which code to call */ @@ -2744,16 +2741,12 @@ gen_method: M_ALD(REG_ITMP2, s1, OFFSET(java_object_t, vftbl)); M_ALD(REG_ITMP3, REG_PV, disp); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, baseval)); M_SUB(REG_ITMP2, REG_ITMP3, REG_ITMP2); M_ALD(REG_ITMP3, REG_PV, disp); M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - /* } */ M_CMP(REG_ITMP3, REG_ITMP2); emit_classcast_check(cd, iptr, BRANCH_ULT, REG_ITMP3, s1); @@ -2836,9 +2829,6 @@ gen_method: supervftbl = super->vftbl; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); d = codegen_reg_of_dst(jd, iptr, REG_ITMP2); if (s1 == d) { @@ -2914,14 +2904,10 @@ gen_method: M_ALD(REG_ITMP1, s1, OFFSET(java_object_t, vftbl)); M_ALD(REG_ITMP2, REG_PV, disp); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, diffval)); - CODEGEN_CRITICAL_SECTION_END; - M_SUB(REG_ITMP1, REG_ITMP3, REG_ITMP1); M_CMP(REG_ITMP1, REG_ITMP2); M_XCMOVULE_IMM(1, d); diff --git a/src/vm/jit/sparc64/linux/md-os.c b/src/vm/jit/sparc64/linux/md-os.c index 114459477..815308bd6 100644 --- a/src/vm/jit/sparc64/linux/md-os.c +++ b/src/vm/jit/sparc64/linux/md-os.c @@ -176,40 +176,6 @@ void md_icacheflush(u1 *addr, s4 nbytes) } } -#if defined(ENABLE_THREADS) -/* md_critical_section_restart ************************************************ - - Search the critical sections tree for a matching section and set - the NPC to the restart point, if necessary. - - Reads PC and modifies NPC. - -******************************************************************************/ - -void md_critical_section_restart(ucontext_t *_uc) -{ - /* mcontext_t *_mc; */ - sigcontext *ctx; - u1 *pc; - u1 *npc; - - printf("ignoring md_critical_section_restart\n"); - return; - - /* again, we are getting sigcontext instead of ucontext */ - ctx = (sigcontext *) _uc; - - pc = (u1 *) ctx->sigc_regs.tpc; - - npc = critical_find_restart_point(pc); - - if (npc != NULL) { - log_println("md_critical_section_restart: pc=%p, npc=%p", pc, npc); - ctx->sigc_regs.tnpc = (ptrint) npc; - } - -} -#endif /* * These are local overrides for various environment variables in Emacs. diff --git a/src/vm/jit/sparc64/solaris/md-os.c b/src/vm/jit/sparc64/solaris/md-os.c index 81f191896..af39da6e8 100644 --- a/src/vm/jit/sparc64/solaris/md-os.c +++ b/src/vm/jit/sparc64/solaris/md-os.c @@ -151,22 +151,6 @@ void md_signal_handler_sigsegv(int sig, siginfo_t *siginfo, void *_p) } -#if defined(USE_THREADS) && defined(NATIVE_THREADS) -void thread_restartcriticalsection(ucontext_t *_uc) -{ - mcontext_t *_mc; - void *critical; - - _mc = &_uc->uc_mcontext; - - critical = thread_checkcritical((void *) _mc->sc_pc); - - if (critical) - _mc->sc_pc = (ptrint) critical; -} -#endif - - /* md_icacheflush ************************************************************** Calls the system's function to flush the instruction cache. diff --git a/src/vm/jit/trap.c b/src/vm/jit/trap.c index d06295235..9f3a10558 100644 --- a/src/vm/jit/trap.c +++ b/src/vm/jit/trap.c @@ -31,6 +31,8 @@ #include "md-trap.h" +#include "mm/memory.h" + #include "native/llni.h" #include "toolbox/logging.h" diff --git a/src/vm/jit/x86_64/codegen.c b/src/vm/jit/x86_64/codegen.c index 88e55caa6..e1d6c162a 100644 --- a/src/vm/jit/x86_64/codegen.c +++ b/src/vm/jit/x86_64/codegen.c @@ -1,9 +1,7 @@ /* src/vm/jit/x86_64/codegen.c - machine code generator for x86_64 - Copyright (C) 1996-2005, 2006, 2007 R. Grafl, A. Krall, C. Kruegel, - C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, - E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, - J. Wenninger, Institut f. Computersprachen - TU Wien + Copyright (C) 1996-2005, 2006, 2007, 2008 + CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -2499,9 +2497,6 @@ gen_method: superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); /* if class is not resolved, check which code to call */ @@ -2574,8 +2569,6 @@ gen_method: M_ALD(REG_ITMP2, s1, OFFSET(java_object_t, vftbl)); M_ALD(REG_ITMP3, RIP, disp); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval)); /* if (s1 != REG_ITMP1) { */ @@ -2598,8 +2591,6 @@ gen_method: M_ILD(REG_ITMP3, REG_ITMP3, OFFSET(vftbl_t, diffval)); /* } */ - CODEGEN_CRITICAL_SECTION_END; - M_ICMP(REG_ITMP3, REG_ITMP2); emit_classcast_check(cd, iptr, BRANCH_UGT, REG_ITMP3, s1); @@ -2663,9 +2654,6 @@ gen_method: superindex = super->index; } - if ((super == NULL) || !(super->flags & ACC_INTERFACE)) - CODEGEN_CRITICAL_SECTION_NEW; - s1 = emit_load_s1(jd, iptr, REG_ITMP1); d = codegen_reg_of_dst(jd, iptr, REG_ITMP2); @@ -2747,14 +2735,10 @@ gen_method: M_ALD(REG_ITMP1, s1, OFFSET(java_object_t, vftbl)); M_ALD(REG_ITMP2, RIP, disp); - CODEGEN_CRITICAL_SECTION_START; - M_ILD(REG_ITMP1, REG_ITMP1, OFFSET(vftbl_t, baseval)); M_ILD(REG_ITMP3, REG_ITMP2, OFFSET(vftbl_t, diffval)); M_ILD(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval)); - CODEGEN_CRITICAL_SECTION_END; - M_ISUB(REG_ITMP2, REG_ITMP1); M_CLR(d); /* may be REG_ITMP2 */ M_ICMP(REG_ITMP3, REG_ITMP1); diff --git a/src/vm/jit/x86_64/freebsd/md-os.c b/src/vm/jit/x86_64/freebsd/md-os.c index 6e4a2b227..593956e69 100644 --- a/src/vm/jit/x86_64/freebsd/md-os.c +++ b/src/vm/jit/x86_64/freebsd/md-os.c @@ -129,25 +129,6 @@ void md_signal_handler_sigusr2(int sig, siginfo_t *siginfo, void *_p) #endif -#if defined(ENABLE_THREADS) -void thread_restartcriticalsection(ucontext_t *_uc) -{ - mcontext_t *_mc; - u1 *pc; - void *critical; - - _mc = &_uc->uc_mcontext; - - pc = (u1 *) _mc->mc_rip; - - critical = critical_find_restart_point(pc); - - if (critical != NULL) - _mc->mc_rip = (ptrint) critical; -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/jit/x86_64/linux/md-os.c b/src/vm/jit/x86_64/linux/md-os.c index 8b8bf32d5..fa5d6755b 100644 --- a/src/vm/jit/x86_64/linux/md-os.c +++ b/src/vm/jit/x86_64/linux/md-os.c @@ -498,35 +498,6 @@ void md_executionstate_write(executionstate_t *es, void *context) } -/* md_critical_section_restart ************************************************* - - Search the critical sections tree for a matching section and set - the PC to the restart point, if necessary. - -*******************************************************************************/ - -#if defined(ENABLE_THREADS) -void md_critical_section_restart(ucontext_t *_uc) -{ - mcontext_t *_mc; - u1 *pc; - u1 *npc; - - _mc = &_uc->uc_mcontext; - - /* ATTENTION: Don't use CACAO's internal REG_* defines as they are - different to the ones in . */ - - pc = (u1 *) _mc->gregs[REG_RIP]; - - npc = critical_find_restart_point(pc); - - if (npc != NULL) - _mc->gregs[REG_RIP] = (ptrint) npc; -} -#endif - - /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where diff --git a/src/vm/signal.c b/src/vm/signal.c index 5cdd0ed3a..ddaf410db 100644 --- a/src/vm/signal.c +++ b/src/vm/signal.c @@ -39,6 +39,10 @@ #include "arch.h" +#if defined(ENABLE_GC_BOEHM) +# include "mm/memory.h" +#endif + #include "threads/thread.h" #include "vm/exceptions.h" diff --git a/src/vm/vm.c b/src/vm/vm.c index 5fa1f57a1..1dabfee6f 100644 --- a/src/vm/vm.c +++ b/src/vm/vm.c @@ -1392,7 +1392,6 @@ bool vm_create(JavaVMInitArgs *vm_args) threads_preinit(); lock_init(); - critical_init(); #endif /* install architecture dependent signal handlers */ diff --git a/src/vmcore/linker.c b/src/vmcore/linker.c index cee3866ee..abf018cc8 100644 --- a/src/vmcore/linker.c +++ b/src/vmcore/linker.c @@ -1176,10 +1176,6 @@ static void linker_compute_subclasses(classinfo *c) { LOCK_MONITOR_ENTER(linker_classrenumber_lock); -#if 0 && defined(ENABLE_THREADS) && !defined(DISABLE_GC) - threads_stopworld(); -#endif - if (!(c->flags & ACC_INTERFACE)) { c->nextsub = NULL; c->sub = NULL; @@ -1197,10 +1193,6 @@ static void linker_compute_subclasses(classinfo *c) linker_compute_class_values(class_java_lang_Object); LOCK_MONITOR_EXIT(linker_classrenumber_lock); - -#if 0 && defined(ENABLE_THREADS) && !defined(DISABLE_GC) - threads_startworld(); -#endif }