Maybe bug

15 views
Skip to first unread message

czap...@gmail.com

unread,
Sep 6, 2014, 11:43:01 AM9/6/14
to yeti...@googlegroups.com
Eh, just minutes after writing my previous email I seem to have found kinda bug. I tried to reduce to minimal example, see below:

module example;

class Foo(Object context, Object attrs)
    var a = 0,
    var b = 0,
    self _ = this,
    _ =
        class ClickListener
            void onClick(Object v)
                if a < (b - 1) then
                    (self ())#update()
                fi,
        end;
        (),
    void update() (),
end;

Compiling with: java -jar ..\yeti.jar -d out example.yeti
Then disassembling with: javap.exe -v out\example$ClickListener
gives:

...
public void onClick(java.lang.Object);
  Code:
   Stack=4, Locals=3, Args_size=2
   0:   aload_2
   1:   getfield        #28; //Field Foo.$2:Lyeti/lang/Num;
...

Here, I think the "aload_2" is not good; the class is called with only 1 argument IIUC; I think that what should be here is "aload_0"? At least Android DEX seems to refuse processing of my non-reduced code at this point :/

I'd be grateful if you fancied to have a look at this; in the meantime I'm going to try some workarounds.
Thanks & Best Regards,
/Mateusz.

Madis

unread,
Sep 6, 2014, 2:13:57 PM9/6/14
to yeti...@googlegroups.com


On Sat, 6 Sep 2014, czap...@gmail.com wrote:

> Eh, just minutes after writing my previous email I seem to have found kinda
> bug. I tried to reduce to minimal example, see below:

The aload_2 seems wrong, I will look into it.
> --
> You received this message because you are subscribed to the Google Groups
> "yeti-lang" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to yeti-lang+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>

Madis

unread,
Sep 18, 2014, 5:59:19 PM9/18/14
to yeti...@googlegroups.com

On Sat, 6 Sep 2014, Madis wrote:

> On Sat, 6 Sep 2014, czap...@gmail.com wrote:
>
>> Eh, just minutes after writing my previous email I seem to have found kinda
>> bug. I tried to reduce to minimal example, see below:
>
> The aload_2 seems wrong, I will look into it.
>
>> public void onClick(java.lang.Object);
>>   Code:
>>    Stack=4, Locals=3, Args_size=2
>>    0:   aload_2
>>    1:   getfield        #28; //Field Foo.$2:Lyeti/lang/Num;
>> ...
>>
>> Here, I think the "aload_2" is not good; the class is called with only 1
>> argument IIUC; I think that what should be here is "aload_0"? At least
>> Android DEX seems to refuse processing of my non-reduced code at this point
>> :/

Probably fixed now.

czap...@gmail.com

unread,
Sep 20, 2014, 1:45:40 PM9/20/14
to yeti...@googlegroups.com, ma...@cyber.ee
With yeti.jar rebuilt after the fix, with some different code, I now get an exception like below during compilation:

java.lang.ArrayIndexOutOfBoundsException: 1
        at yeti.lang.compiler.JavaClass.getCaptures(JavaClass.java:394)
        at yeti.lang.compiler.MethodDesc.defineClass(DefineClass.java:316)
        at yeti.lang.compiler.YetiAnalyzer.analSeq(YetiAnalyzer.java:1092)
        at yeti.lang.compiler.YetiAnalyzer.analyze(YetiAnalyzer.java:92)
        at yeti.lang.compiler.YetiAnalyzer.mapArgs(YetiAnalyzer.java:415)
        at yeti.lang.compiler.YetiAnalyzer.objectRef(YetiAnalyzer.java:449)
        at yeti.lang.compiler.YetiAnalyzer.analyze(YetiAnalyzer.java:193)
        at yeti.lang.compiler.YetiAnalyzer.analSeq(YetiAnalyzer.java:1098)
        at yeti.lang.compiler.YetiAnalyzer.analyze(YetiAnalyzer.java:92)
        at yeti.lang.compiler.MethodDesc.init(DefineClass.java:95)
        at yeti.lang.compiler.MethodDesc.defineClass(DefineClass.java:313)
        at yeti.lang.compiler.YetiAnalyzer.analSeq(YetiAnalyzer.java:1106)
        at yeti.lang.compiler.YetiAnalyzer.analyze(YetiAnalyzer.java:92)
        at yeti.lang.compiler.YetiAnalyzer.toCode(YetiAnalyzer.java:1604)
        at yeti.lang.compiler.Compiler.compile(Compiler.java:473)
        at yeti.lang.compiler.Compiler.compileAll(Compiler.java:199)
        at yeti.lang.compiler.eval$compileYetiFiles$._0(eval.yeti:335)
        at yeti.lang.compiler.eval$compileYetiFiles$.apply(eval.yeti:326)
        at yeti.lang.compiler.YetiTask._9(eval.yeti:674)
        at yeti.lang.compiler.YetiTask.execute(eval.yeti:672)

I can try to reduce the sample code again and attach it, if need be.

/M.

Madis

unread,
Sep 20, 2014, 2:00:45 PM9/20/14
to yeti...@googlegroups.com
Don't bother, should be fixed now. The mergeCaptures was taken by surprise
that the removed capture had become a part of some another list.

Mateusz Czaplinski

unread,
Sep 20, 2014, 8:51:29 PM9/20/14
to yeti...@googlegroups.com
Indeed, seems to work now, thanks!

--
You received this message because you are subscribed to the Google Groups "yeti-lang" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yeti-lang+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages