bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/28612] New: Native code needs serious cleanup


From: csm at gnu dot org
Subject: [Bug classpath/28612] New: Native code needs serious cleanup
Date: 5 Aug 2006 19:00:38 -0000

It's a long story, but the JNI code that Classpath includes is written to a
"TARGET_NATIVE" convention, which basically means you swaddle plain system
calls (like read) with C macros (like TARGET_NATIVE_NETWORK_SOCKET_RECEIVE).
Few of us see the point in doing this; it's extremely ugly and hard to maintain
this kind of code.

The argument for this stuff is that it makes the JNI code "portable" -- all you
have to do is #define a few hundred macros specific to your system, and run
with it. But, even though this convention has this lofty goal, in practice it
still calls everything using POSIX conventions: so a new target layer would, in
essense, need to replicate POSIX system calls, only with verbose macro names.

(I mean, please explain to me why defining
TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL is more portable than using EINTR.
Oh, your system doesn't have EINTR? Then define it! The point here is that
POSIX *is* a portable system API, and we should use it)

But anyway this code should be changed to use POSIX semantics, and should use
wrapper functions for system calls for user thread systems (so blocking system
calls can be replaced with non-blocking ones). We should not ship code this
ugly and hard to maintain, if we can help it.


-- 
           Summary: Native code needs serious cleanup
           Product: classpath
           Version: 0.92
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: classpath
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: csm at gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28612





reply via email to

[Prev in Thread] Current Thread [Next in Thread]