is there any progress on this issue? Is there any help I can offer in solving this? Part of an application I'm building relies on such a nested loop, so I'm quite interested in fixing this issue.
Regards,
Mark
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I looked at the compiled code last night and it looks pretty strange.
One thing you can do that would help save me time is to
define a function containing the nested dotimes statements
and then run (grindef) on the function and send me the
output.
Thanks,
Mike Hewett
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I tried to execute the following code in Jatha according to your request:
(defun loop-test ()
(setq sum 0)
(dotimes (i 3)
(dotimes (j 3)
(setq sum (+ sum 1))
)
)
sum
)
(grindef loop-test)
but all I get is an exception "The variable LOOP-TEST is unbound.". If i run it with
(grindef #'loop-test)
I get the exception "java.lang.ClassCastException: org.jatha.dynatype.StandardLispSymbol" in org.jatha.compile.LispPrimitive.printCode(LispPrimitive.java:115)
Further instructions would be appreciated.
Regards,
Mark
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I fixed grindef temporarily - have to check the fix against all functions.
Here is the compiled output. I will be staring at it this afternoon.
If you see anything, let me know. I tentatively suspect the compiler-generated
variable *AND-DUMMY-VAR* or some similar variable does not work
correctly if used more than once. It may mean just a simple compiler
change to make each *AND_DUMMY-VAR* unique. I'll run some tests to
verify.
FYI, the Javadoc comments in org.jatha.machine.opLD and sibling classes
describe what each machine code instruction does.
I'm making progress on this. The dotimes code is
being compiled incorrectly, even for a single dotimes
and especially for a nested dotimes. I have figured out where
it is happening, but not why it is happening. I will
continue working on it.
Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thank you very much. I have had a look at the compiler output, but my compiler creation classes are quite some time back and I haven't made much progress. If I come up with anything, I'll let you know.
Mark
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=409118
Originator: NO
Thanks, I'll check into the problem.
Mike
Logged In: YES
user_id=586735
Originator: YES
Hi,
is there any progress on this issue? Is there any help I can offer in solving this? Part of an application I'm building relies on such a nested loop, so I'm quite interested in fixing this issue.
Regards,
Mark
Logged In: YES
user_id=409118
Originator: NO
I looked at the compiled code last night and it looks pretty strange.
One thing you can do that would help save me time is to
define a function containing the nested dotimes statements
and then run (grindef) on the function and send me the
output.
Thanks,
Mike Hewett
Logged In: YES
user_id=586735
Originator: YES
I tried to execute the following code in Jatha according to your request:
(defun loop-test ()
(setq sum 0)
(dotimes (i 3)
(dotimes (j 3)
(setq sum (+ sum 1))
)
)
sum
)
(grindef loop-test)
but all I get is an exception "The variable LOOP-TEST is unbound.". If i run it with
(grindef #'loop-test)
I get the exception "java.lang.ClassCastException: org.jatha.dynatype.StandardLispSymbol" in org.jatha.compile.LispPrimitive.printCode(LispPrimitive.java:115)
Further instructions would be appreciated.
Regards,
Mark
Logged In: YES
user_id=409118
Originator: NO
Well, bug upon bug...
I fixed grindef temporarily - have to check the fix against all functions.
Here is the compiled output. I will be staring at it this afternoon.
If you see anything, let me know. I tentatively suspect the compiler-generated
variable *AND-DUMMY-VAR* or some similar variable does not work
correctly if used more than once. It may mean just a simple compiler
change to make each *AND_DUMMY-VAR* unique. I'll run some tests to
verify.
FYI, the Javadoc comments in org.jatha.machine.opLD and sibling classes
describe what each machine code instruction does.
Mike
LDC SUM
LDC 0
SETQ
LDC 0
LDC 3
CONST_NIL
CONS
CONS
LDF
LDC (SECD.CONST_NIL SECD.LD (1 . 1) SECD.LD (1 . 2) SECD.LIS 2 #<function < 2...> #<function NOT 1> SECD.SP_BIND *AND-DUMMY-VAR* SECD.LDF (SECD.LD_GLOBAL *AND-DUMMY-VAR* SECD.TEST (SECD.CONST_NIL SECD.LIS 1 SECD.LDC NIL #<function RETURN-FROM 1 2> SECD.RTN) SECD.CONST_NIL SECD.RTN) SECD.AP SECD.SP_UNBIND *AND-DUMMY-VAR* SECD.LDC 0 SECD.LDC 3 SECD.CONST_NIL #<function CONS 2> #<function CONS 2> SECD.LDF (SECD.LDC (SECD.CONST_NIL SECD.LD (1 . 1) SECD.LD (1 . 2) SECD.LIS 2 #<function < 2...> #<function NOT 1> SECD.SP_BIND *AND-DUMMY-VAR* SECD.LDF (SECD.LD_GLOBAL *AND-DUMMY-VAR* SECD.TEST (SECD.CONST_NIL SECD.LIS 1 SECD.LDC NIL #<function RETURN-FROM 1 2> SECD.RTN) SECD.CONST_NIL SECD.RTN) SECD.AP SECD.SP_UNBIND *AND-DUMMY-VAR* SECD.LDC SUM SECD.LD_GLOBAL SUM SECD.LDC 1 SECD.LIS 2 #<function + 0...> #<function SETQ 2> SECD.LDC (1 . 1) SECD.LD (1 . 1) #<function 1+ 1> #<function SETQ 2> SECD.LDC (#:T1) #<function GO 1> #<function TAGBODY 1...> SECD.BLK NIL SECD.RTN) SECD.SP_BIND #:T1 SECD.LDC (SECD.CONST_NIL SECD.LD (1 . 1) SECD.LD (1 . 2) SECD.LIS 2 #<function < 2...> #<function NOT 1> SECD.SP_BIND *AND-DUMMY-VAR* SECD.LDF (SECD.LD_GLOBAL *AND-DUMMY-VAR* SECD.TEST (SECD.CONST_NIL SECD.LIS 1 SECD.LDC NIL #<function RETURN-FROM 1 2> SECD.RTN) SECD.CONST_NIL SECD.RTN) SECD.AP SECD.SP_UNBIND *AND-DUMMY-VAR* SECD.LDC SUM SECD.LD_GLOBAL SUM SECD.LDC 1 SECD.LIS 2 #<function + 0...> #<function SETQ 2> SECD.LDC (1 . 1) SECD.LD (1 . 1) #<function 1+ 1> #<function SETQ 2> SECD.LDC (#:T1) #<function GO 1> #<function TAGBODY 1...> SECD.BLK NIL SECD.RTN) SECD.SP_BIND #:T2 SECD.TAG_B SECD.CONST_NIL SECD.LD (1 . 1) SECD.LD (1 . 2) SECD.LIS 2 #<function < 2...> #<function NOT 1> SECD.SP_BIND *AND-DUMMY-VAR* SECD.LDF (SECD.LD_GLOBAL *AND-DUMMY-VAR* SECD.TEST (SECD.CONST_NIL SECD.LIS 1 SECD.LDC NIL #<function RETURN-FROM 1 2> SECD.RTN) SECD.CONST_NIL SECD.RTN) SECD.AP SECD.SP_UNBIND *AND-DUMMY-VAR* SECD.LDC SUM SECD.LD_GLOBAL SUM SECD.LDC 1 SECD.LIS 2 #<function + 0...> #<function SETQ 2> SECD.LDC (1 . 1) SECD.LD (1 . 1) #<function 1+ 1> #<function SETQ 2> SECD.LDC (#:T2) #<function GO 1> #<function TAGBODY 1...> SECD.TAG_E SECD.SP_UNBIND #:T1 SECD.SP_UNBIND #:T2 SECD.BLK NIL SECD.RTN) SECD.AP SECD.LDC (1 . 1) SECD.LD (1 . 1) #<function 1+ 1> #<function SETQ 2> SECD.LDC (#:T0) #<function GO 1> #<function TAGBODY 1...> SECD.BLK NIL SECD.RTN)
SP_BIND #:T0
LDC (SECD.CONST_NIL SECD.LD (1 . 1) SECD.LD (1 . 2) SECD.LIS 2 #<function < 2...> #<function NOT 1> SECD.SP_BIND *AND-DUMMY-VAR* SECD.LDF (SECD.LD_GLOBAL *AND-DUMMY-VAR* SECD.TEST (SECD.CONST_NIL SECD.LIS 1 SECD.LDC NIL #<function RETURN-FROM 1 2> SECD.RTN) SECD.CONST_NIL SECD.RTN) SECD.AP SECD.SP_UNBIND *AND-DUMMY-VAR* SECD.LDC 0 SECD.LDC 3 SECD.CONST_NIL #<function CONS 2> #<function CONS 2> SECD.LDF (SECD.LDC (SECD.CONST_NIL SECD.LD (1 . 1) SECD.LD (1 . 2) SECD.LIS 2 #<function < 2...> #<function NOT 1> SECD.SP_BIND *AND-DUMMY-VAR* SECD.LDF (SECD.LD_GLOBAL *AND-DUMMY-VAR* SECD.TEST (SECD.CONST_NIL SECD.LIS 1 SECD.LDC NIL #<function RETURN-FROM 1 2> SECD.RTN) SECD.CONST_NIL SECD.RTN) SECD.AP SECD.SP_UNBIND *AND-DUMMY-VAR* SECD.LDC SUM SECD.LD_GLOBAL SUM SECD.LDC 1 SECD.LIS 2 #<function + 0...> #<function SETQ 2> SECD.LDC (1 . 1) SECD.LD (1 . 1) #<function 1+ 1> #<function SETQ 2> SECD.LDC (#:T1) #<function GO 1> #<function TAGBODY 1...> SECD.BLK NIL SECD.RTN) SECD.SP_BIND #:T1 SECD.LDC (SECD.CONST_NIL SECD.LD (1 . 1) SECD.LD (1 . 2) SECD.LIS 2 #<function < 2...> #<function NOT 1> SECD.SP_BIND *AND-DUMMY-VAR* SECD.LDF (SECD.LD_GLOBAL *AND-DUMMY-VAR* SECD.TEST (SECD.CONST_NIL SECD.LIS 1 SECD.LDC NIL #<function RETURN-FROM 1 2> SECD.RTN) SECD.CONST_NIL SECD.RTN) SECD.AP SECD.SP_UNBIND *AND-DUMMY-VAR* SECD.LDC SUM SECD.LD_GLOBAL SUM SECD.LDC 1 SECD.LIS 2 #<function + 0...> #<function SETQ 2> SECD.LDC (1 . 1) SECD.LD (1 . 1) #<function 1+ 1> #<function SETQ 2> SECD.LDC (#:T1) #<function GO 1> #<function TAGBODY 1...> SECD.BLK NIL SECD.RTN) SECD.SP_BIND #:T2 SECD.TAG_B SECD.CONST_NIL SECD.LD (1 . 1) SECD.LD (1 . 2) SECD.LIS 2 #<function < 2...> #<function NOT 1> SECD.SP_BIND *AND-DUMMY-VAR* SECD.LDF (SECD.LD_GLOBAL *AND-DUMMY-VAR* SECD.TEST (SECD.CONST_NIL SECD.LIS 1 SECD.LDC NIL #<function RETURN-FROM 1 2> SECD.RTN) SECD.CONST_NIL SECD.RTN) SECD.AP SECD.SP_UNBIND *AND-DUMMY-VAR* SECD.LDC SUM SECD.LD_GLOBAL SUM SECD.LDC 1 SECD.LIS 2 #<function + 0...> #<function SETQ 2> SECD.LDC (1 . 1) SECD.LD (1 . 1) #<function 1+ 1> #<function SETQ 2> SECD.LDC (#:T2) #<function GO 1> #<function TAGBODY 1...> SECD.TAG_E SECD.SP_UNBIND #:T1 SECD.SP_UNBIND #:T2 SECD.BLK NIL SECD.RTN) SECD.AP SECD.LDC (1 . 1) SECD.LD (1 . 1) #<function 1+ 1> #<function SETQ 2> SECD.LDC (#:T0) #<function GO 1> #<function TAGBODY 1...> SECD.BLK NIL SECD.RTN)
SP_BIND #:T3
TAG_B
CONST_NIL
LD (1 . 1)
LD (1 . 2)
LIS 2
<
NOT
SP_BIND *AND-DUMMY-VAR*
LDF
LD_GLOBAL *AND-DUMMY-VAR*
TEST
CONST_NIL
LIS 1
LDC NIL
RETURN-FROM
RTN
CONST_NIL
RTN
AP
SP_UNBIND *AND-DUMMY-VAR*
LDC 0
LDC 3
CONST_NIL
CONS
CONS
LDF
LDC (SECD.CONST_NIL SECD.LD (1 . 1) SECD.LD (1 . 2) SECD.LIS 2 #<function < 2...> #<function NOT 1> SECD.SP_BIND *AND-DUMMY-VAR* SECD.LDF (SECD.LD_GLOBAL *AND-DUMMY-VAR* SECD.TEST (SECD.CONST_NIL SECD.LIS 1 SECD.LDC NIL #<function RETURN-FROM 1 2> SECD.RTN) SECD.CONST_NIL SECD.RTN) SECD.AP SECD.SP_UNBIND *AND-DUMMY-VAR* SECD.LDC SUM SECD.LD_GLOBAL SUM SECD.LDC 1 SECD.LIS 2 #<function + 0...> #<function SETQ 2> SECD.LDC (1 . 1) SECD.LD (1 . 1) #<function 1+ 1> #<function SETQ 2> SECD.LDC (#:T4) #<function GO 1> #<function TAGBODY 1...> SECD.BLK NIL SECD.RTN)
SP_BIND #:T5
LDC (SECD.CONST_NIL SECD.LD (1 . 1) SECD.LD (1 . 2) SECD.LIS 2 #<function < 2...> #<function NOT 1> SECD.SP_BIND *AND-DUMMY-VAR* SECD.LDF (SECD.LD_GLOBAL *AND-DUMMY-VAR* SECD.TEST (SECD.CONST_NIL SECD.LIS 1 SECD.LDC NIL #<function RETURN-FROM 1 2> SECD.RTN) SECD.CONST_NIL SECD.RTN) SECD.AP SECD.SP_UNBIND *AND-DUMMY-VAR* SECD.LDC SUM SECD.LD_GLOBAL SUM SECD.LDC 1 SECD.LIS 2 #<function + 0...> #<function SETQ 2> SECD.LDC (1 . 1) SECD.LD (1 . 1) #<function 1+ 1> #<function SETQ 2> SECD.LDC (#:T4) #<function GO 1> #<function TAGBODY 1...> SECD.BLK NIL SECD.RTN)
SP_BIND #:T4
TAG_B
CONST_NIL
LD (1 . 1)
LD (1 . 2)
LIS 2
<
NOT
SP_BIND *AND-DUMMY-VAR*
LDF
LD_GLOBAL *AND-DUMMY-VAR*
TEST
CONST_NIL
LIS 1
LDC NIL
RETURN-FROM
RTN
CONST_NIL
RTN
AP
SP_UNBIND *AND-DUMMY-VAR*
LDC SUM
LD_GLOBAL SUM
LDC 1
LIS 2
+
SETQ
LDC (1 . 1)
LD (1 . 1)
1+
SETQ
LDC (#:T5)
GO
TAGBODY
TAG_E
SP_UNBIND #:T5
SP_UNBIND #:T4
BLK NIL
RTN
AP
LDC (1 . 1)
LD (1 . 1)
1+
SETQ
LDC (#:T3)
GO
TAGBODY
TAG_E
SP_UNBIND #:T0
SP_UNBIND #:T3
BLK NIL
RTN
AP
BLK LOOP-TEST
RTN
Logged In: YES
user_id=409118
Originator: NO
Mark,
I'm making progress on this. The dotimes code is
being compiled incorrectly, even for a single dotimes
and especially for a nested dotimes. I have figured out where
it is happening, but not why it is happening. I will
continue working on it.
Mike
Logged In: YES
user_id=586735
Originator: YES
Mike,
thank you very much. I have had a look at the compiler output, but my compiler creation classes are quite some time back and I haven't made much progress. If I come up with anything, I'll let you know.
Mark