[LLVMdev] [vmkit]Problems when modifying J3

Harris BAKIRAS h.bakiras at gmail.com
Wed Apr 17 08:31:15 PDT 2013


Hi Julien,

I found out what was missing for adding a field to JavaClass.

While precompiling Java code (JavaAOTCompiler) we create an equivalent 
LLVM Constant object for each class.
So modifying the internal representation of a class means that you also 
have to modify the AOTCompiler.

Here is a patch with a tiny example where an int is added to JavaClass.
If you want to add more complex structures, take a look at how 
intrinsics are managed (J3Intrinsics).

Harris Bakiras

On 04/16/2013 06:56 PM, Harris BAKIRAS wrote:
> Hi Julien,
>
> I also tried to add a field and get the same error as you.
>
> In theory, to add a field in JavaClass or JavaCommonClass you have to 
> put your field at the end of the declaration list (in order to 
> minimize index changes in J3Intrinsics)
> in C++ code and in LLVMRuntime/runtime-single.ll
>
> We are working on this issue to see what is going wrong.
> The problem is the fact that the error is not deterministic which 
> makes it difficult to solve.
>
> I will tell you more as soon as I solve the issue.
> Harris Bakiras
> On 04/15/2013 05:25 PM, Julien Pagès wrote:
>> Hi all,
>>
>> I am currently working with vmkit (especially on J3) for a student 
>> project,
>> I want to made some experimentations on J3.
>> I see in the file lib/j3/VMCore/JavaClass.h that if I want to add 
>> some attributes in the class JavaClass I must change a few thing in 
>> LLVMRuntime/* and in JnjvmModule.cpp.
>>
>> But JnjvmModule.cpp does not exist anymore. So my first question is : 
>> what is the equivalent of JnjvmModule.cpp right now ?
>>
>> Secondly, I also want to add attributes in class JavaVirtualClass. 
>> When I do I immediately got this error :
>> vmjc: JavaClass.cpp:492: j3::JavaObject *j3::Class::doNew(j3::Jnjvm 
>> *): Assertion `this && "No class when allocating."' failed.
>>
>> I tried to change offsets in the class (like getDepthIndex(), 
>> getOffsetIndex()) but I still have this error.
>>
>> Do you know what I must change to fix this ? Maybe that I forgot to 
>> made the changes in another file like with JavaClass ?
>>
>> Thanks,
>>
>> Julien
>>
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu          http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130417/72ef1a98/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: new_field_patch.diff
Type: text/x-patch
Size: 2779 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130417/72ef1a98/attachment.bin>


More information about the llvm-dev mailing list