natClassLoader.cc (_Jv_RegisterInitiatingLoader): Check loading constraints.

* java/lang/natClassLoader.cc (_Jv_RegisterInitiatingLoader):
	Check loading constraints.
	(_Jv_CheckOrCreateLoadingConstraint): New function.
	* java/lang/ClassLoader.java (loadingConstraints): New field.
	* link.cc (_Jv_Linker::find_field): Use
	_Jv_CheckOrCreateLoadingConstraint.
	(_Jv_Linker::check_loading_constraints): New function.
	(_Jv_Linker::resolve_method_entry): Use
	check_loading_constraints.
	(_Jv_Linker::append_partial_itable): Likewise.
	(_Jv_Linker::layout_vtable_methods): Likewise.
	* include/jvm.h (_Jv_Linker::check_loading_constraints): Declare.
	(_Jv_CheckOrCreateLoadingConstraint): Declare.

From-SVN: r133172
This commit is contained in:
Tom Tromey 2008-03-13 16:43:54 +00:00 committed by Tom Tromey
parent 5f5f0635f1
commit 2599b56f41
8 changed files with 123 additions and 44 deletions

View file

@ -1,5 +1,5 @@
/* ClassLoader.java -- responsible for loading classes into the VM
Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -45,6 +45,7 @@ import gnu.java.util.EmptyEnumeration;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.WeakReference;
import java.net.URL;
import java.nio.ByteBuffer;
import java.security.CodeSource;
@ -129,6 +130,15 @@ public abstract class ClassLoader
*/
final HashMap loadedClasses = new HashMap();
/**
* Loading constraints registered with this classloader. This maps
* a class name to a weak reference to a class. When the reference
* is non-null, it means that a reference to the name must resolve
* to the indicated class.
*/
final HashMap<String, WeakReference<Class>> loadingConstraints
= new HashMap<String, WeakReference<Class>>();
/**
* All packages defined by this classloader. It is not private in order to
* allow native code (and trusted subclasses) access to this field.