This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ and Java CNI: Check Java references


>>>>> "Andrew" == Andrew Haley <aph@redhat.com> writes:

>> Mark Mitchell writes:
>> JavaPointer<Foo> f;
>> f-> bar();
>> You don't need to check `this' in `Foo::bar'; you'll have checked at
>> the call-site.

Andrew> Okay, I guess that's true as long as we enforce this same rule
Andrew> in the Java compiler: that is, whenever we call a method, even
Andrew> if that method can be resolved without going via a vtable, we
Andrew> check that the object is non-NULL.  Problem solved.

FWIW we already do this check.  Look for INVOKE_NONVIRTUAL in parse.y.
Offhand I don't know if we do this when compiling from bytecode, but I
assume we do.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]