* src/threads/critical.h: Likewise.
* src/mm/boehm-gc/include/gc.h (GC_signum1, GC_signum2): Removed.
* src/mm/boehm-gc/pthread_stop_world.c (lock_stopworld)
(unlock_stopworld): Likewise.
(GC_signum1, GC_signum2): Likewise.
* src/threads/Makefile.am (libthreads_la_SOURCES): Removed
critical.[ch].
* src/threads/posix/thread-posix.c (STOPWORLD_FROM_GC)
(STOPWORLD_FROM_CLASS_NUMBERING): Removed.
(stopworldwhere): Likewise.
[__IRIX__] (suspend_ack_lock, suspend_cond): Likewise.
(lock_stopworld, unlock_stopworld, threads_cast_sendsignals)
(threads_cast_darwinstop, threads_cast_darwinresume)
(threads_cast_irixresume, threads_sigsuspend_handler): Likewise.
[ENABLE_GC_CACAO] (threads_stopworld, threads_startworld): Added
#ifdef, replaced {lock,unlock}_stopworld with mutex_{lock,unlock}.
[ENABLE_GC_CACAO] (threads_suspend_ack, threads_resume_thread): Added
#ifdef.
* src/threads/thread.c (threads/critical.h): Removed.
* src/vm/jit/asmpart.h [ENABLE_THREADS] (threads/critical.h):
Likewise.
* src/vm/jit/codegen-common.c (codegen_setup): Removed listcritical.
(codegen_reset): Likewise.
[ENABLE_THREADS] (codegen_critical_section_new)
(codegen_critical_section_start, codegen_critical_section_end)
(codegen_critical_section_finish): Removed.
(codegen_finish) [ENABLE_THREADS]: Removed
codegen_critical_section_finish.
* src/vm/jit/codegen-common.h (critical_section_ref_t): Removed.
(codegendata): Removed listcritical.
[ENABLE_THREADS] (codegen_critical_section_new)
(codegen_critical_section_start, codegen_critical_section_end)
(codegen_critical_section_finish, CODEGEN_CRITICAL_SECTION_NEW)
(CODEGEN_CRITICAL_SECTION_START, CODEGEN_CRITICAL_SECTION_END):
Removed.
* src/vm/vm.c (vm_create): Removed critical_init.
* src/vmcore/linker.c (linker_compute_subclasses): Removed obsolete
threads_{stop,start}world.
* src/vm/jit/alpha/codegen.c,
src/vm/jit/arm/codegen.c,
src/vm/jit/i386/codegen.c,
src/vm/jit/m68k/codegen.c,
src/vm/jit/mips/codegen.c,
src/vm/jit/powerpc/codegen.c,
src/vm/jit/powerpc64/codegen.c,
src/vm/jit/s390/codegen.c (codegen_emit): Removed
CODEGEN_CRITICAL_SECTION_NEW, CODEGEN_CRITICAL_SECTION_START,
CODEGEN_CRITICAL_SECTION_END.
* src/vm/jit/alpha/freebsd/md-os.c,
src/vm/jit/alpha/linux/md-os.c,
src/vm/jit/arm/linux/md-os.c,
src/vm/jit/sparc64/codegen.c,
src/vm/jit/x86_64/codegen.c,
src/vm/jit/i386/cygwin/md-os.c,
src/vm/jit/i386/darwin/md-os.c,
src/vm/jit/i386/freebsd/md-os.c,
src/vm/jit/i386/linux/md-os.c,
src/vm/jit/mips/irix/md-os.c,
src/vm/jit/mips/linux/md-os.c,
src/vm/jit/mips/uclinux/md-os.c,
src/vm/jit/powerpc/darwin/md-os.c,
src/vm/jit/powerpc/linux/md-os.c,
src/vm/jit/powerpc/netbsd/md-os.c,
src/vm/jit/powerpc64/linux/md-os.c,
src/vm/jit/s390/md.c,
src/vm/jit/sparc64/linux/md-os.c,
src/vm/jit/sparc64/solaris/md-os.c,
src/vm/jit/x86_64/freebsd/md-os.c,
src/vm/jit/x86_64/linux/md-os.c (md_critical_section_restart):
Removed.
*/
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
return n_live_threads;
}
-void lock_stopworld(int);
-void unlock_stopworld();
-
void GC_stop_world()
{
int i;
}
}
-/* Added for cacao */
-int GC_signum1()
-{
- return SIG_SUSPEND;
-}
-
-int GC_signum2()
-{
- return SIG_THR_RESTART;
-}
-/* cacao END */
-
#endif
if ENABLE_THREADS
libthreads_la_SOURCES = \
- critical.c \
- critical.h \
lock-common.h \
mutex.h \
threadlist.c \
+++ /dev/null
-/* 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 <stddef.h>
-#include <stdint.h>
-
-#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:
- */
+++ /dev/null
-/* 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 <signal.h> /* required on some older Darwin systems for ucontext.h */
-#include <ucontext.h>
-
-
-/* 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:
- */
#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
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;
}
-/* 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
*******************************************************************************/
+#if defined(ENABLE_GC_CACAO)
void threads_stopworld(void)
{
#if !defined(__DARWIN__) && !defined(__CYGWIN__)
s4 count, i;
#endif
- lock_stopworld(STOPWORLD_FROM_CLASS_NUMBERING);
+ mutex_lock(&stopworldlock);
/* lock the threads lists */
non-signaled NEW threads can't change their state and execute
code. */
}
+#endif
/* threads_startworld **********************************************************
*******************************************************************************/
+#if defined(ENABLE_GC_CACAO)
void threads_startworld(void)
{
#if !defined(__DARWIN__) && !defined(__CYGWIN__)
threadlist_unlock();
- unlock_stopworld();
+ mutex_unlock(&stopworldlock);
}
-
#endif
}
-#if defined(ENABLE_GC_CACAO)
-
/* threads_suspend_thread ******************************************************
Suspend the passed thread. Execution stops until the thread
*******************************************************************************/
+#if defined(ENABLE_GC_CACAO)
void threads_suspend_ack(u1* pc, u1* sp)
{
threadobject *thread;
/* release the suspendmutex */
mutex_unlock(&(thread->suspendmutex));
}
+#endif
/* threads_resume_thread *******************************************************
*******************************************************************************/
+#if defined(ENABLE_GC_CACAO)
bool threads_resume_thread(threadobject *thread)
{
/* acquire the suspendmutex */
return true;
}
-
#endif
+
/* threads_join_all_threads ****************************************************
Join all non-daemon threads.
# 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"
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 */
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)); */
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);
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);
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);
-/* 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.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Christian Thalinger
-
- Changes:
-
*/
}
-#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
}
-/* 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
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 */
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);
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);
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 */
}
-/* 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
/* 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.
#include "vm/types.h"
-#if defined(ENABLE_THREADS)
-# include "threads/critical.h"
-#endif
-
#include "vm/global.h"
#include "vm/vm.h"
#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));
}
#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
}
-/* 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.
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);
/* 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.
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;
#endif
list_t *brancheslabel;
- list_t *listcritical; /* list of critical sections */
list_t *linenumbers; /* list of line numbers */
methodinfo *method;
};
-/* 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 {
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
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 */
M_MOV_IMM(supervftbl, REG_ITMP3);
- CODEGEN_CRITICAL_SECTION_START;
-
M_ILD32(REG_ITMP2, REG_ITMP2, OFFSET(vftbl_t, baseval));
/* if (s1 != REG_ITMP1) { */
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);
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);
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);
/* 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.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Michael Starzinger
-
- Changes:
-
*/
}
-#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
}
-/* 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
/* 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.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Christian Thalinger
-
- Changes:
-
*/
}
-#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
}
-/* 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
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);
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);
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);
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 */
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 */
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)); */
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);
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);
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);
/* 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.
}
-/* 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
}
-/* 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
/* 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.
}
-/* 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
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 */
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 {
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);
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);
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);
}
-/* 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
}
-/* 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
/* 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.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- Contact: cacao@cacaojvm.org
-
- Authors: Christian Thalinger
-
- Changes:
-
*/
}
-#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
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 */
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 {
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);
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) {
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);
#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
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 */
}
#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));
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) */
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 > */
# 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) {
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 */
}
-#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
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 */
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);
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) {
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);
}
}
-#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.
}
-#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.
/* 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.
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 */
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) { */
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);
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);
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);
#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
}
-/* 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 <ucontext.h>. */
-
- 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
threads_preinit();
lock_init();
- critical_init();
#endif
/* install architecture dependent signal handlers */
{
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;
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
}