public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* efficiency regression in r8479
@ 2015-05-26 22:35 Jamison Hope
  2015-05-27 16:21 ` Per Bothner
  0 siblings, 1 reply; 4+ messages in thread
From: Jamison Hope @ 2015-05-26 22:35 UTC (permalink / raw)
  To: kawa@sourceware.org list

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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-27 18:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-26 22:35 efficiency regression in r8479 Jamison Hope
2015-05-27 16:21 ` Per Bothner
2015-05-27 18:08   ` Jamison Hope
2015-05-27 18:30     ` Per Bothner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).