Commit aa893047 by Tom Tromey Committed by Tom Tromey

Makefile.in: Rebuilt.

	* Makefile.in: Rebuilt.
	* Makefile.am (AM_CXXFLAGS): Define TOOLEXECLIBDIR.
	(libgcj0_convenience_la_SOURCES): Don't include
	gnu_xml_source_files.
	(libgcj0_convenience_la_LIBADD): New variable.
	(libgcj_la_LIBADD): Don't include sax or w3c_dom.
	(all_java_source_files): javax_imageio_source_files,
	javax_xml_source_files, and gnu_java_beans_source_files.
	($(gnu_xml_source_files:.java=.lo)): Removed target.
	(gnu-xml.lo): New target.
	(javax-imageio.lo): Likewise.
	(javax-xml.lo): Likewise.
	(gnu-java-beans.lo): Likewise.
	(gnu_java_beans_source_files): New variable.
	(javax_imageio_source_files): Likewise.
	(javax_xml_source_files): Likewise.
	(javax_source_files): Moved files to other variable.
	(awt_java_source_files): Likewise.
	(ordinary_java_source_files): Added BootClassLoader.java.
	* java/lang/natVMClassLoader.cc (defineClass): Use boot loader,
	not system class loader.
	(initBootLoader): New method.
	(loadClass): Search bootLoader.
	* java/lang/natClassLoader.cc (_Jv_RegisterInitiatingLoader): Use
	boot loader, not system class loader.
	(_Jv_UnregisterInitiatingLoader): Likewise.
	(_Jv_FindClass): Likewise.  Ensure entries in
	bootstrap_class_list are unique.
	* java/lang/natClass.cc (getClassLoader): Don't special case
	system class loader.
	* java/lang/VMClassLoader.java (bootLoader): New field.
	(getResource): Use bootLoader.
	(getResources): Likewise.
	(initBootLoader): Declare.
	* gnu/gcj/runtime/BootClassLoader.java: New file.
	* external/sax/org/xml/sax/helpers/NamespaceSupport.java
	(EMPTY_ENUMERATION): Now package-private.
	* external/w3c_com/Makefile.in: Rebuilt.
	* external/w3c_com/Makefile.am (MULTIBUILDTOP): New variable.
	(w3c.jar): New target.
	(classes.stamp): Updated.
	(toolexeclib_LTLIBRARIES): Renamed from noinst_LTLIBRARIES.
	Changed name of library.
	(libw3c_gcj_la_SOURCES): New variable.
	(libw3c_gcj_la_GCJFLAGS): Likewise.
	(source_files): Renamed from lib3c_convenience_la_SOURCES.
	* external/sax/Makefile.in: Rebuilt.
	* external/sax/Makefile.am (MULTIBUILDTOP): New variable.
	(sax.jar): New target.
	(classes.stamp): Updated.
	(toolexeclib_LTLIBRARIES): Renamed from noinst_LTLIBRARIES.
	Changed name of library.
	(libsax_gcj_la_SOURCES): New variable.
	(libsax_gcj_la_GCJFLAGS): Likewise.
	(source_files): Renamed from libsax_convenience_la_SOURCES.
	* stacktrace.cc (non_system_trace_fn): Don't look at system class
	loader.
	* prims.cc (_Jv_CreateJavaVM): Initialize the bootstrap class
	loader.
	(_Jv_RunMain): Handle case where 'runtime' is NULL at exit.

From-SVN: r96960
parent 85624ffd
2005-03-23 Tom Tromey <tromey@redhat.com>
* Makefile.in: Rebuilt.
* Makefile.am (AM_CXXFLAGS): Define TOOLEXECLIBDIR.
(libgcj0_convenience_la_SOURCES): Don't include
gnu_xml_source_files.
(libgcj0_convenience_la_LIBADD): New variable.
(libgcj_la_LIBADD): Don't include sax or w3c_dom.
(all_java_source_files): javax_imageio_source_files,
javax_xml_source_files, and gnu_java_beans_source_files.
($(gnu_xml_source_files:.java=.lo)): Removed target.
(gnu-xml.lo): New target.
(javax-imageio.lo): Likewise.
(javax-xml.lo): Likewise.
(gnu-java-beans.lo): Likewise.
(gnu_java_beans_source_files): New variable.
(javax_imageio_source_files): Likewise.
(javax_xml_source_files): Likewise.
(javax_source_files): Moved files to other variable.
(awt_java_source_files): Likewise.
(ordinary_java_source_files): Added BootClassLoader.java.
* java/lang/natVMClassLoader.cc (defineClass): Use boot loader,
not system class loader.
(initBootLoader): New method.
(loadClass): Search bootLoader.
* java/lang/natClassLoader.cc (_Jv_RegisterInitiatingLoader): Use
boot loader, not system class loader.
(_Jv_UnregisterInitiatingLoader): Likewise.
(_Jv_FindClass): Likewise. Ensure entries in
bootstrap_class_list are unique.
* java/lang/natClass.cc (getClassLoader): Don't special case
system class loader.
* java/lang/VMClassLoader.java (bootLoader): New field.
(getResource): Use bootLoader.
(getResources): Likewise.
(initBootLoader): Declare.
* gnu/gcj/runtime/BootClassLoader.java: New file.
* external/sax/org/xml/sax/helpers/NamespaceSupport.java
(EMPTY_ENUMERATION): Now package-private.
* external/w3c_com/Makefile.in: Rebuilt.
* external/w3c_com/Makefile.am (MULTIBUILDTOP): New variable.
(w3c.jar): New target.
(classes.stamp): Updated.
(toolexeclib_LTLIBRARIES): Renamed from noinst_LTLIBRARIES.
Changed name of library.
(libw3c_gcj_la_SOURCES): New variable.
(libw3c_gcj_la_GCJFLAGS): Likewise.
(source_files): Renamed from lib3c_convenience_la_SOURCES.
* external/sax/Makefile.in: Rebuilt.
* external/sax/Makefile.am (MULTIBUILDTOP): New variable.
(sax.jar): New target.
(classes.stamp): Updated.
(toolexeclib_LTLIBRARIES): Renamed from noinst_LTLIBRARIES.
Changed name of library.
(libsax_gcj_la_SOURCES): New variable.
(libsax_gcj_la_GCJFLAGS): Likewise.
(source_files): Renamed from libsax_convenience_la_SOURCES.
* stacktrace.cc (non_system_trace_fn): Don't look at system class
loader.
* prims.cc (_Jv_CreateJavaVM): Initialize the bootstrap class
loader.
(_Jv_RunMain): Handle case where 'runtime' is NULL at exit.
2005-03-23 Sven de Marothy <sven@physto.se> 2005-03-23 Sven de Marothy <sven@physto.se>
PR libgcj/2641, PR libgcj/9854, PR libgcj/14892, PR libgcj/18083, PR libgcj/2641, PR libgcj/9854, PR libgcj/14892, PR libgcj/18083,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
# Makefile.in generated by automake 1.9.5 from Makefile.am. # Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc. # 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
...@@ -382,13 +382,7 @@ uninstall-info-am: ...@@ -382,13 +382,7 @@ uninstall-info-am:
# (which will cause the Makefiles to be regenerated when you run `make'); # (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line. # (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS): $(RECURSIVE_TARGETS):
@failcom='exit 1'; \ @set fnord $$MAKEFLAGS; amf=$$2; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \ dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \ target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \ list='$(SUBDIRS)'; for subdir in $$list; do \
...@@ -400,7 +394,7 @@ $(RECURSIVE_TARGETS): ...@@ -400,7 +394,7 @@ $(RECURSIVE_TARGETS):
local_target="$$target"; \ local_target="$$target"; \
fi; \ fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \ done; \
if test "$$dot_seen" = "no"; then \ if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
...@@ -408,13 +402,7 @@ $(RECURSIVE_TARGETS): ...@@ -408,13 +402,7 @@ $(RECURSIVE_TARGETS):
mostlyclean-recursive clean-recursive distclean-recursive \ mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive: maintainer-clean-recursive:
@failcom='exit 1'; \ @set fnord $$MAKEFLAGS; amf=$$2; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \ dot_seen=no; \
case "$@" in \ case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
...@@ -435,7 +423,7 @@ maintainer-clean-recursive: ...@@ -435,7 +423,7 @@ maintainer-clean-recursive:
local_target="$$target"; \ local_target="$$target"; \
fi; \ fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail" done && test -z "$$fail"
tags-recursive: tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \ list='$(SUBDIRS)'; for subdir in $$list; do \
......
...@@ -5,6 +5,9 @@ AUTOMAKE_OPTIONS = foreign subdir-objects ...@@ -5,6 +5,9 @@ AUTOMAKE_OPTIONS = foreign subdir-objects
# May be used by various substitution variables. # May be used by various substitution variables.
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
## Needed because $(ZIP) is a relative path.
MULTIBUILDTOP = ../../
## The compiler with whatever flags we want for both -c and -C ## The compiler with whatever flags we want for both -c and -C
## compiles. ## compiles.
GCJ_WITH_FLAGS = $(GCJ) --encoding=UTF-8 -Wno-deprecated -fbootclasspath=$(BOOTCLASSPATH) GCJ_WITH_FLAGS = $(GCJ) --encoding=UTF-8 -Wno-deprecated -fbootclasspath=$(BOOTCLASSPATH)
...@@ -20,18 +23,24 @@ AM_GCJFLAGS = \ ...@@ -20,18 +23,24 @@ AM_GCJFLAGS = \
BUILT_SOURCES = classes.stamp BUILT_SOURCES = classes.stamp
classes.stamp: $(libsax_convenience_la_SOURCES) sax.jar: classes.stamp
find org -name '*.class' -print | $(ZIP) -cfME@ $@
classes.stamp: $(source_files)
here=`pwd`; cd $(srcdir); \ here=`pwd`; cd $(srcdir); \
$(GCJ_WITH_FLAGS) -C -d $$here $(libsax_convenience_la_SOURCES) $(GCJ_WITH_FLAGS) -C -d $$here $(source_files)
echo > classes.stamp echo > classes.stamp
mostlyclean-local: mostlyclean-local:
-find . -name '*.class' | xargs rm -find . -name '*.class' | xargs rm
-rm classes.stamp -rm classes.stamp sax.jar
toolexeclib_LTLIBRARIES = libsax-gcj.la
noinst_LTLIBRARIES = libsax_convenience.la libsax_gcj_la_SOURCES = sax.jar
libsax_gcj_la_GCJFLAGS = -findirect-dispatch
libsax_convenience_la_SOURCES = \ source_files = \
org/xml/sax/SAXNotSupportedException.java \ org/xml/sax/SAXNotSupportedException.java \
org/xml/sax/helpers/NamespaceSupport.java \ org/xml/sax/helpers/NamespaceSupport.java \
org/xml/sax/helpers/AttributesImpl.java \ org/xml/sax/helpers/AttributesImpl.java \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// http://www.saxproject.org // http://www.saxproject.org
// Written by David Megginson // Written by David Megginson
// This class is in the Public Domain. NO WARRANTY! // This class is in the Public Domain. NO WARRANTY!
// $Id: NamespaceSupport.java,v 1.1 2004/12/23 22:38:42 mark Exp $ // $Id: NamespaceSupport.java,v 1.1 2005/02/02 00:41:54 tromey Exp $
package org.xml.sax.helpers; package org.xml.sax.helpers;
...@@ -113,7 +113,8 @@ public class NamespaceSupport ...@@ -113,7 +113,8 @@ public class NamespaceSupport
/** /**
* An empty enumeration. * An empty enumeration.
*/ */
private final static Enumeration EMPTY_ENUMERATION = // GCJ LOCAL: work around gcj bug by making this package-private
final static Enumeration EMPTY_ENUMERATION =
new Vector().elements(); new Vector().elements();
......
...@@ -5,6 +5,9 @@ AUTOMAKE_OPTIONS = foreign subdir-objects ...@@ -5,6 +5,9 @@ AUTOMAKE_OPTIONS = foreign subdir-objects
# May be used by various substitution variables. # May be used by various substitution variables.
gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER) gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
## Needed because $(ZIP) is a relative path.
MULTIBUILDTOP = ../../
## The compiler with whatever flags we want for both -c and -C ## The compiler with whatever flags we want for both -c and -C
## compiles. ## compiles.
GCJ_WITH_FLAGS = $(GCJ) --encoding=UTF-8 -Wno-deprecated -fbootclasspath=$(BOOTCLASSPATH) GCJ_WITH_FLAGS = $(GCJ) --encoding=UTF-8 -Wno-deprecated -fbootclasspath=$(BOOTCLASSPATH)
...@@ -20,18 +23,24 @@ AM_GCJFLAGS = \ ...@@ -20,18 +23,24 @@ AM_GCJFLAGS = \
BUILT_SOURCES = classes.stamp BUILT_SOURCES = classes.stamp
classes.stamp: $(libw3c_convenience_la_SOURCES) w3c.jar: classes.stamp
find org -name '*.class' -print | $(ZIP) -cfME@ $@
classes.stamp: $(source_files)
here=`pwd`; cd $(srcdir); \ here=`pwd`; cd $(srcdir); \
$(GCJ_WITH_FLAGS) -C -d $$here $(libw3c_convenience_la_SOURCES) $(GCJ_WITH_FLAGS) -C -d $$here $(source_files)
echo > classes.stamp echo > classes.stamp
mostlyclean-local: mostlyclean-local:
-find . -name '*.class' | xargs rm -find . -name '*.class' | xargs rm
-rm classes.stamp -rm classes.stamp w3c.jar
toolexeclib_LTLIBRARIES = libw3c-gcj.la
noinst_LTLIBRARIES = libw3c_convenience.la libw3c_gcj_la_SOURCES = w3c.jar
libw3c_gcj_la_GCJFLAGS = -findirect-dispatch
libw3c_convenience_la_SOURCES = \ source_files = \
org/w3c/dom/xpath/XPathNamespace.java \ org/w3c/dom/xpath/XPathNamespace.java \
org/w3c/dom/xpath/XPathResult.java \ org/w3c/dom/xpath/XPathResult.java \
org/w3c/dom/xpath/XPathException.java \ org/w3c/dom/xpath/XPathException.java \
......
# Makefile.in generated by automake 1.9.5 from Makefile.am. # Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc. # 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
......
/* Copyright (C) 2005 Free Software Foundation
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
package gnu.gcj.runtime;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.StringTokenizer;
/**
* This is a helper for the bootstrap class loader. It is a
* URLClassLoader so that we can read a class path and re-use all the
* existing code for finding classes, extracting them from jars, etc.
* However, it is never called the way that an ordinary ClassLoader is
* called. For instance, loadClass() is never used.
*/
public final class BootClassLoader extends URLClassLoader
{
BootClassLoader(String libdir)
{
super(new URL[0]);
// Add the contents of the endorsed directories.
StringTokenizer st
= new StringTokenizer (System.getProperty ("java.endorsed.dirs", ""),
File.pathSeparator);
try
{
while (st.hasMoreElements ())
{
String dirname = st.nextToken ();
File dir = new File (dirname);
if (dir.exists ())
{
if (! dirname.endsWith (File.separator))
dirname = dirname + File.separator;
String files[] = dir.list (new FilenameFilter ()
{
public boolean accept (File dir, String name)
{
return name.endsWith (".jar") || name.endsWith (".zip");
}
});
for (int i = files.length - 1; i >= 0; i--)
addURL(new URL("file", "", -1, dirname + files[i]));
}
}
String w3clib = (libdir + File.separator
+ System.mapLibraryName ("w3c-gcj"));
addURL(new URL("gcjlib", "", -1, w3clib));
String saxlib = (libdir + File.separator
+ System.mapLibraryName ("sax-gcj"));
addURL(new URL("gcjlib", "", -1, saxlib));
}
catch (java.net.MalformedURLException x)
{
// This should never happen.
throw new RuntimeException(x);
}
}
public Class bootLoadClass(String name)
throws ClassNotFoundException
{
Class c = findLoadedClass(name);
if (c == null)
{
try
{
// We could hack URLClassLoader to make this more
// efficient, if it mattered.
c = findClass(name);
}
catch (ClassNotFoundException _)
{
c = null;
}
}
return c;
}
public URL bootGetResource(String name)
{
return findResource(name);
}
public Enumeration bootGetResources(String name) throws IOException
{
return findResources(name);
}
}
...@@ -60,137 +60,172 @@ import javax.xml.parsers.SAXParserFactory; ...@@ -60,137 +60,172 @@ import javax.xml.parsers.SAXParserFactory;
* *
* @author David Brownell * @author David Brownell
*/ */
public final class JAXPFactory extends SAXParserFactory public final class JAXPFactory
extends SAXParserFactory
{ {
private Hashtable flags = new Hashtable ();
private Hashtable flags = new Hashtable();
/**
* Constructs a factory which normally returns a non-validating /**
* parser. * Constructs a factory which normally returns a non-validating
*/ * parser.
public JAXPFactory () { } */
public JAXPFactory()
public SAXParser newSAXParser () {
}
public SAXParser newSAXParser()
throws ParserConfigurationException, SAXException throws ParserConfigurationException, SAXException
{
JaxpParser jaxp = new JaxpParser();
Enumeration e = flags.keys();
XMLReader parser = jaxp.getXMLReader();
parser.setFeature(SAXDriver.FEATURE + "namespaces",
isNamespaceAware());
parser.setFeature(SAXDriver.FEATURE + "validation",
isValidating());
// that makes SAX2 feature flags trump JAXP
while (e.hasMoreElements())
{
String uri = (String) e.nextElement();
Boolean value = (Boolean) flags.get(uri);
parser.setFeature(uri, value.booleanValue());
}
return jaxp;
}
// yes, this "feature transfer" mechanism doesn't play well
public void setFeature(String name, boolean value)
throws ParserConfigurationException, SAXNotRecognizedException,
SAXNotSupportedException
{
try
{
// force "early" detection of errors where possible
// (flags can't necessarily be set before parsing)
new JaxpParser().getXMLReader().setFeature(name, value);
flags.put(name, new Boolean(value));
}
catch (SAXNotRecognizedException e)
{
throw new SAXNotRecognizedException(name);
}
catch (SAXNotSupportedException e)
{
throw new SAXNotSupportedException(name);
}
catch (Exception e)
{
throw new ParserConfigurationException(e.getClass().getName()
+ ": "
+ e.getMessage());
}
}
public boolean getFeature(String name)
throws ParserConfigurationException, SAXNotRecognizedException,
SAXNotSupportedException
{
Boolean value = (Boolean) flags.get(name);
if (value != null)
{
return value.booleanValue();
}
else
{
try
{
return new JaxpParser().getXMLReader().getFeature(name);
}
catch (SAXNotRecognizedException e)
{
throw new SAXNotRecognizedException(name);
}
catch (SAXNotSupportedException e)
{
throw new SAXNotSupportedException(name);
}
catch (SAXException e)
{
throw new ParserConfigurationException(e.getClass().getName()
+ ": "
+ e.getMessage());
}
}
}
private static class JaxpParser
extends SAXParser
{
private XmlReader ae2 = new XmlReader();
private XMLReaderAdapter parser = null;
JaxpParser()
{ {
JaxpParser jaxp = new JaxpParser ();
Enumeration e = flags.keys ();
XMLReader parser = jaxp.getXMLReader ();
parser.setFeature (
SAXDriver.FEATURE + "namespaces",
isNamespaceAware ());
parser.setFeature (
SAXDriver.FEATURE + "validation",
isValidating ());
// that makes SAX2 feature flags trump JAXP
while (e.hasMoreElements ()) {
String uri = (String) e.nextElement ();
Boolean value = (Boolean) flags.get (uri);
parser.setFeature (uri, value.booleanValue ());
}
return jaxp;
} }
// yes, this "feature transfer" mechanism doesn't play well public void setProperty(String id, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException
{
ae2.setProperty(id, value);
}
public void setFeature (String name, boolean value) public Object getProperty(String id)
throws throws SAXNotRecognizedException, SAXNotSupportedException
ParserConfigurationException,
SAXNotRecognizedException,
SAXNotSupportedException
{ {
try { return ae2.getProperty(id);
// force "early" detection of errors where possible
// (flags can't necessarily be set before parsing)
new JaxpParser ().getXMLReader ().setFeature (name, value);
flags.put (name, new Boolean (value));
} catch (SAXNotRecognizedException e) {
throw new SAXNotRecognizedException (name);
} catch (SAXNotSupportedException e) {
throw new SAXNotSupportedException (name);
} catch (Exception e) {
throw new ParserConfigurationException (
e.getClass ().getName ()
+ ": "
+ e.getMessage ());
}
} }
public boolean getFeature (String name) public Parser getParser()
throws throws SAXException
ParserConfigurationException,
SAXNotRecognizedException,
SAXNotSupportedException
{ {
Boolean value = (Boolean) flags.get (name); if (parser == null)
{
if (value != null) parser = new XMLReaderAdapter(ae2);
return value.booleanValue (); }
else return parser;
try {
return new JaxpParser ().getXMLReader ().getFeature (name);
} catch (SAXNotRecognizedException e) {
throw new SAXNotRecognizedException (name);
} catch (SAXNotSupportedException e) {
throw new SAXNotSupportedException (name);
} catch (SAXException e) {
throw new ParserConfigurationException (
e.getClass ().getName ()
+ ": "
+ e.getMessage ());
}
} }
private static class JaxpParser extends SAXParser public XMLReader getXMLReader ()
throws SAXException
{ {
private XmlReader ae2 = new XmlReader (); return ae2;
private XMLReaderAdapter parser = null;
JaxpParser () { }
public void setProperty (String id, Object value)
throws SAXNotRecognizedException, SAXNotSupportedException
{ ae2.setProperty (id, value); }
public Object getProperty (String id)
throws SAXNotRecognizedException, SAXNotSupportedException
{ return ae2.getProperty (id); }
public Parser getParser ()
throws SAXException
{
if (parser == null)
parser = new XMLReaderAdapter (ae2);
return parser;
}
public XMLReader getXMLReader ()
throws SAXException
{ return ae2; }
public boolean isNamespaceAware ()
{
try {
return ae2.getFeature (SAXDriver.FEATURE + "namespaces");
} catch (Exception e) {
throw new Error ();
}
}
public boolean isValidating ()
{
try {
return ae2.getFeature (SAXDriver.FEATURE + "validation");
} catch (Exception e) {
throw new Error ();
}
}
// TODO isXIncludeAware()
} }
public boolean isNamespaceAware()
{
try
{
return ae2.getFeature(SAXDriver.FEATURE + "namespaces");
}
catch (Exception e)
{
throw new Error();
}
}
public boolean isValidating()
{
try
{
return ae2.getFeature(SAXDriver.FEATURE + "validation");
}
catch (Exception e)
{
throw new Error();
}
}
// TODO isXIncludeAware()
}
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
# Makefile.in generated by automake 1.9.5 from Makefile.am. # Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc. # 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
......
...@@ -53,6 +53,7 @@ import java.util.Enumeration; ...@@ -53,6 +53,7 @@ import java.util.Enumeration;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import gnu.gcj.runtime.BootClassLoader;
/** /**
* java.lang.VMClassLoader is a package-private helper for VMs to implement * java.lang.VMClassLoader is a package-private helper for VMs to implement
...@@ -82,6 +83,10 @@ final class VMClassLoader ...@@ -82,6 +83,10 @@ final class VMClassLoader
static final HashMap definedPackages = new HashMap(); static final HashMap definedPackages = new HashMap();
// This is a helper for handling java.endorsed.dirs. It is null
// until we've initialized the system, at which point it is created.
static BootClassLoader bootLoader;
/** /**
* Helper to define a class using a string of bytes. This assumes that * Helper to define a class using a string of bytes. This assumes that
* the security checks have already been performed, if necessary. * the security checks have already been performed, if necessary.
...@@ -153,6 +158,8 @@ final class VMClassLoader ...@@ -153,6 +158,8 @@ final class VMClassLoader
*/ */
static URL getResource(String name) static URL getResource(String name)
{ {
if (bootLoader != null)
return bootLoader.bootGetResource(name);
return null; return null;
} }
...@@ -168,6 +175,8 @@ final class VMClassLoader ...@@ -168,6 +175,8 @@ final class VMClassLoader
*/ */
static Enumeration getResources(String name) throws IOException static Enumeration getResources(String name) throws IOException
{ {
if (bootLoader != null)
return bootLoader.bootGetResources(name);
return EmptyEnumeration.getInstance(); return EmptyEnumeration.getInstance();
} }
...@@ -287,6 +296,8 @@ final class VMClassLoader ...@@ -287,6 +296,8 @@ final class VMClassLoader
static native ClassLoader getSystemClassLoaderInternal(); static native ClassLoader getSystemClassLoaderInternal();
static native void initBootLoader(String libdir);
static ClassLoader getSystemClassLoader() static ClassLoader getSystemClassLoader()
{ {
// This method is called as the initialization of systemClassLoader, // This method is called as the initialization of systemClassLoader,
...@@ -310,6 +321,7 @@ final class VMClassLoader ...@@ -310,6 +321,7 @@ final class VMClassLoader
+ loader, ex); + loader, ex);
} }
} }
return default_sys; return default_sys;
} }
} }
...@@ -126,16 +126,16 @@ java::lang::Class::getClassLoader (void) ...@@ -126,16 +126,16 @@ java::lang::Class::getClassLoader (void)
s->checkPermission (new RuntimePermission (JvNewStringLatin1 ("getClassLoader"))); s->checkPermission (new RuntimePermission (JvNewStringLatin1 ("getClassLoader")));
} }
// The spec requires us to return `null' for primitive classes. In // This particular 'return' has been changed a couple of times over
// other cases we have the option of returning `null' for classes // libgcj's history. This particular approach is a little weird,
// loaded with the bootstrap loader. All gcj-compiled classes which // because it means that all classes linked into the application
// are linked into the application used to return `null' here, but // will see NULL for their class loader. This may confuse some
// that confuses some poorly-written applications. It is a useful // applications that aren't expecting this; the solution is to use a
// and apparently harmless compatibility hack to simply never return // different linking model for these applications. In the past we
// `null' instead. // returned the system class loader in this case, but that is
if (isPrimitive ()) // incorrect. Also, back then we didn't have other linkage models
return NULL; // to fall back on.
return loader ? loader : ClassLoader::systemClassLoader; return loader;
} }
java::lang::reflect::Constructor * java::lang::reflect::Constructor *
......
...@@ -43,6 +43,7 @@ details. */ ...@@ -43,6 +43,7 @@ details. */
#include <java/io/Serializable.h> #include <java/io/Serializable.h>
#include <java/lang/Cloneable.h> #include <java/lang/Cloneable.h>
#include <java/util/HashMap.h> #include <java/util/HashMap.h>
#include <gnu/gcj/runtime/BootClassLoader.h>
// Size of local hash table. // Size of local hash table.
#define HASH_LEN 1013 #define HASH_LEN 1013
...@@ -106,7 +107,7 @@ void ...@@ -106,7 +107,7 @@ void
_Jv_RegisterInitiatingLoader (jclass klass, java::lang::ClassLoader *loader) _Jv_RegisterInitiatingLoader (jclass klass, java::lang::ClassLoader *loader)
{ {
if (! loader) if (! loader)
loader = java::lang::ClassLoader::systemClassLoader; loader = java::lang::VMClassLoader::bootLoader;
loader->loadedClasses->put(klass->name->toString(), klass); loader->loadedClasses->put(klass->name->toString(), klass);
} }
...@@ -116,7 +117,7 @@ void ...@@ -116,7 +117,7 @@ void
_Jv_UnregisterInitiatingLoader (jclass klass, java::lang::ClassLoader *loader) _Jv_UnregisterInitiatingLoader (jclass klass, java::lang::ClassLoader *loader)
{ {
if (! loader) if (! loader)
loader = java::lang::ClassLoader::systemClassLoader; loader = java::lang::VMClassLoader::bootLoader;
loader->loadedClasses->remove(klass->name->toString()); loader->loadedClasses->remove(klass->name->toString());
} }
...@@ -211,13 +212,14 @@ _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader) ...@@ -211,13 +212,14 @@ _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader)
// See if the class was already loaded by this loader. This handles // See if the class was already loaded by this loader. This handles
// initiating loader checks, as we register classes with their // initiating loader checks, as we register classes with their
// initiating loaders. // initiating loaders.
java::lang::ClassLoader *sys = java::lang::ClassLoader::systemClassLoader;
java::lang::ClassLoader *boot = java::lang::VMClassLoader::bootLoader;
java::lang::ClassLoader *real = loader; java::lang::ClassLoader *real = loader;
if (! real) if (! real)
real = sys; real = boot;
jstring sname = name->toString(); jstring sname = name->toString();
// We might still be bootstrapping the VM, in which case there // We might still be bootstrapping the VM, in which case there
// won't be a system class loader yet. // won't be a bootstrap class loader yet.
jclass klass = real ? real->findLoadedClass (sname) : NULL; jclass klass = real ? real->findLoadedClass (sname) : NULL;
if (! klass) if (! klass)
...@@ -230,16 +232,16 @@ _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader) ...@@ -230,16 +232,16 @@ _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader)
// If "loader" delegated the loadClass operation to another // If "loader" delegated the loadClass operation to another
// loader, explicitly register that it is also an initiating // loader, explicitly register that it is also an initiating
// loader of the given class. // loader of the given class.
java::lang::ClassLoader *delegate = (loader == sys java::lang::ClassLoader *delegate = (loader == boot
? NULL ? NULL
: loader); : loader);
if (klass && klass->getClassLoaderInternal () != delegate) if (klass && klass->getClassLoaderInternal () != delegate)
_Jv_RegisterInitiatingLoader (klass, loader); _Jv_RegisterInitiatingLoader (klass, loader);
} }
else if (sys) else if (boot)
{ {
// Load using the bootstrap loader jvmspec 5.3.1. // Load using the bootstrap loader jvmspec 5.3.1.
klass = sys->loadClass (sname, false); klass = java::lang::VMClassLoader::loadClass (sname, false);
// Register that we're an initiating loader. // Register that we're an initiating loader.
if (klass) if (klass)
...@@ -250,9 +252,21 @@ _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader) ...@@ -250,9 +252,21 @@ _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader)
// Not even a bootstrap loader, try the built-in cache. // Not even a bootstrap loader, try the built-in cache.
klass = _Jv_FindClassInCache (name); klass = _Jv_FindClassInCache (name);
if (bootstrap_index == BOOTSTRAP_CLASS_LIST_SIZE) bool found = false;
abort (); for (int i = 0; i < bootstrap_index; ++i)
bootstrap_class_list[bootstrap_index++] = klass; {
if (bootstrap_class_list[i] == klass)
{
found = true;
break;
}
}
if (! found)
{
if (bootstrap_index == BOOTSTRAP_CLASS_LIST_SIZE)
abort ();
bootstrap_class_list[bootstrap_index++] = klass;
}
} }
} }
else else
......
...@@ -25,6 +25,7 @@ details. */ ...@@ -25,6 +25,7 @@ details. */
#include <java/lang/VMCompiler.h> #include <java/lang/VMCompiler.h>
#include <gnu/gcj/runtime/VMClassLoader.h> #include <gnu/gcj/runtime/VMClassLoader.h>
#include <gnu/gcj/runtime/SystemClassLoader.h> #include <gnu/gcj/runtime/SystemClassLoader.h>
#include <gnu/gcj/runtime/BootClassLoader.h>
#include <java/lang/ClassLoader.h> #include <java/lang/ClassLoader.h>
#include <java/lang/Class.h> #include <java/lang/Class.h>
#include <java/lang/Throwable.h> #include <java/lang/Throwable.h>
...@@ -66,9 +67,9 @@ java::lang::VMClassLoader::defineClass (java::lang::ClassLoader *loader, ...@@ -66,9 +67,9 @@ java::lang::VMClassLoader::defineClass (java::lang::ClassLoader *loader,
// until we're done loading. // until we're done loading.
JvSynchronize sync (klass); JvSynchronize sync (klass);
// Record the defining loader. For the system class loader, we // Record the defining loader. For the bootstrap class loader,
// record NULL. // we record NULL.
if (loader != java::lang::ClassLoader::systemClassLoader) if (loader != bootLoader)
klass->loader = loader; klass->loader = loader;
if (name != 0) if (name != 0)
...@@ -122,11 +123,25 @@ java::lang::VMClassLoader::getPrimitiveClass (jchar type) ...@@ -122,11 +123,25 @@ java::lang::VMClassLoader::getPrimitiveClass (jchar type)
return _Jv_FindClassFromSignature (sig, NULL); return _Jv_FindClassFromSignature (sig, NULL);
} }
void
java::lang::VMClassLoader::initBootLoader(jstring libdir)
{
bootLoader = new gnu::gcj::runtime::BootClassLoader(libdir);
}
jclass jclass
java::lang::VMClassLoader::loadClass(jstring name, jboolean resolve) java::lang::VMClassLoader::loadClass(jstring name, jboolean resolve)
{ {
_Jv_Utf8Const *utf = _Jv_makeUtf8Const (name); // We try the boot loader first, so that the endorsed directory
jclass klass = _Jv_FindClassInCache (utf); // overrides compiled-in classes.
jclass klass = NULL;
if (bootLoader)
klass = bootLoader->bootLoadClass(name);
if (! klass)
{
_Jv_Utf8Const *utf = _Jv_makeUtf8Const (name);
klass = _Jv_FindClassInCache (utf);
}
if (klass) if (klass)
{ {
// We never want to return a class without its supers linked. // We never want to return a class without its supers linked.
......
...@@ -55,6 +55,7 @@ details. */ ...@@ -55,6 +55,7 @@ details. */
#include <java/lang/OutOfMemoryError.h> #include <java/lang/OutOfMemoryError.h>
#include <java/lang/System.h> #include <java/lang/System.h>
#include <java/lang/VMThrowable.h> #include <java/lang/VMThrowable.h>
#include <java/lang/VMClassLoader.h>
#include <java/lang/reflect/Modifier.h> #include <java/lang/reflect/Modifier.h>
#include <java/io/PrintStream.h> #include <java/io/PrintStream.h>
#include <java/lang/UnsatisfiedLinkError.h> #include <java/lang/UnsatisfiedLinkError.h>
...@@ -1130,8 +1131,9 @@ _Jv_CreateJavaVM (JvVMInitArgs* vm_args) ...@@ -1130,8 +1131,9 @@ _Jv_CreateJavaVM (JvVMInitArgs* vm_args)
// of VMClassLoader. // of VMClassLoader.
_Jv_InitClass (&java::lang::ClassLoader::class$); _Jv_InitClass (&java::lang::ClassLoader::class$);
// Set up the system class loader. // Set up the system class loader and the bootstrap class loader.
gnu::gcj::runtime::VMClassLoader::initialize(); gnu::gcj::runtime::VMClassLoader::initialize();
java::lang::VMClassLoader::initBootLoader(JvNewStringLatin1(TOOLEXECLIBDIR));
_Jv_RegisterBootstrapPackages(); _Jv_RegisterBootstrapPackages();
...@@ -1209,7 +1211,10 @@ _Jv_RunMain (jclass klass, const char *name, int argc, const char **argv, ...@@ -1209,7 +1211,10 @@ _Jv_RunMain (jclass klass, const char *name, int argc, const char **argv,
java::lang::System::err->println (JvNewStringLatin1 java::lang::System::err->println (JvNewStringLatin1
("Exception during runtime initialization")); ("Exception during runtime initialization"));
t->printStackTrace(); t->printStackTrace();
runtime->exit (1); if (runtime)
runtime->exit (1);
// In case the runtime creation failed.
::exit (1);
} }
_Jv_AttachCurrentThread (main_thread); _Jv_AttachCurrentThread (main_thread);
......
...@@ -495,7 +495,7 @@ _Jv_StackTrace::non_system_trace_fn (_Jv_UnwindState *state) ...@@ -495,7 +495,7 @@ _Jv_StackTrace::non_system_trace_fn (_Jv_UnwindState *state)
{ {
classLoader = frame->klass->getClassLoaderInternal(); classLoader = frame->klass->getClassLoaderInternal();
#ifdef INTERPRETER #ifdef INTERPRETER
if (classLoader != NULL && classLoader != ClassLoader::systemClassLoader) if (classLoader != NULL)
{ {
state->trace_data = (void *) classLoader; state->trace_data = (void *) classLoader;
return _URC_NORMAL_STOP; return _URC_NORMAL_STOP;
......
# Makefile.in generated by automake 1.9.5 from Makefile.am. # Makefile.in generated by automake 1.9.3 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005 Free Software Foundation, Inc. # 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation # This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it, # gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved. # with or without modifications, as long as this notice is preserved.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment