Request for reviews (XXL): 6893268: additional dynamic language related optimizations in C2

Christian Thalinger Christian.Thalinger at Sun.COM
Fri Dec 4 05:26:11 PST 2009

On Thu, 2009-12-03 at 10:18 -0800, Tom Rodriguez wrote:
> ciKlass.cpp:  is_in_package isn't really safe since it's not checking
> for the trailing dot after the package name so it would return true if
> only the prefix matches.  It works fine for your case but it should be
> correct for all cases.  

Fixed.  Well... (see below).

> Any reason you're using external_name instead of the symbolOop itself?
> external_name requires allocation and conversion.

I think I used external_name() because it returns the name with / to .
converted and probably because I didn't see that symbolOop has an
equals() method.

But I just noticed that symbolOopDesc::equals(const char* str, int len)
also checks that the length is the same, which I didn't expect (given
there is a len argument).

So I added three methods to symbolOopDesc:

+  bool equals(const char* str) const { return equals(str, (int) strlen(str)); }
+  // Tests if the symbol starts with the given prefix.
+  bool starts_with(const char* prefix, int len) const;
+  bool starts_with(const char* prefix) const {
+    return starts_with(prefix, (int) strlen(prefix));
+  }

and used the first one in places where it's appropriate.  Here is a
webrev of the changes:

Could I roll that into this change?

-- Christian

More information about the hotspot-compiler-dev mailing list