public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [ecj] VMStackWalker javadoc
@ 2006-11-29  9:37 Gary Benson
  2006-11-29 14:14 ` [ecj] Remove DECL_INLINE for methods that call BUILT_IN_RETURN_ADDRESS Andrew Haley
  0 siblings, 1 reply; 2+ messages in thread
From: Gary Benson @ 2006-11-29  9:37 UTC (permalink / raw)
  To: java-patches

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

Hi all,

This commit adds gcj-specific javadoc to the new VMStackWalker
class in order to make it more obvious how it all works.

Cheers,
Gary

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 3452 bytes --]

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 119303)
+++ ChangeLog	(working copy)
@@ -1,3 +1,7 @@
+2006-11-29  Gary Benson  <gbenson@redhat.com>
+
+	* gnu/classpath/VMStackWalker.java: Added javadoc.
+
 2006-11-27  Andrew Haley  <aph@redhat.com>
 
 	* sun/reflect/misc/ReflectUtil.java (checkPackageAccess):
Index: gnu/classpath/VMStackWalker.java
===================================================================
--- gnu/classpath/VMStackWalker.java	(revision 119303)
+++ gnu/classpath/VMStackWalker.java	(working copy)
@@ -1,5 +1,5 @@
 /* VMStackWalker.java -- Reference implementation of VM hooks for stack access
-   Copyright (C) 2005 Free Software Foundation
+   Copyright (C) 2005, 2006 Free Software Foundation
 
 This file is part of GNU Classpath.
 
@@ -50,6 +50,7 @@
  * @author John Keiser
  * @author Eric Blake <ebb9@email.byu.edu>
  * @author Archie Cobbs
+ * @author Andrew Haley <aph@redhat.com>
  */
 public final class VMStackWalker
 {
@@ -81,8 +82,11 @@
    * and should return the same result.
    *
    * <p>
-   * VM implementers are encouraged to provide a more efficient
-   * version of this method.
+   * When compiling to native code gcj translates calls to this
+   * method into calls to <code>getCallingClass(addr)</code>, with
+   * <code>addr</code> being the address of the method calling this
+   * method. <code>getCallingClass(addr)</code> does not unwind the
+   * stack, so is therefore more efficient.
    */
   public static Class getCallingClass()
     throws NotImplementedException
@@ -93,10 +97,15 @@
     return ctx[2];
   }
 
-  private static native Class getCallingClass(RawData p);
+  /**
+   * Get the class associated with the method invoking the method
+   * invoking this method, or <code>null</code> if the stack is not
+   * that deep (e.g., invoked via JNI invocation API).
+   *
+   * @param addr The address of the method invoking this method.
+   */
+  private static native Class getCallingClass(RawData addr);
 
-  private static native ClassLoader getCallingClassLoader(RawData p);
-
   /**
    * Get the class loader associated with the Class returned by
    * <code>getCallingClass()</code>, or <code>null</code> if no such class
@@ -105,8 +114,11 @@
    * and should return the same result.
    *
    * <p>
-   * VM implementers are encouraged to provide a more efficient
-   * version of this method.
+   * When compiling to native code gcj translates calls to this
+   * method into calls to <code>getCallingClassLoader(addr)</code>,
+   * with <code>addr</code> being the address of the method calling
+   * this method. <code>getCallingClassLoader(addr)</code> does not
+   * unwind the stack, so is therefore more efficient.
    */
   public static ClassLoader getCallingClassLoader()
     throws NotImplementedException
@@ -118,6 +130,15 @@
   }
 
   /**
+   * Get the class loader associated with the Class returned by
+   * <code>getCallingClass()</code>, or <code>null</code> if no
+   * such class exists or it is the boot loader.
+   * 
+   * @param addr The address of the method invoking this method.
+   */
+  private static native ClassLoader getCallingClassLoader(RawData addr);
+
+  /**
    * Retrieve the class's ClassLoader, or <code>null</code> if loaded
    * by the bootstrap loader. I.e., this should return the same thing
    * as {@link java.lang.VMClass#getClassLoader}. This duplicate version

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

* [ecj] Remove DECL_INLINE for methods that call BUILT_IN_RETURN_ADDRESS
  2006-11-29  9:37 [ecj] VMStackWalker javadoc Gary Benson
@ 2006-11-29 14:14 ` Andrew Haley
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Haley @ 2006-11-29 14:14 UTC (permalink / raw)
  To: Gary Benson; +Cc: gcc-patches, java-patches

Methods that call BUILT_IN_RETURN_ADDRESS must not be inlined.  They
mustn't be sibcalled either.

Andrew.


2006-11-29  Andrew Haley  <aph@redhat.com>

	* expr.c (rewrite_arglist_getcaller): Remove DECL_INLINE.
	* lang.c (java_decl_ok_for_sibcall): Check for DECL_INLINE.

Index: java/expr.c
===================================================================
--- java/expr.c (revision 119121)
+++ java/expr.c (working copy)
@@ -2054,6 +2054,8 @@
 static tree 
 rewrite_arglist_getcaller (tree arglist)
 {
+  DECL_INLINE (current_function_decl) = 0;
+
   tree retaddr 
     = (build_function_call_expr 
        (built_in_decls[BUILT_IN_RETURN_ADDRESS],
Index: java/lang.c
===================================================================
--- java/lang.c (revision 119120)
+++ java/lang.c (working copy)
@@ -999,7 +999,8 @@
 static bool
 java_decl_ok_for_sibcall (tree decl)
 {
-  return decl != NULL && DECL_CONTEXT (decl) == output_class;
+  return (decl != NULL && DECL_CONTEXT (decl) == output_class
+         && DECL_INLINE (decl));
 }
 
 /* Given a call_expr, try to figure out what its target might be.  In

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

end of thread, other threads:[~2006-11-29 14:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-29  9:37 [ecj] VMStackWalker javadoc Gary Benson
2006-11-29 14:14 ` [ecj] Remove DECL_INLINE for methods that call BUILT_IN_RETURN_ADDRESS Andrew Haley

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