2009/9/5 Pekka Enberg <penb...@cs.helsinki.fi>:
> Vegard Nossum wrote:
>>
>> 2009/9/5 Pekka Enberg <penb...@cs.helsinki.fi>:
>>>
>>> Good point. I wonder why we have methods without code attribute in
>>> classfiles.
>>>
>>
>> Native and abstract methods don't have code. It's all here:
>>
>>
>> http://java.sun.com/docs/books/jvms/second_edition/html/ClassFile.doc.html#1546
>>
>> I think I tried once to skip the prepare-for-jit call, but something
>> crashed. But I think it's a good idea to try to fix it.
>
> Actually, we *do* need to prepare for jit because trampolines work on struct
> compilation_unit. So we probably need to initialize the cafebabe struct
> anyway.
>

int vm_method_init(struct vm_method *vmm,
        struct vm_class *vmc, unsigned int method_index)
{
...
        if (vm_method_is_native(vmm) || vm_method_is_abstract(vmm)) {
                /* Hm, we're now modifying a cafebabe structure. */
                vmm->code_attribute.max_stack = 0;
                vmm->code_attribute.max_locals = vmm->args_count;

                vmm->line_number_table_attribute.line_number_table_length = 0;
                vmm->line_number_table_attribute.line_number_table = NULL;
                return 0;
        }

This is where we are initializing the code_attribute if it doesn't really exist.

I think it's probably the fault of vm_method_init_from_interface()
which doesn't initialize code_attribute and should do the above
unconditionally (initialize to zero) because interface methods are
always abstract.


Vegard

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jatovm-devel mailing list
Jatovm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jatovm-devel

Reply via email to