[vmkit-commits] [PATCH] registerNatives
Will Dietz
wdietz2 at illinois.edu
Mon Oct 24 10:32:16 PDT 2011
Starting a new thread for both our sanity :).
Also, note the change of email address--feel free to contact me on
either, but being double-subscribed to the ML was silly.
On Mon, Oct 24, 2011 at 1:10 AM, Nicolas Geoffray
<nicolas.geoffray at gmail.com> wrote:
>
> Should we think about concurrent updates and lookups on registeredNatives?
> Unfortunately, I think we should :(
>
Hmm, I think you're right. Certainly ensures the correct behavior
regardless. I'll use the classloader's lock as you mention.
>> + word_t getRegisteredNative(const JavaMethod * meth) const {
>> + std::map<const JavaMethod*,word_t>::const_iterator I =
>> + registeredNatives.find(meth);
>> + if (I == registeredNatives.end()) return 0;
>> + return I->second;
>
> Could that be replaced with registeredNatives[meth]?
>
No, can't call operator[] on a const map, although the const
correctness isn't really very important, since we never have a const
JCL--so maybe clarity/simplicity of code should win here.
Will change.
>>
>> + }
>> +
>> friend class Class;
>> friend class CommonClass;
>> friend class StringList;
>> diff --git a/lib/J3/VMCore/Precompiled.cpp b/lib/J3/VMCore/Precompiled.cpp
>> index e469eaf..9a85e99 100644
>> --- a/lib/J3/VMCore/Precompiled.cpp
>> +++ b/lib/J3/VMCore/Precompiled.cpp
>> @@ -102,6 +102,7 @@ extern "C" word_t vmjcNativeLoader(JavaMethod* meth) {
>> char* buf = (char*)threadAllocator.Allocate(
>> 3 + JNI_NAME_PRE_LEN + 1 + ((mnlen + clen + mtlen) << 3));
>> word_t res = meth->classDef->classLoader->nativeLookup(meth, j3, buf);
>
> Could you please add a comment on what's happening here? It might get tricky
> to understand.
>
Sure thing. I'll include that in next revision.
Thanks!
~Will
More information about the vmkit-commits
mailing list