<div dir="ltr"><div>Hi Harris,</div><div><br></div><div>I tested your patch and it works, so thanks :)</div><div><br></div><div>If anyone else wants to do this (add a field in class or vtable) : you must pay attention as keeping the offsets correct in the vtable. You must also change the base size of the virtual table object and add the field at the correct position in JavaAOTCompiler (like in the patch).</div>
<div><br></div><div>Julien</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/4/17 Harris BAKIRAS <span dir="ltr"><<a href="mailto:h.bakiras@gmail.com" target="_blank">h.bakiras@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div><tt>Hi Julien,<br>
        <br>
        I found out what was missing for adding a field to JavaClass.<br>
        <br>
        While precompiling Java code (JavaAOTCompiler) we create an
        equivalent LLVM Constant object for each class.<br>
        So modifying the internal representation of a class means that
        you also have to modify the AOTCompiler.</tt><br>
      <tt><br>
        Here is a patch with a tiny example where an int is added to
        JavaClass.<br>
        If you want to add more complex structures, take a look at how
        intrinsics are managed (J3Intrinsics).<span class="HOEnZb"><font color="#888888"><br>
        <br>
      </font></span></tt><span class="HOEnZb"><font color="#888888">
      <pre cols="72">Harris Bakiras
</pre></font></span><div><div class="h5">
      On 04/16/2013 06:56 PM, Harris BAKIRAS wrote:<br>
    </div></div></div><div><div class="h5">
    <blockquote type="cite">
      
      <div><tt>Hi Julien,<br>
          <br>
          I also tried to add a field and get the same error as you.<br>
          <br>
          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)<br>
          in C++ code and in LLVMRuntime/runtime-single.ll<br>
           <br>
          We are working on this issue to see what is going wrong.<br>
          The problem is the fact that the error is not deterministic
          which makes it difficult to solve.<br>
          <br>
          I will tell you more as soon as I solve the issue.<br>
        </tt>
        <pre cols="72">Harris Bakiras
</pre>
        On 04/15/2013 05:25 PM, Julien Pagès wrote:<br>
      </div>
      <blockquote type="cite">
        <div dir="ltr">
          <div>Hi all,</div>
          <div><br>
          </div>
          <div>I am currently working with vmkit (especially on J3) for
            a student project, </div>
          <div>I want to made some experimentations on J3.</div>
          <div>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.</div>
          <div><br>
          </div>
          <div>But JnjvmModule.cpp does not exist anymore. So my first
            question is : what is the equivalent of JnjvmModule.cpp
            right now ?</div>
          <div><br>
          </div>
          <div>Secondly, I also want to add attributes in class
            JavaVirtualClass. When I do I immediately got this error :</div>
          <div>vmjc: JavaClass.cpp:492: j3::JavaObject
            *j3::Class::doNew(j3::Jnjvm *): Assertion `this &&
            "No class when allocating."' failed.</div>
          <div><br>
          </div>
          <div>I tried to change offsets in the class (like
            getDepthIndex(), getOffsetIndex()) but I still have this
            error. </div>
          <div><br>
          </div>
          <div>Do you know what I must change to fix this ? Maybe that I
            forgot to made the changes in another file like with
            JavaClass ?</div>
          <div><br>
          </div>
          <div>Thanks,</div>
          <div><br>
          </div>
          <div>Julien</div>
        </div>
        <br>
        <fieldset></fieldset>
        <br>
        <pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>