[kaffe] CVS kaffe (robilad): resynced with gnu classpath: serialization and vmstackwalker

Kaffe CVS cvs-commits at kaffe.org
Sun May 15 09:55:36 PDT 2005


PatchSet 6501 
Date: 2005/05/15 16:49:55
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
resynced with gnu classpath: serialization and vmstackwalker

2005-05-15  Dalibor Topic  <robilad at kaffe.org>

        * include/Makefile.am (NOINSTALL_JNI_DERIVED_HDRS):
        Added gnu_classpath_VMStackWalker.h.

        * libraries/clib/native/gnu_classpath_VMStackWalker.c:
        New file.

        Resynced with GNU Classpath.

        2005-04-30  Mark Wielaard  <mark at klomp.org>

        * java/io/ObjectInputStream.java
        (currentLoader): Don't create SecurityManager, directly call
        VMObjectInputStream.currentClassLoader().
        (resolveProxyClass): Use currentLoader().
        * vm/reference/java/io/VMObjectInputStream.java
        (currentClassLoader(SecurityManager)): Removed.
        (currentClassLoader): New method.
        * native/jni/java-io/java_io_VMObjectInputStream.c
        (Java_java_io_VMObjectInputStream_currentClassLoader): Removed.

        2005-01-29  Steven Augart  <augart at watson.ibm.com>

        * vm/reference/gnu/classpath/VMStackWalker.java: Doc fix.

        2005-01-07  Archie Cobbs  <archie at dellroad.org>

        * vm/reference/gnu/classpath/VMStackWalker.java: New class.

Members: 
	ChangeLog:1.4026->1.4027 
	include/Makefile.am:1.100->1.101 
	include/Makefile.in:1.229->1.230 
	libraries/clib/io/java_io_VMObjectInputStream.c:1.1->1.2 
	libraries/clib/native/Makefile.am:1.43->1.44 
	libraries/clib/native/Makefile.in:1.182->1.183 
	libraries/clib/native/gnu_classpath_VMStackWalker.c:INITIAL->1.1 
	libraries/javalib/Makefile.am:1.347->1.348 
	libraries/javalib/Makefile.in:1.437->1.438 
	libraries/javalib/all.files:1.121->1.122 
	libraries/javalib/gnu/classpath/VMStackWalker.java:INITIAL->1.1 
	libraries/javalib/java/io/ObjectInputStream.java:1.52->1.53 
	libraries/javalib/java/io/VMObjectInputStream.java:1.1->1.2 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4026 kaffe/ChangeLog:1.4027
--- kaffe/ChangeLog:1.4026	Sun May 15 13:08:55 2005
+++ kaffe/ChangeLog	Sun May 15 16:49:55 2005
@@ -1,5 +1,35 @@
 2005-05-15  Dalibor Topic  <robilad at kaffe.org>
 
+	* include/Makefile.am (NOINSTALL_JNI_DERIVED_HDRS):
+ 	Added gnu_classpath_VMStackWalker.h.
+
+	* libraries/clib/native/gnu_classpath_VMStackWalker.c:
+	New file.
+
+	Resynced with GNU Classpath.
+
+	2005-04-30  Mark Wielaard  <mark at klomp.org>
+
+        * java/io/ObjectInputStream.java
+        (currentLoader): Don't create SecurityManager, directly call
+        VMObjectInputStream.currentClassLoader().
+        (resolveProxyClass): Use currentLoader().
+        * vm/reference/java/io/VMObjectInputStream.java
+        (currentClassLoader(SecurityManager)): Removed.
+        (currentClassLoader): New method.
+        * native/jni/java-io/java_io_VMObjectInputStream.c
+        (Java_java_io_VMObjectInputStream_currentClassLoader): Removed.
+
+	2005-01-29  Steven Augart  <augart at watson.ibm.com>
+
+        * vm/reference/gnu/classpath/VMStackWalker.java: Doc fix.
+
+	2005-01-07  Archie Cobbs  <archie at dellroad.org>
+
+        * vm/reference/gnu/classpath/VMStackWalker.java: New class.
+
+2005-05-15  Dalibor Topic  <robilad at kaffe.org>
+
 	Resynced with GNU Classpath.
 
 	2005-04-30  Mark Wielaard  <mark at klomp.org>
Index: kaffe/include/Makefile.am
diff -u kaffe/include/Makefile.am:1.100 kaffe/include/Makefile.am:1.101
--- kaffe/include/Makefile.am:1.100	Sat May 14 21:46:26 2005
+++ kaffe/include/Makefile.am	Sun May 15 16:50:00 2005
@@ -219,6 +219,7 @@
 	java_lang_VMDouble.h \
 	java_lang_VMFloat.h \
 	java_lang_ref_Reference.h \
+	gnu_classpath_VMStackWalker.h \
 	gnu_classpath_VMSystemProperties.h \
 	gnu_java_nio_charset_iconv_IconvDecoder.h \
 	gnu_java_nio_charset_iconv_IconvEncoder.h \
Index: kaffe/include/Makefile.in
diff -u kaffe/include/Makefile.in:1.229 kaffe/include/Makefile.in:1.230
--- kaffe/include/Makefile.in:1.229	Sat May 14 21:46:26 2005
+++ kaffe/include/Makefile.in	Sun May 15 16:50:00 2005
@@ -561,6 +561,7 @@
 	java_lang_VMDouble.h \
 	java_lang_VMFloat.h \
 	java_lang_ref_Reference.h \
+	gnu_classpath_VMStackWalker.h \
 	gnu_classpath_VMSystemProperties.h \
 	gnu_java_nio_charset_iconv_IconvDecoder.h \
 	gnu_java_nio_charset_iconv_IconvEncoder.h \
Index: kaffe/libraries/clib/io/java_io_VMObjectInputStream.c
diff -u kaffe/libraries/clib/io/java_io_VMObjectInputStream.c:1.1 kaffe/libraries/clib/io/java_io_VMObjectInputStream.c:1.2
--- kaffe/libraries/clib/io/java_io_VMObjectInputStream.c:1.1	Fri Apr 22 22:29:45 2005
+++ kaffe/libraries/clib/io/java_io_VMObjectInputStream.c	Sun May 15 16:50:00 2005
@@ -49,28 +49,6 @@
 
 /*
  * Class:     java_io_VMObjectInputStream
- * Method:    currentClassLoader
- * Signature: (Ljava/lang/SecurityManager;)Ljava/lang/ClassLoader;
- */
-JNIEXPORT jobject JNICALL
-Java_java_io_VMObjectInputStream_currentClassLoader (JNIEnv * env,
-						   jclass clazz,
-						   jobject loader)
-{
-  jmethodID id = (*env)->GetMethodID (env,
-				      (*env)->GetObjectClass (env, loader),
-				      "currentClassLoader",
-				      "()Ljava/lang/ClassLoader;");
-
-  if (id == NULL)
-    return NULL;
-
-  return (*env)->CallObjectMethod (env, loader, id, clazz);
-}
-
-
-/*
- * Class:     java_io_VMObjectInputStream
  * Method:    allocateObject
  * Signature: (Ljava/lang/Class;)Ljava/lang/Object;
  */
Index: kaffe/libraries/clib/native/Makefile.am
diff -u kaffe/libraries/clib/native/Makefile.am:1.43 kaffe/libraries/clib/native/Makefile.am:1.44
--- kaffe/libraries/clib/native/Makefile.am:1.43	Sun Apr 24 09:57:37 2005
+++ kaffe/libraries/clib/native/Makefile.am	Sun May 15 16:50:01 2005
@@ -33,6 +33,7 @@
 		ThreadStack.c \
 		Throwable.c \
 		UNIXProcess.c \
+		gnu_classpath_VMStackWalker.c \
 		gnu_classpath_VMSystemProperties.c \
 		ZipFile.c
 
Index: kaffe/libraries/clib/native/Makefile.in
diff -u kaffe/libraries/clib/native/Makefile.in:1.182 kaffe/libraries/clib/native/Makefile.in:1.183
--- kaffe/libraries/clib/native/Makefile.in:1.182	Sat May 14 21:46:54 2005
+++ kaffe/libraries/clib/native/Makefile.in	Sun May 15 16:50:01 2005
@@ -99,6 +99,7 @@
 	libnative_la-String.lo libnative_la-System.lo \
 	libnative_la-Thread.lo libnative_la-ThreadStack.lo \
 	libnative_la-Throwable.lo libnative_la-UNIXProcess.lo \
+	libnative_la-gnu_classpath_VMStackWalker.lo \
 	libnative_la-gnu_classpath_VMSystemProperties.lo \
 	libnative_la-ZipFile.lo
 am__objects_2 = libnative_la-Array.lo libnative_la-Constructor.lo \
@@ -425,6 +426,7 @@
 		ThreadStack.c \
 		Throwable.c \
 		UNIXProcess.c \
+		gnu_classpath_VMStackWalker.c \
 		gnu_classpath_VMSystemProperties.c \
 		ZipFile.c
 
@@ -565,6 +567,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnative_la-TimeZone.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnative_la-UNIXProcess.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnative_la-ZipFile.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnative_la-gnu_classpath_VMStackWalker.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnative_la-gnu_classpath_VMSystemProperties.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnative_la-java_lang_VMDouble.Plo at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libnative_la-java_lang_VMFloat.Plo at am__quote@
@@ -695,6 +698,13 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	source='UNIXProcess.c' object='libnative_la-UNIXProcess.lo' libtool=yes @AMDEPBACKSLASH@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnative_la_CFLAGS) $(CFLAGS) -c -o libnative_la-UNIXProcess.lo `test -f 'UNIXProcess.c' || echo '$(srcdir)/'`UNIXProcess.c
+
+libnative_la-gnu_classpath_VMStackWalker.lo: gnu_classpath_VMStackWalker.c
+ at am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnative_la_CFLAGS) $(CFLAGS) -MT libnative_la-gnu_classpath_VMStackWalker.lo -MD -MP -MF "$(DEPDIR)/libnative_la-gnu_classpath_VMStackWalker.Tpo" -c -o libnative_la-gnu_classpath_VMStackWalker.lo `test -f 'gnu_classpath_VMStackWalker.c' || echo '$(srcdir)/'`gnu_classpath_VMStackWalker.c; \
+ at am__fastdepCC_TRUE@	then mv -f "$(DEPDIR)/libnative_la-gnu_classpath_VMStackWalker.Tpo" "$(DEPDIR)/libnative_la-gnu_classpath_VMStackWalker.Plo"; else rm -f "$(DEPDIR)/libnative_la-gnu_classpath_VMStackWalker.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='gnu_classpath_VMStackWalker.c' object='libnative_la-gnu_classpath_VMStackWalker.lo' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnative_la_CFLAGS) $(CFLAGS) -c -o libnative_la-gnu_classpath_VMStackWalker.lo `test -f 'gnu_classpath_VMStackWalker.c' || echo '$(srcdir)/'`gnu_classpath_VMStackWalker.c
 
 libnative_la-gnu_classpath_VMSystemProperties.lo: gnu_classpath_VMSystemProperties.c
 @am__fastdepCC_TRUE@	if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnative_la_CFLAGS) $(CFLAGS) -MT libnative_la-gnu_classpath_VMSystemProperties.lo -MD -MP -MF "$(DEPDIR)/libnative_la-gnu_classpath_VMSystemProperties.Tpo" -c -o libnative_la-gnu_classpath_VMSystemProperties.lo `test -f 'gnu_classpath_VMSystemProperties.c' || echo '$(srcdir)/'`gnu_classpath_VMSystemProperties.c; \
===================================================================
Checking out kaffe/libraries/clib/native/gnu_classpath_VMStackWalker.c
RCS:  /home/cvs/kaffe/kaffe/libraries/clib/native/gnu_classpath_VMStackWalker.c,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/clib/native/gnu_classpath_VMStackWalker.c	Sun May 15 16:55:35 2005
@@ -0,0 +1,19 @@
+/*
+ * gnu_classpath_VMStackWalker.c
+ *
+ * Copyright (c) 2005
+ *      Kaffe.org contributors.  All rights reserved.
+ *
+ * See the file "license.terms" for information on usage and redistribution
+ * of this file.
+ */
+
+#include "gnu_classpath_VMStackWalker.h"
+#include "kaffe_lang_ThreadStack.h"
+
+JNIEXPORT jobjectArray JNICALL 
+Java_gnu_classpath_VMStackWalker_getClassContext(JNIEnv* env UNUSED, jclass clazz UNUSED)
+{
+	return kaffe_lang_ThreadStack_getClassStack();
+}
+
Index: kaffe/libraries/javalib/Makefile.am
diff -u kaffe/libraries/javalib/Makefile.am:1.347 kaffe/libraries/javalib/Makefile.am:1.348
--- kaffe/libraries/javalib/Makefile.am:1.347	Wed May  4 00:53:32 2005
+++ kaffe/libraries/javalib/Makefile.am	Sun May 15 16:50:01 2005
@@ -410,6 +410,7 @@
 	gnu/classpath/ServiceFactory.java \
 	gnu/classpath/ServiceProviderLoadingAction.java \
 	gnu/classpath/SystemProperties.java \
+	gnu/classpath/VMStackWalker.java \
 	gnu/classpath/VMSystemProperties.java
 gnu_classpath_tools_SRCS = \
 	gnu/classpath/tools/Util.java
Index: kaffe/libraries/javalib/Makefile.in
diff -u kaffe/libraries/javalib/Makefile.in:1.437 kaffe/libraries/javalib/Makefile.in:1.438
--- kaffe/libraries/javalib/Makefile.in:1.437	Sat May 14 21:47:05 2005
+++ kaffe/libraries/javalib/Makefile.in	Sun May 15 16:50:02 2005
@@ -769,6 +769,7 @@
 	gnu/classpath/ServiceFactory.java \
 	gnu/classpath/ServiceProviderLoadingAction.java \
 	gnu/classpath/SystemProperties.java \
+	gnu/classpath/VMStackWalker.java \
 	gnu/classpath/VMSystemProperties.java
 
 gnu_classpath_tools_SRCS = \
Index: kaffe/libraries/javalib/all.files
diff -u kaffe/libraries/javalib/all.files:1.121 kaffe/libraries/javalib/all.files:1.122
--- kaffe/libraries/javalib/all.files:1.121	Wed May  4 00:53:34 2005
+++ kaffe/libraries/javalib/all.files	Sun May 15 16:50:05 2005
@@ -75,6 +75,7 @@
 gnu/classpath/tools/rmi/rmic/TabbedWriter.java
 gnu/classpath/tools/serialver/SerialVer.java
 gnu/classpath/tools/Util.java
+gnu/classpath/VMStackWalker.java
 gnu/classpath/VMSystemProperties.java
 gnu/CORBA/primitiveArrayTypeCode.java
 gnu/CORBA/primitiveTypeCode.java
===================================================================
Checking out kaffe/libraries/javalib/gnu/classpath/VMStackWalker.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/gnu/classpath/VMStackWalker.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/gnu/classpath/VMStackWalker.java	Sun May 15 16:55:36 2005
@@ -0,0 +1,108 @@
+/* VMStackWalker.java -- Reference implementation of VM hooks for stack access
+   Copyright (C) 2005 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath;
+
+/**
+ * This class provides access to the classes on the Java stack
+ * for reflection and security purposes.
+ *
+ * <p>
+ * This class is only available to privileged code (i.e., code loaded
+ * by the bootstrap loader).
+ *
+ * @author John Keiser
+ * @author Eric Blake <ebb9 at email.byu.edu>
+ * @author Archie Cobbs
+ */
+public final class VMStackWalker
+{
+  /**
+   * Get a list of all the classes currently executing methods on the
+   * Java stack. <code>getClassContext()[0]</code> is the class associated
+   * with the currently executing method, i.e., the method that called
+   * <code>VMStackWalker.getClassContext()</code> (possibly through
+   * reflection). So you may need to pop off these stack frames from
+   * the top of the stack:
+   * <ul>
+   * <li><code>VMStackWalker.getClassContext()</code>
+   * <li><code>Method.invoke()</code>
+   * </ul>
+   *
+   * @return an array of the declaring classes of each stack frame
+   */
+  public static native Class[] getClassContext();
+
+  /**
+   * 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). This method
+   * is an optimization for the expression <code>getClassContext()[1]</code>
+   * and should return the same result.
+   *
+   * <p>
+   * VM implementers are encouraged to provide a more efficient
+   * version of this method.
+   */
+  public static Class getCallingClass()
+  {
+    Class[] ctx = getClassContext();
+    if (ctx.length < 3)
+      return null;
+    return ctx[2];
+  }
+
+  /**
+   * 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. This method is an optimization
+   * for the expression <code>getClassContext()[1].getClassLoader()</code>
+   * and should return the same result.
+   *
+   * <p>
+   * VM implementers are encouraged to provide a more efficient
+   * version of this method.
+   */
+  public static ClassLoader getCallingClassLoader()
+  {
+    Class[] ctx = getClassContext();
+    if (ctx.length < 3)
+      return null;
+    return ctx[2].getClassLoader();
+  }
+}
+
Index: kaffe/libraries/javalib/java/io/ObjectInputStream.java
diff -u kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.52 kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.53
--- kaffe/libraries/javalib/java/io/ObjectInputStream.java:1.52	Fri Apr 22 22:29:48 2005
+++ kaffe/libraries/javalib/java/io/ObjectInputStream.java	Sun May 15 16:50:06 2005
@@ -783,20 +783,12 @@
   }
 
   /**
-   * This method invokes the method currentClassLoader for the
-   * current security manager (or build an empty one if it is not
-   * present).
-   *
-   * @return The most recent non-system ClassLoader on the execution stack.
-   * @see java.lang.SecurityManager#currentClassLoader()
+   * Returns he most recent user defined ClassLoader on the execution stack
+   * or null of none is found.
    */
   private ClassLoader currentLoader()
   {
-    SecurityManager sm = System.getSecurityManager();
-    if (sm == null)
-      sm = new SecurityManager () {};
-    
-    return VMObjectInputStream.currentClassLoader(sm);
+    return VMObjectInputStream.currentClassLoader();
   }
 
   /**
@@ -883,12 +875,7 @@
   protected Class resolveProxyClass(String[] intfs)
     throws IOException, ClassNotFoundException
   {
-    SecurityManager sm = System.getSecurityManager();
-    
-    if (sm == null)
-      sm = new SecurityManager() {};
-    
-    ClassLoader cl = VMObjectInputStream.currentClassLoader(sm);
+    ClassLoader cl = currentLoader();
     
     Class[] clss = new Class[intfs.length];
     if(cl == null)
Index: kaffe/libraries/javalib/java/io/VMObjectInputStream.java
diff -u kaffe/libraries/javalib/java/io/VMObjectInputStream.java:1.1 kaffe/libraries/javalib/java/io/VMObjectInputStream.java:1.2
--- kaffe/libraries/javalib/java/io/VMObjectInputStream.java:1.1	Fri Apr 22 22:29:50 2005
+++ kaffe/libraries/javalib/java/io/VMObjectInputStream.java	Sun May 15 16:50:06 2005
@@ -39,27 +39,48 @@
 
 package java.io;
 
-import gnu.classpath.Configuration;
-import gnu.java.io.ObjectIdentityWrapper;
-
-import java.lang.reflect.Array;
+import gnu.classpath.VMStackWalker;
 import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.lang.reflect.Proxy;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
-import java.util.Arrays;
-import java.util.Hashtable;
-import java.util.Vector;
 
 final class VMObjectInputStream
 {
-  static native ClassLoader currentClassLoader(SecurityManager sm);
+  private static Class oisClass = ObjectInputStream.class;
+  private static Class vmoisClass = VMObjectInputStream.class;
+
+  // PrivilegedAction needed for Class.getClassLoader()
+  private static PrivilegedAction loaderAction = new PrivilegedAction()
+    {
+      public Object run()
+      {
+	Class[] ctx = VMStackWalker.getClassContext();
+	for (int i = 0; i < ctx.length; i++)
+	  {
+	    ClassLoader cl = ctx[i].getClassLoader();
+	    if (cl != null)
+	      return cl;
+	  }
+	return null;
+      }
+    };
 
-  static native Object allocateObject(Class clazz, Class constr_clazz, Constructor constructor)
+  /**
+   * Returns the first user defined class loader on the call stack, or
+   * null when no non-null class loader was found.
+   */
+  static ClassLoader currentClassLoader()
+  {
+    return (ClassLoader) AccessController.doPrivileged(loaderAction);
+  }
+
+  /**
+   * Allocates a new Object of type clazz but without running the
+   * default constructor on it. It then calls the given constructor on
+   * it. The given constructor method comes from the constr_clazz
+   * which is a super class of the given clazz.
+   */
+  static native Object allocateObject(Class clazz, Class constr_clazz,
+				      Constructor constructor)
     throws InstantiationException;
 }
-




More information about the kaffe mailing list