2011/3/21 Chun Tian (binghe) binghe.lisp@gmail.com:
Hi, Alessio
Thank you for pointing out this. You're right. IF I temporary removed the LOGAND form and just return the inner ATOMIC-INCF form, then everything goes well, compilation can pass.
The next issue happens in a file which has some method definitions, ABCL report "Register 4 contains wrong type" when loading a just compiled .abcl file:
; Loading #P"/Users/binghe/.cache/common-lisp/abcl-0.26.0-dev-svn-13251-fasl37-macosx-java/Users/binghe/Lisp/cl-net-snmp/snmp/branches/6/snmp-get.abcl" ...
; Compilation unit finished ; Caught 1 STYLE-WARNING condition
java.lang.VerifyError: (class: org/armedbear/lisp/ASDF_TMP_snmp_get_1, method: execute signature: (Lorg/armedbear/lisp/LispObject;Lorg/armedbear/lisp/LispObject;Lorg/armedbear/lisp/LispObject;Lorg/armedbear/lisp/LispObject;)Lorg/armedbear/lisp/LispObject;) Register 4 contains wrong type at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389) at java.lang.Class.getConstructor0(Class.java:2699) at java.lang.Class.newInstance0(Class.java:326) at java.lang.Class.newInstance(Class.java:308) at org.armedbear.lisp.FaslClassLoader.loadFunction(FaslClassLoader.java:111) at org.armedbear.lisp.FaslClassLoader$pf_get_fasl_function.execute(FaslClassLoader.java:149) at org.armedbear.lisp.LispThread.execute(LispThread.java:653) at org.armedbear.lisp.Lisp.evalCall(Lisp.java:547) at org.armedbear.lisp.Lisp.eval(Lisp.java:505) at org.armedbear.lisp.Lisp.evalCall(Lisp.java:542) at org.armedbear.lisp.Lisp.eval(Lisp.java:505) at org.armedbear.lisp.Load.faslLoadStream(Load.java:608) at org.armedbear.lisp.Load$init_fasl.execute(Load.java:414) at org.armedbear.lisp.LispThread.execute(LispThread.java:653) at org.armedbear.lisp.Lisp.evalCall(Lisp.java:547) at org.armedbear.lisp.Lisp.eval(Lisp.java:505) at org.armedbear.lisp.Load.loadStream(Load.java:575) at org.armedbear.lisp.Load.loadFileFromStream(Load.java:531) at org.armedbear.lisp.Load.load(Load.java:198) at org.armedbear.lisp.Load.load(Load.java:683) at org.armedbear.lisp.Load$_load.execute(Load.java:633) at org.armedbear.lisp.Symbol.execute(Symbol.java:825) at org.armedbear.lisp.LispThread.execute(LispThread.java:688) at org.armedbear.lisp.load_1.execute(load.lisp:33) at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:101) at org.armedbear.lisp.LispThread.execute(LispThread.java:636) at org.armedbear.lisp.Primitives$pf_apply.execute(Primitives.java:2799) at org.armedbear.lisp.Symbol.execute(Symbol.java:801) at org.armedbear.lisp.LispThread.execute(LispThread.java:653) at org.armedbear.lisp.map_1.execute(map.lisp:33) at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:124) at org.armedbear.lisp.Symbol.execute(Symbol.java:813) at org.armedbear.lisp.LispThread.execute(LispThread.java:670) at org.armedbear.lisp.asdf_389.execute(asdf.lisp:1965) at org.armedbear.lisp.clos_308.execute(clos.lisp:1950) at org.armedbear.lisp.clos_287.execute(clos.lisp:1718) at org.armedbear.lisp.StandardGenericFunction.execute(StandardGenericFunction.java:138) at org.armedbear.lisp.Symbol.execute(Symbol.java:801) at org.armedbear.lisp.LispThread.execute(LispThread.java:653) at org.armedbear.lisp.asdf_391.execute(asdf.lisp:1972) at org.armedbear.lisp.LispThread.execute(LispThread.java:653) at org.armedbear.lisp.clos_312.execute(clos.lisp:2064) at org.armedbear.lisp.LispThread.execute(LispThread.java:636) at org.armedbear.lisp.asdf_394.execute(asdf.lisp:1975) at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:92) at org.armedbear.lisp.asdf_396.execute(asdf.lisp:1975) at org.armedbear.lisp.LispThread.execute(LispThread.java:653) at org.armedbear.lisp.Primitives$pf_apply.execute(Primitives.java:2802) at org.armedbear.lisp.Symbol.execute(Symbol.java:801) at org.armedbear.lisp.LispThread.execute(LispThread.java:653) at org.armedbear.lisp.asdf_393.execute(asdf.lisp:1975) at org.armedbear.lisp.clos_310.execute(clos.lisp:2059) at org.armedbear.lisp.clos_287.execute(clos.lisp:1718) at org.armedbear.lisp.StandardGenericFunction.execute(StandardGenericFunction.java:138) at org.armedbear.lisp.Symbol.execute(Symbol.java:801) at org.armedbear.lisp.LispThread.execute(LispThread.java:653) at org.armedbear.lisp.asdf_448.execute(asdf.lisp:2105) at org.armedbear.lisp.compiler_pass2_374.execute(compiler-pass2.lisp:7474) at org.armedbear.lisp.LispThread.execute(LispThread.java:620) at org.armedbear.lisp.Java$pf_jrun_exception_protected.execute(Java.java:1228) at org.armedbear.lisp.Symbol.execute(Symbol.java:790) at org.armedbear.lisp.compiler_pass2_370.execute(compiler-pass2.lisp:7474) at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:101) at org.armedbear.lisp.Symbol.execute(Symbol.java:790) at org.armedbear.lisp.LispThread.execute(LispThread.java:636) at org.armedbear.lisp.asdf_447.execute(asdf.lisp:2105) at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:112) at org.armedbear.lisp.LispThread.execute(LispThread.java:653) at org.armedbear.lisp.Primitives$pf_apply.execute(Primitives.java:2802) at org.armedbear.lisp.Symbol.execute(Symbol.java:801) at org.armedbear.lisp.LispThread.execute(LispThread.java:653) at org.armedbear.lisp.asdf_446.execute(asdf.lisp:2105) at org.armedbear.lisp.clos_308.execute(clos.lisp:1950) at org.armedbear.lisp.LispThread.execute(LispThread.java:636) at org.armedbear.lisp.clos_297.execute(clos.lisp:1884) at org.armedbear.lisp.Symbol.execute(Symbol.java:801) at org.armedbear.lisp.clos_290.execute(clos.lisp:1718) at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:112) at org.armedbear.lisp.StandardGenericFunction.execute(StandardGenericFunction.java:138) at org.armedbear.lisp.LispThread.execute(LispThread.java:653) at org.armedbear.lisp.Lisp.funcall(Lisp.java:166) at org.armedbear.lisp.Primitives$pf_apply.execute(Primitives.java:2850) at org.armedbear.lisp.Primitive.execute(Primitive.java:148) at org.armedbear.lisp.Symbol.execute(Symbol.java:825) at org.armedbear.lisp.LispThread.execute(LispThread.java:688) at org.armedbear.lisp.asdf_462.execute(asdf.lisp:2171) at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:101) at org.armedbear.lisp.LispThread.execute(LispThread.java:636) at org.armedbear.lisp.Lisp.evalCall(Lisp.java:540) at org.armedbear.lisp.Lisp.eval(Lisp.java:505) at org.armedbear.lisp.Primitives$pf__eval.execute(Primitives.java:345) at org.armedbear.lisp.LispThread.execute(LispThread.java:636) at org.armedbear.lisp.Lisp.evalCall(Lisp.java:540) at org.armedbear.lisp.Lisp.eval(Lisp.java:505) at org.armedbear.lisp.Lisp.progn(Lisp.java:674) at org.armedbear.lisp.Primitives$sf_block.execute(Primitives.java:3741) at org.armedbear.lisp.Lisp.eval(Lisp.java:495) at org.armedbear.lisp.Lisp.progn(Lisp.java:674) at org.armedbear.lisp.Closure.bindParametersAndExecute(Closure.java:451) at org.armedbear.lisp.Closure.execute(Closure.java:484) at org.armedbear.lisp.LispThread.execute(LispThread.java:636) at org.armedbear.lisp.Lisp$1.execute(Lisp.java:276) at org.armedbear.lisp.Symbol.execute(Symbol.java:790) at org.armedbear.lisp.LispThread.execute(LispThread.java:636) at org.armedbear.lisp.top_level_50.execute(top-level.lisp:415) at org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:92) at org.armedbear.lisp.Symbol.execute(Symbol.java:780) at org.armedbear.lisp.LispThread.execute(LispThread.java:620) at org.armedbear.lisp.top_level_51.execute(top-level.lisp:423) at org.armedbear.lisp.LispThread.execute(LispThread.java:620) at org.armedbear.lisp.Interpreter.run(Interpreter.java:353) at org.armedbear.lisp.Main$1.run(Main.java:48) at java.lang.Thread.run(Thread.java:680) #<THREAD "interpreter" {2FEE9422}>: Debugger invoked on condition of type ERROR Caught java.lang.VerifyError: (class: org/armedbear/lisp/ASDF_TMP_snmp_get_1, method: execute signature: (Lorg/armedbear/lisp/LispObject;Lorg/armedbear/lisp/LispObject;Lorg/armedbear/lisp/LispObject;Lorg/armedbear/lisp/LispObject;)Lorg/armedbear/lisp/LispObject;) Register 4 contains wrong type. Restarts: 0: TOP-LEVEL Return to top level. [1] CL-USER(10): :bt 16
0: (SYSTEM:BACKTRACE) 1: (INVOKE-DEBUGGER #<ERROR {27E33378}>) 2: org.armedbear.lisp.Lisp.error(Lisp.java:373) 3: org.armedbear.lisp.Lisp$1.execute(Lisp.java:305) 4: org.armedbear.lisp.Symbol.execute(Symbol.java:790) 5: org.armedbear.lisp.LispThread.execute(LispThread.java:636) 6: org.armedbear.lisp.top_level_50.execute(top-level.lisp:415) 7: org.armedbear.lisp.CompiledClosure.execute(CompiledClosure.java:92) 8: org.armedbear.lisp.Symbol.execute(Symbol.java:780) 9: org.armedbear.lisp.LispThread.execute(LispThread.java:620) 10: org.armedbear.lisp.top_level_51.execute(top-level.lisp:423) 11: org.armedbear.lisp.LispThread.execute(LispThread.java:620) 12: org.armedbear.lisp.Interpreter.run(Interpreter.java:353) 13: org.armedbear.lisp.Main$1.run(Main.java:48) 14: java.lang.Thread.run(Thread.java:680) 15: (APPLY #<FUNCTION {1785F0D}> (#<ASDF:COMPILE-OP NIL {5A84F3C}> #<ASDF:CL-SOURCE-FILE "snmp" "snmp-get">))
Do you have any idea about this? i.e. What's "Register 4"?
It's a JVM register, used to hold some intermediate result. The compiler is producing incorrect code: probably it doesn't derive the right type for the atomic-incf form. I see that
(THREADS:WITH-MUTEX (PORTABLE-THREADS::*ATOMIC-OPERATION-LOCK*) (INCF REQUEST-ID-COUNTER 1))
expands to
(LET ((#:G3433 PORTABLE-THREADS::*ATOMIC-OPERATION-LOCK*)) (WHEN (THREADS:GET-MUTEX #:G3433) (UNWIND-PROTECT (PROGN (INCF REQUEST-ID-COUNTER 1)) (THREADS:RELEASE-MUTEX #:G3433))))
Maybe there's a problem with the derived type of unwind-protect forms, but I don't have the source at hand now to check.
Alessio