Welcome! Please see the About page for a little more info on how this works.

0 votes
in Compiler by
closed ago by

related to https://ask.clojure.org/index.php/11553/arrayindexoutofboundsexception-in-clojure-asm-frame

(defprotocol P
  (^double p1 [p a])
  (^double p2 [p a]))

(let [p (reify P)]
  (min 0.0
       (case :p1
         :p1 (p1 p :foo)
         Double/MAX_VALUE)))

yields

Execution error (VerifyError) at java.lang.Class/getDeclaredConstructors0 (Class.java:-2).
Inconsistent stackmap frames at branch target 121
Exception Details:
  Location:
    user$eval1401301.invokeStatic()Ljava/lang/Object; @115: goto
  Reason:
    Current frame's stack size doesn't match stackmap.
  Current Frame:
    bci: @115
    flags: { }
    locals: { null, 'clojure/lang/Keyword' }
    stack: { double, double_2nd, 'java/lang/Object' }
  Stackmap Frame:
    bci: @121
    flags: { }
    locals: { 'clojure/lang/IObj', 'clojure/lang/Keyword' }
    stack: { double, double_2nd, top, top }
  Bytecode:
    0000000: bb00 0f59 01b7 0012 c000 14b2 0018 c000
    0000010: 1ab9 001e 0200 4b0e b200 224c 2bb8 0028
    0000020: aa00 0000 0000 0056 3c72 5a61 3c72 5a61
    0000030: 0000 0014 2bb2 0022 a600 3e2a 014b 59b8
    0000040: 002c b200 2ea5 0011 59c1 0030 9a00 1c59
    0000050: b800 2cb3 002e b200 34b6 0039 5fb2 003c
    0000060: b900 4203 00a7 000e c000 30b2 003c b900
    0000070: 4602 00a7 0006 b200 4cb8 0054 b800 58b0
    0000080:                                        
  Stackmap Table:
    full_frame(@52,{Object[#20],Object[#91]},{Double})
    full_frame(@86,{Null,Object[#91]},{Double,Object[#20]})
    full_frame(@104,{Null,Object[#91]},{Double,Object[#20]})
    full_frame(@115,{Null,Object[#91]},{Double,Object[#93]})
    full_frame(@118,{Object[#20],Object[#91]},{Double})
    full_frame(@121,{Object[#20],Object[#91]},{Double,Top,Top})

Repro'd against 1.10.3 and 1.11.0-beta1

Let me know if you'd like me to submit this to JIRA :)

James

closed with the note: Fixed in Clojure 1.12.0-beta1

1 Answer

0 votes
by
selected by
 
Best answer

Added this also to https://clojure.atlassian.net/browse/CLJ-2698 as it's not immediately clear if they are related or not. If it turns out that they're different problems then I'll update this with the new ticket number.

...