public inbox for java@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: GJ: A Generic Java
  2000-04-01  0:00   ` Patrick Tullmann
@ 2000-04-01  0:00     ` Tom Tromey
  2000-04-01  0:00       ` Anthony Green
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Patrick Tullmann; +Cc: Tom Tromey, Andrew Haley, java-discuss

>>>>> "Patrick" == Patrick Tullmann <tullmann@cs.utah.edu> writes:

Patrick> I belive this is only available in the 1.3 JDK and later...
Patrick> The rumors I've heard is that the code is just the GJ
Patrick> reference implementation that's been available separately for
Patrick> a while now.

That's what the article said, too.  It implied that generics would end
up in core Java, but I always assume statements like that have a
certain amount of wishful thinking in them.

The article talks a bit about Java's type system as a whole.  There is
a book called "Object Oriented Type Systems" which AG recommended to
me that describes a type systme (with generics) very similar to what
Java implements (OOTS doesn't have non-object types, as I recall).

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GJ: A Generic Java
  2000-04-01  0:00 ` Tom Tromey
@ 2000-04-01  0:00   ` Patrick Tullmann
  2000-04-01  0:00     ` Tom Tromey
  0 siblings, 1 reply; 8+ messages in thread
From: Patrick Tullmann @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Andrew Haley, java-discuss

Tom Tromey wrote:
> There have been Java implementations with generics for a while now --
> "pizza" had generics.  If they end up in the official Java, though,
> that would be cool.  It would also be a lot more work for Alex...

It is unofficially in official Java.  I believe you just have to
invoke GJMain instead of Main in the com.sun.tools.javac package:

% java com.sun.tools.javac.GJMain <filename>.java 

I belive this is only available in the 1.3 JDK and later...  The
rumors I've heard is that the code is just the GJ reference
implementation that's been available separately for a while now.

-Pat

----- ----- ---- ---  ---  --   -    -      -         -               -
Pat Tullmann                                       tullmann@cs.utah.edu
 Thisemailhasbeenbroughttoyoubycocacolafavoredbyprogrammerseverywhere

^ permalink raw reply	[flat|nested] 8+ messages in thread

* gcj: disabling synchronization
  2000-04-01  0:00       ` Anthony Green
@ 2000-04-01  0:00         ` Jeff Sturm
  2000-04-01  0:00           ` Alexandre Petit-Bianco
  0 siblings, 1 reply; 8+ messages in thread
From: Jeff Sturm @ 2000-04-01  0:00 UTC (permalink / raw)
  To: java-discuss

I'm thinking about adding a flag to gcj to disable synchronization for
single-threaded programs (i.e. when libgcj is built without
--enable-threads), something like -fno-synchronized perhaps.

I've found that synchronized blocks incur significant overhead in
single-threaded code, particularly when configured with SJLJ_EXCEPTIONS.

It's easy to defeat synchronized methods in decl.c.  Synchronized
blocks are a little harder... I didn't completely understand the tree
structure created by patch_synchronized_statement.  It may be obvious to
anyone who understands the compiler internals (which I certainly don't).

Does anyone think this would be worthwhile for gcj?

--
Jeff Sturm
jsturm@sigma6.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GJ: A Generic Java
  2000-04-01  0:00 GJ: A Generic Java Andrew Haley
@ 2000-04-01  0:00 ` Tom Tromey
  2000-04-01  0:00   ` Patrick Tullmann
  0 siblings, 1 reply; 8+ messages in thread
From: Tom Tromey @ 2000-04-01  0:00 UTC (permalink / raw)
  To: Andrew Haley; +Cc: java-discuss

Andrew> http://www.ddj.com/articles/2000/0002/0002a/0002a.htm

I read this.  It was very interesting.

There have been Java implementations with generics for a while now --
"pizza" had generics.  If they end up in the official Java, though,
that would be cool.  It would also be a lot more work for Alex...

Tom

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: GJ: A Generic Java
  2000-04-01  0:00     ` Tom Tromey
@ 2000-04-01  0:00       ` Anthony Green
  2000-04-01  0:00         ` gcj: disabling synchronization Jeff Sturm
  0 siblings, 1 reply; 8+ messages in thread
From: Anthony Green @ 2000-04-01  0:00 UTC (permalink / raw)
  To: tromey; +Cc: tullmann, tromey, aph, java-discuss

Tom wrote:
> The article talks a bit about Java's type system as a whole.

Kresten knows a lot about their compiler.  I believe his PhD thesis
has to do with generic type systems.

We were originally going to call gcj "gjc", but that was the name of
their compiler. :-)

AG

-- 
Anthony Green                                                        Red Hat
                                                       Sunnyvale, California

^ permalink raw reply	[flat|nested] 8+ messages in thread

* GJ: A Generic Java
@ 2000-04-01  0:00 Andrew Haley
  2000-04-01  0:00 ` Tom Tromey
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Haley @ 2000-04-01  0:00 UTC (permalink / raw)
  To: java-discuss

Quite interesting.

http://www.ddj.com/articles/2000/0002/0002a/0002a.htm

Andrew.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: gcj: disabling synchronization
  2000-04-01  0:00         ` gcj: disabling synchronization Jeff Sturm
@ 2000-04-01  0:00           ` Alexandre Petit-Bianco
  2000-04-01  0:00             ` Jeff Sturm
  0 siblings, 1 reply; 8+ messages in thread
From: Alexandre Petit-Bianco @ 2000-04-01  0:00 UTC (permalink / raw)
  To: java-discuss

Jeff Sturm writes:

> I didn't completely understand the tree structure created by
> patch_synchronized_statement.  It may be obvious to anyone who
> understands the compiler internals (which I certainly don't).

It basically builds what is documented in the comment found in the
middle of patch_synchronized_statement: surrounding the synchronized
block with a try/catch sequence so that if an exception is thrown
during the execution of the block, the synchronization lock is
released and the exception rethrown.

If you read java-tree.def, you'll find that the SYNCHRONIZED_EXPR
contains two things: first the expression on which we synchronize and
then the synchronized block. I thing something hereafter might work.

./A

Index: parse.y
===================================================================
RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
retrieving revision 1.133
diff -u -p -r1.133 parse.y
--- parse.y	2000/01/25 18:29:02	1.133
+++ parse.y	2000/01/29 20:06:39
@@ -11720,6 +11724,15 @@ patch_synchronized_statement (node, wfl_
       parse_error_context (wfl_operator, "Incompatible type for `synchronized'. Can't convert `%s' to `java.lang.Object'",
 			   lang_printable_name (TREE_TYPE (expr), 0));
       return error_mark_node;
+    }
+
+  /* If we actually don't synchronize. Simply return a compound
+     expression */
+  if (flag_no_synch)
+    {
+      block = java_complete_tree (block);
+      return (block == error_mark_node ?
+	      block : build (COMPOUND_EXPR, void_type_node, expr, block));
     }
 
   if (flag_emit_xref)

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: gcj: disabling synchronization
  2000-04-01  0:00           ` Alexandre Petit-Bianco
@ 2000-04-01  0:00             ` Jeff Sturm
  0 siblings, 0 replies; 8+ messages in thread
From: Jeff Sturm @ 2000-04-01  0:00 UTC (permalink / raw)
  To: apbianco; +Cc: java-discuss

On Sat, 29 Jan 2000, Alexandre Petit-Bianco wrote:
> If you read java-tree.def, you'll find that the SYNCHRONIZED_EXPR
> contains two things: first the expression on which we synchronize and
> then the synchronized block. I thing something hereafter might work.

Thanks.  It almost works now.  Sometimes I get "Unreachable statement"
however:

[jsturm@cc42593-a tmp]$ cat T.java
public class T {
    public int t() {
        int n;
        synchronized (this) {
            n = 1;
        }
        return n;
    }
}
[jsturm@cc42593-a tmp]$ gcj -c -fno-monitors T.java
T.java: In class `T':
T.java: In method `t()':
T.java:7: Unreachable statement.
		return n;
		^
1 error

I'll see if I can figure out what's going on in java_complete_lhs.

--
Jeff Sturm
jsturm@sigma6.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2000-04-01  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-01  0:00 GJ: A Generic Java Andrew Haley
2000-04-01  0:00 ` Tom Tromey
2000-04-01  0:00   ` Patrick Tullmann
2000-04-01  0:00     ` Tom Tromey
2000-04-01  0:00       ` Anthony Green
2000-04-01  0:00         ` gcj: disabling synchronization Jeff Sturm
2000-04-01  0:00           ` Alexandre Petit-Bianco
2000-04-01  0:00             ` Jeff Sturm

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).