classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Patch: FYI: minor ClassLoader improvement


From: Tom Tromey
Subject: [cp-patches] Patch: FYI: minor ClassLoader improvement
Date: 19 Sep 2004 17:40:27 -0600

I'm checking this in.

Declaring the loadedClasses and definedPackages fields of ClassLoader
as `Map' means that accesses to them are done via invokeinterface.  On
most VMs this is slower than invokevirtual, and additionally I think
there is little harm in declaring these fields using their concrete
type.  So, this patch changes the declarations.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        * java/lang/ClassLoader.java (loadedClasses): Declare as HashMap.
        (definedPackages): Likewise.

Index: java/lang/ClassLoader.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/ClassLoader.java,v
retrieving revision 1.31
diff -u -r1.31 ClassLoader.java
--- java/lang/ClassLoader.java 23 Apr 2004 21:13:20 -0000 1.31
+++ java/lang/ClassLoader.java 19 Sep 2004 23:40:33 -0000
@@ -1,5 +1,5 @@
 /* ClassLoader.java -- responsible for loading classes into the VM
-   Copyright (C) 1998, 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004 Free Software Foundation, 
Inc.
 
 This file is part of GNU Classpath.
 
@@ -122,13 +122,13 @@
    * is not private in order to allow native code (and trusted subclasses)
    * access to this field.
    */
-  final Map loadedClasses = new HashMap();
+  final HashMap loadedClasses = new HashMap();
 
   /**
    * All packages defined by this classloader. It is not private in order to
    * allow native code (and trusted subclasses) access to this field.
    */
-  final Map definedPackages = new HashMap();
+  final HashMap definedPackages = new HashMap();
 
   /**
    * The classloader that is consulted before this classloader.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]