This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
efficiency regression in r8479
- From: Jamison Hope <jrh at theptrgroup dot com>
- To: "kawa at sourceware dot org list" <kawa at sourceware dot org>
- Date: Tue, 26 May 2015 18:35:42 -0400
- Subject: efficiency regression in r8479
- Authentication-results: sourceware.org; auth=none
Up through r8478, this code:
> (define n ::int 0)
> (define (f) (set! n (+ n 1)) #t)
produced this bytecode for the function f:
0: getstatic <Field atInteractiveLevel$1.n int>
3: iconst_1
4: iadd
5: putstatic <Field atInteractiveLevel$1.n int>
8: iconst_1
9: ireturn
Now, it produced all this gobbledygook:
0: getstatic <Field gnu.kawa.functions.AddOp.$Pl gnu.kawa.functions.AddOp>
3: getstatic <Field atInteractiveLevel$1.n int>
6: invokestatic <Method java.lang.Integer.valueOf (int)java.lang.Integer>
9: getstatic <Field atInteractiveLevel$2.Lit0 gnu.math.IntNum>
12: invokevirtual <Method gnu.mapping.Procedure.apply2 (java.lang.Object,java.lang.Object)java.lang.Object>
15: invokestatic <Method gnu.mapping.Promise.force (java.lang.Object)java.lang.Object>
18: dup
19: astore_0
20: checkcast <Class java.lang.Number>
23: invokevirtual <Method java.lang.Number.intValue ()int>
26: putstatic <Field atInteractiveLevel$1.n int>
29: iconst_1
30: ireturn
31: new <Class gnu.mapping.WrongType>
34: dup_x1
35: swap
36: ldc <String "n">
38: bipush -2
40: aload_0
41: invokespecial <Method gnu.mapping.WrongType.<init> (java.lang.ClassCastException,java.lang.String,int,java.lang.Object)void>
44: athrow
I see the same behavior if I compile a .scm file and look at the class
file, so it's not a REPL-only thing. If I change the code from (+ n 1)
to (+ n (->int 1)) then I get the old bytecode back.
Am I just catching a work-in-progress with this new unsigned primitive
stuff?
Thanks,
--
Jamison Hope
The PTR Group
www.theptrgroup.com