Hello,
Consider the following java snippet:
public static void main(String[] args) throws Throwable { Interpreter interpreter = Interpreter.createInstance(); interpreter.eval("(compile nil '(lambda () 0.1))"); }
It fails with error:
Debugger invoked on condition of type UNDEFINED-FUNCTION: The function JVM::%FLOAT-BITS is undefined.
In the REPL (compile nil '(lambda () 0.1)) works normally.
I do not understand what is the difference in environment between ABCL REPL and embedded ABCL, but the following trivial patch fixes the problem in for the embedded case.
Index: src/org/armedbear/lisp/compiler-pass2.lisp =================================================================== --- src/org/armedbear/lisp/compiler-pass2.lisp (revision 12050) +++ src/org/armedbear/lisp/compiler-pass2.lisp (working copy) @@ -132,7 +132,7 @@ (defknown pool-float (single-float) (integer 1 65535)) (defun pool-float (n) (declare (optimize speed)) - (pool-get (list 4 (%float-bits n)))) + (pool-get (list 4 (sys::%float-bits n))))
(defun pool-long/double (entry) (let* ((ht *pool-entries*) @@ -163,7 +163,7 @@ (defknown pool-double (double-float) (integer 1 65535)) (defun pool-double (n) (declare (optimize speed)) - (let* ((n (%float-bits n)) + (let* ((n (sys::%float-bits n)) (entry (list 6 (logand (ash n -32) #xffffffff) (logand n #xffffffff))))
Best regards, - Anton
Hello,
Please ignore the previous message. Looks like I just had somewhat broken ABCL. Freshly built ABCL (without my fix) works OK.
Best regards, - Anton
2009/7/18 Anton Vodonosov avodonosov@gmail.com:
Hello,
Consider the following java snippet:
public static void main(String[] args) throws Throwable { Interpreter interpreter = Interpreter.createInstance(); interpreter.eval("(compile nil '(lambda () 0.1))"); }
It fails with error:
Debugger invoked on condition of type UNDEFINED-FUNCTION: The function JVM::%FLOAT-BITS is undefined.
In the REPL (compile nil '(lambda () 0.1)) works normally.
I do not understand what is the difference in environment between ABCL REPL and embedded ABCL, but the following trivial patch fixes the problem in for the embedded case.
Index: src/org/armedbear/lisp/compiler-pass2.lisp
--- src/org/armedbear/lisp/compiler-pass2.lisp (revision 12050) +++ src/org/armedbear/lisp/compiler-pass2.lisp (working copy) @@ -132,7 +132,7 @@ (defknown pool-float (single-float) (integer 1 65535)) (defun pool-float (n) (declare (optimize speed))
- (pool-get (list 4 (%float-bits n))))
- (pool-get (list 4 (sys::%float-bits n))))
(defun pool-long/double (entry) (let* ((ht *pool-entries*) @@ -163,7 +163,7 @@ (defknown pool-double (double-float) (integer 1 65535)) (defun pool-double (n) (declare (optimize speed))
- (let* ((n (%float-bits n))
- (let* ((n (sys::%float-bits n))
(entry (list 6 (logand (ash n -32) #xffffffff) (logand n #xffffffff))))
Best regards,
- Anton
armedbear-devel@common-lisp.net