tools.emitter.jvm

Stack error in recur

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Critical Critical
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

user> (loop [acc 0
             col (range 50)]
        (if-not (empty? col)
          (recur (+ acc (first col)) (rest col))
          acc))

Generates exception

expected: (= (apply + (range 50)) (e/eval (quote (loop [acc 0 col (range 50)] (if-not (empty? col) (recur (+ acc (first col)) (rest col)) acc)))))
  actual: java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    clojure/tools/emitter/passes/jvm/annotate_internal_name$fn__8917.invoke()Ljava/lang/Object; @4: invokestatic
  Reason:
    Type 'java/lang/Number' (current frame, stack[0]) is not assignable to long_2nd
  Current Frame:
    bci: @4
    flags: { }
    locals: { 'clojure/tools/emitter/passes/jvm/annotate_internal_name$fn__8917' }
    stack: { 'java/lang/Number' }
  Bytecode:
    0x0000000: 2ab6 0045 b800 49b0

 at java.lang.Class.getDeclaredConstructors0 (Class.java:-2)
    java.lang.Class.privateGetDeclaredConstructors (Class.java:2671)
    java.lang.Class.getConstructor0 (Class.java:3075)
    java.lang.Class.newInstance (Class.java:412)
    clojure.tools.emitter.jvm$eval.invoke (clojure/tools/emitter/jvm.clj:105)
    clojure.tools.emitter.jvm$eval.invoke (clojure/tools/emitter/jvm.clj:83)
    clojure.tools.emitter.jvm.core_test$fn__8193$fn__8328.invoke (core_test.clj:74)
    clojure.tools.emitter.jvm.core_test/fn (core_test.clj:73)

Activity

Hide
Nicola Mometto added a comment -

Looks like a problem with boxing, not sure when I'll have time to investigate/fix this

Show
Nicola Mometto added a comment - Looks like a problem with boxing, not sure when I'll have time to investigate/fix this

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: