Skip to content

Instantly share code, notes, and snippets.

@WickedShell

WickedShell/REPL Secret

Created Aug 1, 2020
Embed
What would you like to do?
Clojure compiler bug?
{:clojure.main/message
"Execution error (VerifyError) at java.lang.Class/getDeclaredConstructors0 (Class.java:-2).\nInconsistent stackmap frames at branch target 165\nException Details:\n Location:\n clj_comp_bug/core$foo.invokeStatic()Ljava/lang/Object; @100: goto\n Reason:\n Current frame's stack size doesn't match stackmap.\n Current Frame:\n bci: @100\n flags: { }\n locals: { 'clj_comp_bug/core/Location', 'clj_comp_bug/core/Item', 'clojure/lang/Keyword' }\n stack: { null }\n Stackmap Frame:\n bci: @165\n flags: { }\n locals: { 'clj_comp_bug/core/Location', 'clj_comp_bug/core/Item', 'clojure/lang/Keyword' }\n stack: { top, top }\n Bytecode:\n 0x0000000: bb00 0d59 b200 11c0 0013 b800 19b2 0011\n 0x0000010: c000 13b8 0019 b700 1c4b bb00 1e59 b200\n 0x0000020: 21c0 0013 b800 19b2 0011 c000 13b8 0019\n 0x0000030: b700 224c 2bc0 001e b600 264d 2cb8 002c\n 0x0000040: 037a 047e aa00 0000 0000 0047 0000 0000\n 0x0000050: 0000 0001 0000 0018 0000 0023 2cb2 0030\n 0x0000060: a600 2b01 a700 412c b200 33a6 0020 b200\n 0x0000070: 37b6 003c c000 3e2a 014b 2b01 4cc0 001e\n 0x0000080: b600 41b9 0045 0300 a700 1db2 0037 b600\n 0x0000090: 3cc0 003e 2a01 4b2b 014c c000 1eb6 0041\n 0x00000a0: b900 4503 004a 29b8 004c 59c6 001f b200\n 0x00000b0: 52a5 001a 2939 05b2 0055 b600 3cc0 0057\n 0x00000c0: 1259 b900 5d02 00a7 0014 57b2 0055 b600\n 0x00000d0: 3cc0 0057 1261 b900 5d02 00b0 \n Stackmap Table:\n append_frame(@92,Object[#13],Object[#30],Object[#102])\n same_frame(@103)\n same_frame(@139)\n full_frame(@165,{Object[#13],Object[#30],Object[#102]},{Top,Top})\n same_locals_1_stack_item_frame(@202,Object[#72])\n same_frame(@203)\n same_locals_1_stack_item_frame(@219,Object[#104])\n\n",
:clojure.main/triage
{:clojure.error/class java.lang.VerifyError,
:clojure.error/line -2,
:clojure.error/cause
"Inconsistent stackmap frames at branch target 165\nException Details:\n Location:\n clj_comp_bug/core$foo.invokeStatic()Ljava/lang/Object; @100: goto\n Reason:\n Current frame's stack size doesn't match stackmap.\n Current Frame:\n bci: @100\n flags: { }\n locals: { 'clj_comp_bug/core/Location', 'clj_comp_bug/core/Item', 'clojure/lang/Keyword' }\n stack: { null }\n Stackmap Frame:\n bci: @165\n flags: { }\n locals: { 'clj_comp_bug/core/Location', 'clj_comp_bug/core/Item', 'clojure/lang/Keyword' }\n stack: { top, top }\n Bytecode:\n 0x0000000: bb00 0d59 b200 11c0 0013 b800 19b2 0011\n 0x0000010: c000 13b8 0019 b700 1c4b bb00 1e59 b200\n 0x0000020: 21c0 0013 b800 19b2 0011 c000 13b8 0019\n 0x0000030: b700 224c 2bc0 001e b600 264d 2cb8 002c\n 0x0000040: 037a 047e aa00 0000 0000 0047 0000 0000\n 0x0000050: 0000 0001 0000 0018 0000 0023 2cb2 0030\n 0x0000060: a600 2b01 a700 412c b200 33a6 0020 b200\n 0x0000070: 37b6 003c c000 3e2a 014b 2b01 4cc0 001e\n 0x0000080: b600 41b9 0045 0300 a700 1db2 0037 b600\n 0x0000090: 3cc0 003e 2a01 4b2b 014c c000 1eb6 0041\n 0x00000a0: b900 4503 004a 29b8 004c 59c6 001f b200\n 0x00000b0: 52a5 001a 2939 05b2 0055 b600 3cc0 0057\n 0x00000c0: 1259 b900 5d02 00a7 0014 57b2 0055 b600\n 0x00000d0: 3cc0 0057 1261 b900 5d02 00b0 \n Stackmap Table:\n append_frame(@92,Object[#13],Object[#30],Object[#102])\n same_frame(@103)\n same_frame(@139)\n full_frame(@165,{Object[#13],Object[#30],Object[#102]},{Top,Top})\n same_locals_1_stack_item_frame(@202,Object[#72])\n same_frame(@203)\n same_locals_1_stack_item_frame(@219,Object[#104])\n",
:clojure.error/symbol java.lang.Class/getDeclaredConstructors0,
:clojure.error/source "Class.java",
:clojure.error/phase :execution},
:clojure.main/trace
{:via
[{:type clojure.lang.Compiler$CompilerException,
:message "Syntax error macroexpanding def at (core.clj:42:1).",
:data
{:clojure.error/phase :execution,
:clojure.error/line 42,
:clojure.error/column 1,
:clojure.error/source "core.clj",
:clojure.error/symbol def},
:at [clojure.lang.Compiler$DefExpr eval "Compiler.java" 470]}
{:type java.lang.VerifyError,
:message
"Inconsistent stackmap frames at branch target 165\nException Details:\n Location:\n clj_comp_bug/core$foo.invokeStatic()Ljava/lang/Object; @100: goto\n Reason:\n Current frame's stack size doesn't match stackmap.\n Current Frame:\n bci: @100\n flags: { }\n locals: { 'clj_comp_bug/core/Location', 'clj_comp_bug/core/Item', 'clojure/lang/Keyword' }\n stack: { null }\n Stackmap Frame:\n bci: @165\n flags: { }\n locals: { 'clj_comp_bug/core/Location', 'clj_comp_bug/core/Item', 'clojure/lang/Keyword' }\n stack: { top, top }\n Bytecode:\n 0x0000000: bb00 0d59 b200 11c0 0013 b800 19b2 0011\n 0x0000010: c000 13b8 0019 b700 1c4b bb00 1e59 b200\n 0x0000020: 21c0 0013 b800 19b2 0011 c000 13b8 0019\n 0x0000030: b700 224c 2bc0 001e b600 264d 2cb8 002c\n 0x0000040: 037a 047e aa00 0000 0000 0047 0000 0000\n 0x0000050: 0000 0001 0000 0018 0000 0023 2cb2 0030\n 0x0000060: a600 2b01 a700 412c b200 33a6 0020 b200\n 0x0000070: 37b6 003c c000 3e2a 014b 2b01 4cc0 001e\n 0x0000080: b600 41b9 0045 0300 a700 1db2 0037 b600\n 0x0000090: 3cc0 003e 2a01 4b2b 014c c000 1eb6 0041\n 0x00000a0: b900 4503 004a 29b8 004c 59c6 001f b200\n 0x00000b0: 52a5 001a 2939 05b2 0055 b600 3cc0 0057\n 0x00000c0: 1259 b900 5d02 00a7 0014 57b2 0055 b600\n 0x00000d0: 3cc0 0057 1261 b900 5d02 00b0 \n Stackmap Table:\n append_frame(@92,Object[#13],Object[#30],Object[#102])\n same_frame(@103)\n same_frame(@139)\n full_frame(@165,{Object[#13],Object[#30],Object[#102]},{Top,Top})\n same_locals_1_stack_item_frame(@202,Object[#72])\n same_frame(@203)\n same_locals_1_stack_item_frame(@219,Object[#104])\n",
:at [java.lang.Class getDeclaredConstructors0 "Class.java" -2]}],
:trace
[[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.lang.Compiler$ObjExpr eval "Compiler.java" 4996]
[clojure.lang.Compiler$DefExpr eval "Compiler.java" 457]
[clojure.lang.Compiler compile1 "Compiler.java" 7731]
[clojure.lang.Compiler compile "Compiler.java" 7798]
[clojure.lang.RT compile "RT.java" 411]
[clojure.lang.RT load "RT.java" 457]
[clojure.lang.RT load "RT.java" 424]
[clojure.core$load$fn__6839 invoke "core.clj" 6126]
[clojure.core$load invokeStatic "core.clj" 6125]
[clojure.core$load doInvoke "core.clj" 6109]
[clojure.lang.RestFn invoke "RestFn.java" 408]
[clojure.core$load_one invokeStatic "core.clj" 5908]
[clojure.core$compile$fn__6844 invoke "core.clj" 6136]
[clojure.core$compile invokeStatic "core.clj" 6136]
[clojure.core$compile invoke "core.clj" 6128]
[user$eval239$fn__248 invoke "form-init1336867038665194046.clj" 1]
[user$eval239 invokeStatic "form-init1336867038665194046.clj" 1]
[user$eval239 invoke "form-init1336867038665194046.clj" 1]
[clojure.lang.Compiler eval "Compiler.java" 7177]
[clojure.lang.Compiler eval "Compiler.java" 7167]
[clojure.lang.Compiler eval "Compiler.java" 7167]
[clojure.lang.Compiler load "Compiler.java" 7636]
[clojure.lang.Compiler loadFile "Compiler.java" 7574]
[clojure.main$load_script invokeStatic "main.clj" 475]
[clojure.main$init_opt invokeStatic "main.clj" 477]
[clojure.main$init_opt invoke "main.clj" 477]
[clojure.main$initialize invokeStatic "main.clj" 508]
[clojure.main$null_opt invokeStatic "main.clj" 542]
[clojure.main$null_opt invoke "main.clj" 539]
[clojure.main$main invokeStatic "main.clj" 664]
[clojure.main$main doInvoke "main.clj" 616]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.lang.Var applyTo "Var.java" 705]
[clojure.main main "main.java" 40]],
:cause
"Inconsistent stackmap frames at branch target 165\nException Details:\n Location:\n clj_comp_bug/core$foo.invokeStatic()Ljava/lang/Object; @100: goto\n Reason:\n Current frame's stack size doesn't match stackmap.\n Current Frame:\n bci: @100\n flags: { }\n locals: { 'clj_comp_bug/core/Location', 'clj_comp_bug/core/Item', 'clojure/lang/Keyword' }\n stack: { null }\n Stackmap Frame:\n bci: @165\n flags: { }\n locals: { 'clj_comp_bug/core/Location', 'clj_comp_bug/core/Item', 'clojure/lang/Keyword' }\n stack: { top, top }\n Bytecode:\n 0x0000000: bb00 0d59 b200 11c0 0013 b800 19b2 0011\n 0x0000010: c000 13b8 0019 b700 1c4b bb00 1e59 b200\n 0x0000020: 21c0 0013 b800 19b2 0011 c000 13b8 0019\n 0x0000030: b700 224c 2bc0 001e b600 264d 2cb8 002c\n 0x0000040: 037a 047e aa00 0000 0000 0047 0000 0000\n 0x0000050: 0000 0001 0000 0018 0000 0023 2cb2 0030\n 0x0000060: a600 2b01 a700 412c b200 33a6 0020 b200\n 0x0000070: 37b6 003c c000 3e2a 014b 2b01 4cc0 001e\n 0x0000080: b600 41b9 0045 0300 a700 1db2 0037 b600\n 0x0000090: 3cc0 003e 2a01 4b2b 014c c000 1eb6 0041\n 0x00000a0: b900 4503 004a 29b8 004c 59c6 001f b200\n 0x00000b0: 52a5 001a 2939 05b2 0055 b600 3cc0 0057\n 0x00000c0: 1259 b900 5d02 00a7 0014 57b2 0055 b600\n 0x00000d0: 3cc0 0057 1261 b900 5d02 00b0 \n Stackmap Table:\n append_frame(@92,Object[#13],Object[#30],Object[#102])\n same_frame(@103)\n same_frame(@139)\n full_frame(@165,{Object[#13],Object[#30],Object[#102]},{Top,Top})\n same_locals_1_stack_item_frame(@202,Object[#72])\n same_frame(@203)\n same_locals_1_stack_item_frame(@219,Object[#104])\n",
:phase :execution}}
(ns clj-comp-bug.core
(:gen-class))
(defrecord Location [^double latitude ^double longitude]
Object
(toString [this] (str "Location("
"Latitude:" latitude
" Longitude:" longitude
")")))
(definterface MissionItem
(^clojure.lang.PersistentVector getSimpleItems [])
(^clojure.lang.Keyword getItemType [])
(^long getItemId [])
(getItemLocation []))
(defrecord Item [^double lat ^double lon]
MissionItem
(getSimpleItems [this] [this])
(getItemType [this] :simple)
(getItemId [this] (long (rand-int 100)))
(getItemLocation [this] (Location. (.lat this) (.lon this)))
)
(def ^:const EARTH_RADIUS 6371000.0)
(defn haversine-distance
"Computes the distance between two lat lon points"
^double [point1 point2]
(let [lat1 (Math/toRadians (:latitude point1))
lon1 (Math/toRadians (:longitude point1))
lat2 (Math/toRadians (:latitude point2))
lon2 (Math/toRadians (:longitude point2))
a (+ (Math/pow (Math/sin (/ (- lat1 lat2) 2.0)) 2.0)
(* (Math/cos lat1)
(Math/cos lat2)
(Math/pow (Math/sin (/ (- lon1 lon2) 2.0)) 2.0)))
c (* 2.0 (Math/atan2 (Math/sqrt a) (Math/sqrt (- 1.0 a))))
d (* c EARTH_RADIUS)]
d))
(defn foo
"I don't do a whole lot."
[]
(let [origin (Location. 0 0)
item (Item. 1 0)]
(if-let [current-distance (case (.getItemType item)
:survey nil
:vtol-straight-landing (haversine-distance origin (.getItemLocation item))
(haversine-distance origin (.getItemLocation item)))]
(println "got dist")
(println "no dist"))))
(defproject clj-comp-bug "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:aot :all
:main clj-comp-bug.core
:dependencies [[org.clojure/clojure "1.10.1"]])
% lein.sh repl
Compiling clj-comp-bug.core
Syntax error macroexpanding def at (core.clj:42:1).
Execution error (VerifyError) at java.lang.Class/getDeclaredConstructors0 (Class.java:-2).
Inconsistent stackmap frames at branch target 165
Exception Details:
Location:
clj_comp_bug/core$foo.invokeStatic()Ljava/lang/Object; @100: goto
Reason:
Current frame's stack size doesn't match stackmap.
Current Frame:
bci: @100
flags: { }
locals: { 'clj_comp_bug/core/Location', 'clj_comp_bug/core/Item', 'clojure/lang/Keyword' }
stack: { null }
Stackmap Frame:
bci: @165
flags: { }
locals: { 'clj_comp_bug/core/Location', 'clj_comp_bug/core/Item', 'clojure/lang/Keyword' }
stack: { top, top }
Bytecode:
0x0000000: bb00 0d59 b200 11c0 0013 b800 19b2 0011
0x0000010: c000 13b8 0019 b700 1c4b bb00 1e59 b200
0x0000020: 21c0 0013 b800 19b2 0011 c000 13b8 0019
0x0000030: b700 224c 2bc0 001e b600 264d 2cb8 002c
0x0000040: 037a 047e aa00 0000 0000 0047 0000 0000
0x0000050: 0000 0001 0000 0018 0000 0023 2cb2 0030
0x0000060: a600 2b01 a700 412c b200 33a6 0020 b200
0x0000070: 37b6 003c c000 3e2a 014b 2b01 4cc0 001e
0x0000080: b600 41b9 0045 0300 a700 1db2 0037 b600
0x0000090: 3cc0 003e 2a01 4b2b 014c c000 1eb6 0041
0x00000a0: b900 4503 004a 29b8 004c 59c6 001f b200
0x00000b0: 52a5 001a 2939 05b2 0055 b600 3cc0 0057
0x00000c0: 1259 b900 5d02 00a7 0014 57b2 0055 b600
0x00000d0: 3cc0 0057 1261 b900 5d02 00b0
Stackmap Table:
append_frame(@92,Object[#13],Object[#30],Object[#102])
same_frame(@103)
same_frame(@139)
full_frame(@165,{Object[#13],Object[#30],Object[#102]},{Top,Top})
same_locals_1_stack_item_frame(@202,Object[#72])
same_frame(@203)
same_locals_1_stack_item_frame(@219,Object[#104])
Full report at:
/tmp/clojure-6713197047455161588.edn
Compilation failed: Subprocess failed
@WickedShell

This comment has been minimized.

Copy link
Owner Author

@WickedShell WickedShell commented Aug 1, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment