RFC: make verifier more lazy - 2nd try
Robert Schuster
theBohemian@gmx.net
Thu Nov 17 07:30:00 GMT 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Tom,
thanks for the review.
Here is my next try:
ChangeLog hasnt changed (In fact the last one was wrong in line 4).
2005-11-17 Robert Schuster <robertschuster@fsfe.org>
* gcj/javaprims.h:
(_Jv_equalsUtf8Classname): New method declaration.
(_Jv_isPrimitiveOrDerived): Dito.
* prims.cc (_Jv_equalsUtf8Classnames): New method.
* prims.cc (_Jv_isPrimitiveOrDerived): New method.
* verify.cc:
(ref_intersection::equals): Use new classname comparison method.
(type::compatible): Use new classname comparison method. Added
check whether LHS' type is java.lang.Object .
(type::resolve): Added new optional debug message and simplified
expression.
(type::to_array): Added codepath that generates an array type
without resolving the element type.
> Robert> +// For strcpy
> Robert> +#include <string.h>
Removed that.
> This doesn't need a comment.
>
> Robert> + if ( self->data.klass == &java::lang::Object::class$ )
>
> In our coding style there are no spaces after '(' or before ')'.
Fixed that all over the place.
> Robert> + if ( klass->data.name->limit()[-1] == ';' ||
> Robert> + _Jv_isDerivedFromPrimitive(klass->data.name) )
>
> Instead of _Jv_isDerivedFromPrimitive, can't you just look for a
> leading '[' here?
>
> I suppose we need to test this to make sure it works with class names
> like 'I'.
What I need to identify is (regexp) "\[*(Z|C|B|S|I|L|F|D)" . I changed the
function name back to what thought up initially.
> Robert> +jboolean
> Robert> +_Jv_equalUtf8Classnames (const Utf8Const *a, const Utf8Const *b)
> Robert> +{
> Robert> + if ( _Jv_equalUtf8Consts(a, b) )
> Robert> + return true;
>
> This is inefficient. Couldn't we handle this check in the same loop
> as the other others?
Removed that.
> Robert> + // Skips any leading L characters (even if they belong to the package
> Robert> + // name).
> Robert> + while ( ac == 'L' )
> Robert> + ac = UTF8_GET(aptr, alimit);
>
> I think there can only be one leading 'L', and you only want to strip
> it if the last character is a ';'. You can "strip" the ';'s by
> decrementing the corresponding limit variable.
Reworked _Jv_equalsUtf8Classnames to make it more efficient and still compliant
to what it did before.
>
> Robert> + friend jboolean _Jv_equalUtf8Classnames (const _Jv_Utf8Const*, const _Jv_Utf8Const*);
>
> This goes over 80 columns and should be split at the ','.
Fixed.
cya
Robert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFDfDF9G9cfwmwwEtoRAosFAJwITSlxTzM1P9hFL9zM7VPvqlOxUACgmMR+
30YDGLAg4amZJQiF0nW8lqE=
=XDRs
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcj-verifier-lazy2.diff
Type: text/x-patch
Size: 9219 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20051117/1b6b4146/attachment.bin>
More information about the Java-patches
mailing list