This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


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

Re: gnu.bytecode: Method without Code Attribute


Looks like it was a bug, unless I'm misreading the source,
constant pool entries were never assigned for methods with null
code blocks. The following modification (sorry, not quite diff
format) appears to solve the problem.

gnu/bytecode/ClassType.java, line 565:

   for (Method method = methods; method != null; method =
method.next) {
     CodeAttr code = method.code;
     if (code == null)
++     {
++       method.assign_constants ();
         continue;
++     }
     for (;;)
       {
         CodeFragment frag = code.fragments;
         if (frag == null)
           break;
         code.fragments = frag.next;
         frag.emit(code);
       }
     method.assign_constants ();
     method.code.finalize_labels ();
   }


Cheers,
Chris

Per Bothner wrote:
> 
> Chris Wolfe <cwolfe@globetrotter.qc.ca> writes:
> 
> > It appears that a Code attribute must be created (initCode) for a
> > Method to actually be written to output.
> 
> If that is really the case, it is a bug in gnu.bytecode.  Could you
> try to track down what is preventing a Code-less method from being
> written?
> --
>         --Per Bothner
> per@bothner.com   http://www.bothner.com/~per/


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