[kaffe] CVS kaffe (robilad): Atomic functions for mips and general mips fixes
Kaffe CVS
cvs-commits at kaffe.org
Thu Mar 24 15:15:15 PST 2005
PatchSet 5598
Date: 2005/03/24 23:04:46
Author: robilad
Branch: HEAD
Tag: (none)
Log:
Atomic functions for mips and general mips fixes
2005-03-24 Thiemo Seufer <ths at networkno.de>
* config/mips/atomic.h: New glibc-style implementation.
* config/mips/atomicity.h: Removed.
* config/mips/common.h: Include atomic.h rather than atomicity.h.
* config/mips/callKaffeException.h, config/mips/trampolines.S,
config/mips/jit.h, config/mips/jit3-icode.h, config/mips/jit3-icode.h:
Fixed some minor typos and inefficiencies.
Members:
ChangeLog:1.3771->1.3772
config/mips/atomicity.h:1.2->1.3(DEAD)
config/mips/callKaffeException.h:1.1->1.2
config/mips/common.h:1.14->1.15
config/mips/jit.h:1.14->1.15
config/mips/jit3-icode.h:1.5->1.6
config/mips/trampolines.S:1.1->1.2
Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3771 kaffe/ChangeLog:1.3772
--- kaffe/ChangeLog:1.3771 Thu Mar 24 01:56:24 2005
+++ kaffe/ChangeLog Thu Mar 24 23:04:46 2005
@@ -1,3 +1,12 @@
+2005-03-24 Thiemo Seufer <ths at networkno.de>
+
+ * config/mips/atomic.h: New glibc-style implementation.
+ * config/mips/atomicity.h: Removed.
+ * config/mips/common.h: Include atomic.h rather than atomicity.h.
+ * config/mips/callKaffeException.h, config/mips/trampolines.S,
+ config/mips/jit.h, config/mips/jit3-icode.h, config/mips/jit3-icode.h:
+ Fixed some minor typos and inefficiencies.
+
2005-03-24 Dalibor Topic <robilad at kaffe.org>
* TODO: Removed all nasty bugs, as they were all fixed. Wow!
===================================================================
Checking out kaffe/config/mips/atomicity.h
RCS: /home/cvs/kaffe/kaffe/config/mips/Attic/atomicity.h,v
VERS: 1.2
***************
--- kaffe/config/mips/atomicity.h Thu Mar 24 23:15:14 2005
+++ /dev/null Sun Aug 4 19:57:58 2002
@@ -1,50 +0,0 @@
-/* Low-level functions for atomic operations. Mips version.
- Copyright (C) 2001, 2002 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
-
-#ifndef _MIPS_ATOMICITY_H
-#define _MIPS_ATOMICITY_H 1
-
-#include <inttypes.h>
-
-static inline int
-__attribute__ ((unused))
-compare_and_swap (volatile long int *p, long int oldval, long int newval)
-{
- long int ret, temp;
-
- __asm__ __volatile__
- ("1:\n\t"
- ".set push\n\t"
- ".set mips2\n\t"
- "ll %1,%5\n\t"
- "move %0,$0\n\t"
- "bne %1,%3,2f\n\t"
- "move %0,%4\n\t"
- "sc %0,%2\n\t"
- ".set pop\n\t"
- "beqz %0,1b\n"
- "2:\n\t"
- : "=&r" (ret), "=&r" (temp), "=m" (*p)
- : "r" (oldval), "r" (newval), "m" (*p)
- : "memory");
-
- return ret;
-}
-
-#endif /* atomicity.h */
Index: kaffe/config/mips/callKaffeException.h
diff -u kaffe/config/mips/callKaffeException.h:1.1 kaffe/config/mips/callKaffeException.h:1.2
--- kaffe/config/mips/callKaffeException.h:1.1 Tue Dec 23 17:26:32 2003
+++ kaffe/config/mips/callKaffeException.h Thu Mar 24 23:04:48 2005
@@ -28,12 +28,14 @@
static inline void callKaffeException(uintp fp,
uintp handler,
struct Hjava_lang_Throwable* eobj) {
- asm volatile(" \n"
- " move $2,%2 \n"
- " move $fp,%0 \n"
- " jr %1 \n"
- " nop \n"
- " " : : "r" (fp), "r" (handler), "r" (eobj) : "$2");
+ asm volatile("\n"
+ " .set push \n"
+ " .set noreorder \n"
+ " move $2,%2 \n"
+ " jr %1 \n"
+ " move $fp,%0 \n"
+ " .set pop \n"
+ : : "r" (fp), "r" (handler), "r" (eobj));
}
#endif /* __mips_callKaffeException_h */
Index: kaffe/config/mips/common.h
diff -u kaffe/config/mips/common.h:1.14 kaffe/config/mips/common.h:1.15
--- kaffe/config/mips/common.h:1.14 Wed Mar 23 02:57:53 2005
+++ kaffe/config/mips/common.h Thu Mar 24 23:04:48 2005
@@ -34,7 +34,7 @@
* do not return the right value. Use the generic one instead.
*/
#if defined(HAVE_MIPSII_INSTRUCTIONS) && 0
-#include "atomicity.h"
+#include "atomic.h"
#else
#include "generic/genatomic.h"
Index: kaffe/config/mips/jit.h
diff -u kaffe/config/mips/jit.h:1.14 kaffe/config/mips/jit.h:1.15
--- kaffe/config/mips/jit.h:1.14 Wed Mar 16 10:30:57 2005
+++ kaffe/config/mips/jit.h Thu Mar 24 23:04:49 2005
@@ -60,10 +60,10 @@
/* The layout of this struct is know by inline assembly. */
typedef struct _methodTrampoline {
- unsigned code[5];
+ unsigned code[4];
struct _methods *meth;
void** where;
- unsigned pad[1];
+ unsigned pad[2];
} methodTrampoline;
extern void mips_do_fixup_trampoline(void);
@@ -72,11 +72,10 @@
#define FILL_IN_TRAMPOLINE(t,m,w) \
do { \
uint32 pc = (unsigned int)mips_do_fixup_trampoline; \
- (t)->code[0] = 0x001f1021; /* addu $2,$31,$0 */ \
- (t)->code[1] = 0x3c190000 | (pc >> 16); /* lui $25,addr(high) */ \
- (t)->code[2] = 0x37390000 | (pc & 0xffff);/* ori $25,$25,addr(low) */ \
- (t)->code[3] = 0x0320f809; /* jalr $31,$25 */ \
- (t)->code[4] = 0x00000000; /* nop */ \
+ (t)->code[0] = 0x3c190000 | (pc >> 16); /* lui $25,addr(high) */ \
+ (t)->code[1] = 0x37390000 | (pc & 0xffff);/* ori $25,$25,addr(low) */ \
+ (t)->code[2] = 0x0320f809; /* jalr $31,$25 */ \
+ (t)->code[3] = 0x001f1021; /* addu $2,$31,$0 */ \
(t)->meth = (m); \
(t)->where = (w); \
} while (0)
@@ -92,7 +91,7 @@
#define RFD (Rfloat|Rdouble)
#define RG (Rglobal|Rnosaveoncall)
-/* Define the register set, bereits an mips angepasst*/
+/* Define the register set, already adapted for MIPS. */
#define REGISTER_SET \
{ /* i0 */ 0, 0, Reserved, 0, 0, 0 }, \
{ /* i1 */ 0, 0, Reserved, 0, 0, 1 }, \
@@ -208,13 +207,13 @@
#define LABEL_Lframe(P,V,L) \
{ \
int framesize = FRAMESIZE; \
- assert((framesize & 0xFFFFF000) == 0); \
+ assert((framesize & 0xFFFF0000) == 0); \
*(P) = (*(P) & 0xFFFF0000) | ((-framesize) & 0xFFFF); \
}
#define LABEL_Lnegframe(P,V,L) \
{ \
int framesize = FRAMESIZE; \
- assert((framesize & 0xFFFFF000) == 0); \
+ assert((framesize & 0xFFFF0000) == 0); \
*(P) = (*(P) & 0xFFFF0000) | ((framesize) & 0xFFFF); \
}
#define LABEL_Llong16b(P,V,L) (P)[0]=((P)[0]&0xFFFF0000)|((((V)-4)>>2)&0xFFFF)
Index: kaffe/config/mips/jit3-icode.h
diff -u kaffe/config/mips/jit3-icode.h:1.5 kaffe/config/mips/jit3-icode.h:1.6
--- kaffe/config/mips/jit3-icode.h:1.5 Sun Jul 11 19:03:03 2004
+++ kaffe/config/mips/jit3-icode.h Thu Mar 24 23:04:49 2005
@@ -1,4 +1,4 @@
-/* mips/jit-icode.h
+/* mips/jit3-icode.h
* Define the instructions which are present on the MIPS.
*
* Copyright (c) 1996 T. J. Wilkinson & Associates, London, UK.
@@ -189,7 +189,7 @@
#define HAVE_add_int_const_rangecheck(v) __intconst_rangecheck(v)
#define HAVE_add_ref_const_rangecheck(v) __intconst_rangecheck(v)
-#define HAVE_sub_int_const_rangecheck(v) ((v) >= -32767 && (v) <= 327678) /*swapped -67,68*/
+#define HAVE_sub_int_const_rangecheck(v) ((v) >= -32767 && (v) <= 32768) /*swapped -67,68*/
#undef HAVE_cmp_int_const_rangecheck
#define HAVE_load_offset_int_rangecheck(v) __intconst_rangecheck(v)
#define HAVE_load_offset_ref_rangecheck(v) __intconst_rangecheck(v) /* new */
Index: kaffe/config/mips/trampolines.S
diff -u kaffe/config/mips/trampolines.S:1.1 kaffe/config/mips/trampolines.S:1.2
--- kaffe/config/mips/trampolines.S:1.1 Wed Mar 16 10:30:57 2005
+++ kaffe/config/mips/trampolines.S Thu Mar 24 23:04:49 2005
@@ -36,7 +36,7 @@
.globl mips_do_fixup_trampoline
.ent mips_do_fixup_trampoline
mips_do_fixup_trampoline:
- addi $sp, $sp, -48
+ addiu $sp, $sp, -48
# needed by the backtracer
sw $31, 0($sp)
sw $2, 0($sp)
@@ -68,7 +68,7 @@
lw $4, 8($sp)
lw $gp, 4($sp)
lw $31, 0($sp)
- addi $sp, $sp, 48
+ addiu $sp, $sp, 48
move $25, $2
jr $2
.end mips_do_fixup_trampoline
More information about the kaffe
mailing list