public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jie Liu <lj8175@gmail.com>
To: java-patches@gcc.gnu.org, java@gcc.gnu.org, gcc-patches@gcc.gnu.org
Cc: Joel Sherrill <joel.sherrill@oarcorp.com>
Subject: [PATCH] [JAVA] patch for Java on RTEMS
Date: Wed, 10 Aug 2011 17:00:00 -0000	[thread overview]
Message-ID: <CABc96T_MHjbKHrW8oHgBFW9k=79qeck_HehbxWA=CkWv4+k70Q@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1068 bytes --]

Hi,

For the previous analysis "libjava patches for RTEMS"[1], there are 6
cases need to pay more attention. PR18699, TLtest, Thread_Interrupt,
Thread_Sleep_2, Throw_2 and bclink.

After add patch to bdwgc for RTEMS pthread support[2]:
PR18699                PASS after Modify       [A bug in boehm-gc on
RTEMS, not related to libjava]
TLtest                    PASS
Thread_Interrupt      PASS

For the other 3 cases:
Thread_Sleep_2      PASS                       [After add patch to rtems]
Throw_2                 PASS                       [After add patch to
libjava, still need some work][3]
bclink                    UnSupport
[-findirect-dispatch do not support in this case]

I think it's time to send out the patch for review, because it may
need much time to modify. The patch is attached.

How to mark those unsupported cases as expected failures on *-*-rtems* ?

[1]http://gcc.gnu.org/ml/java-patches/2011-q3/msg00016.html
[2]http://gcc.gnu.org/ml/java-patches/2011-q3/msg00042.html
[3]http://gcc.gnu.org/ml/java-patches/2011-q3/msg00037.html

Thanks,
Jie

[-- Attachment #2: libjava.patch --]
[-- Type: application/octet-stream, Size: 4662 bytes --]

Index: configure.host
===================================================================
--- configure.host	(revision 172224)
+++ configure.host	(working copy)
@@ -347,8 +347,13 @@
 	slow_pthread_self=
 	can_unwind_signal=yes
 	;;
+  *-*-rtems*)
+	can_unwind_signal=no
+	CHECKREFSPEC=-fcheck-references
+	DIVIDESPEC=-fuse-divide-subroutine
+	;;
 esac
 
 case "${host}" in
   *-cygwin* | *-mingw*)
 	fallback_backtrace_h=sysdep/i386/backtrace.h  
Index: configure.ac
===================================================================
--- configure.ac	(revision 172224)
+++ configure.ac	(working copy)
@@ -1048,6 +1048,19 @@
     ;;
  win32)
     ;;
+ rtems)
+    THREADS=posix
+    AC_DEFINE(HAVE_SYS_SOCKET_H, 1, [Required define in rtems.])
+    AC_DEFINE(HAVE_NETINET_IN_H, 1, [Required define in rtems.])
+    AC_DEFINE(HAVE_ARPA_INET_H, 1, [Required define in rtems.])
+    AC_DEFINE(HAVE_NETDB_H, 1, [Required define in rtems.])
+    AC_DEFINE(HAVE_SYS_IOCTL_H, 1, [Required define in rtems.])
+    AC_DEFINE(HAVE_NET_IF_H, 1, [Required define in rtems.])
+    AC_DEFINE(HAVE_IFADDRS_H, 1, [Required define in rtems.])
+    AC_DEFINE(HAVE_GETTIMEOFDAY, 1, [Required define in rtems.])
+    AC_DEFINE(HAVE_GETHOSTNAME_DECL, 1, [Required define in rtems.])
+    AC_DEFINE(RTEMS_PTHREADS, 1, [Required define in rtems.])
+    ;;
  decosf1 | irix | mach | os2 | dce | vxworks)
     AC_MSG_ERROR(thread package $THREADS not yet supported)
     ;;
Index: classpath/native/fdlibm/mprec.c
===================================================================
--- classpath/native/fdlibm/mprec.c	(revision 172224)
+++ classpath/native/fdlibm/mprec.c	(working copy)
@@ -1004,7 +1004,7 @@
 {1e-16, 1e-32};
 #endif
 
-
+#ifdef RTEMS_PTHREADS
 double
 _DEFUN (_mprec_log10, (dig),
 	int dig)
@@ -1019,3 +1019,4 @@
     }
   return v;
 }
+#endif
Index: include/config.h.in
===================================================================
--- include/config.h.in	(revision 172224)
+++ include/config.h.in	(working copy)
@@ -379,6 +379,9 @@
 /* Define if using POSIX threads on Linux. */
 #undef LINUX_THREADS
 
+/* Define if using POSIX threads on RTEMS. */
+#undef RTEMS_PTHREADS
+
 /* Define to the name of the environment variable that determines the dynamic
    library search path. */
 #undef LTDL_SHLIBPATH_VAR
Index: posix-threads.cc
===================================================================
--- posix-threads.cc	(revision 172224)
+++ posix-threads.cc	(working copy)
@@ -62,9 +62,11 @@
 static int non_daemon_count;
 
 // The signal to use when interrupting a thread.
-#if defined(LINUX_THREADS) || defined(FREEBSD_THREADS)
+#if defined(LINUX_THREADS) || defined(FREEBSD_THREADS) \
+    || defined(RTEMS_PTHREADS)
   // LinuxThreads (prior to glibc 2.1) usurps both SIGUSR1 and SIGUSR2.
   // GC on FreeBSD uses both SIGUSR1 and SIGUSR2.
+  // GC on  RTEMS  uses both SIGUSR1 and SIGUSR2.
 #  define INTR SIGHUP
 #else /* LINUX_THREADS */
 #  define INTR SIGUSR2
@@ -672,6 +674,10 @@
   pthread_attr_setschedparam (&attr, &param);
   pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
   
+#ifdef RTEMS_PTHREADS
+  pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
+  pthread_attr_setschedpolicy(&attr, SCHED_OTHER);
+#endif
   // Set stack size if -Xss option was given.
   if (gcj::stack_size > 0)
     {
Index: configure
===================================================================
--- configure	(revision 172224)
+++ configure	(working copy)
@@ -20704,6 +20704,21 @@
     ;;
  win32)
     ;;
+ rtems)
+    THREADS=posix
+$as_echo "#define HAVE_SYS_SOCKET_H 1" >>confdefs.h
+$as_echo "#define HAVE_NETINET_IN_H 1" >>confdefs.h
+$as_echo "#define HAVE_ARPA_INET_H 1" >>confdefs.h
+$as_echo "#define HAVE_NETDB_H 1" >>confdefs.h
+$as_echo "#define HAVE_SYS_IOCTL_H 1" >>confdefs.h
+$as_echo "#define HAVE_NET_IF_H 1" >>confdefs.h
+$as_echo "#define HAVE_IFADDRS_H 1" >>confdefs.h
+$as_echo "#define HAVE_GETTIMEOFDAY 1" >>confdefs.h
+$as_echo "#define HAVE_GETHOSTNAME_DECL 1" >>confdefs.h
+$as_echo "#define HAVE_MPREC_LOG10 1" >>confdefs.h
+$as_echo "#define NO_TLS 1" >>confdefs.h
+$as_echo "#define RTEMS_PTHREADS 1" >>confdefs.h
+    ;;
  decosf1 | irix | mach | os2 | dce | vxworks)
     as_fn_error "thread package $THREADS not yet supported" "$LINENO" 5
     ;;
Index: java/lang/natClass.cc
===================================================================
--- java/lang/natClass.cc	(revision 172224)
+++ java/lang/natClass.cc	(working copy)
@@ -1679,6 +1679,10 @@
   return NULL;
 }
 
+#ifdef RTEMS_PTHREADS
+# undef HAVE_TLS
+#endif
+
 #ifdef HAVE_TLS
 
 // NOTE: MCACHE_SIZE should be a power of 2 minus one.

             reply	other threads:[~2011-08-10 17:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-10 17:00 Jie Liu [this message]
2011-08-14 13:04 ` Jie Liu
2011-08-26 13:33   ` Ralf Corsepius
2011-08-15  9:43 ` Andrew Haley
2011-08-15 14:07   ` Jie Liu
2011-08-15 14:11     ` Andrew Haley
2011-08-26 13:20     ` Ralf Wildenhues

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABc96T_MHjbKHrW8oHgBFW9k=79qeck_HehbxWA=CkWv4+k70Q@mail.gmail.com' \
    --to=lj8175@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=java-patches@gcc.gnu.org \
    --cc=java@gcc.gnu.org \
    --cc=joel.sherrill@oarcorp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).