Commit 1ba1dc85 authored by Erick Gallesio's avatar Erick Gallesio

adding a peehole optim

parent a977c5f9
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 14-Mar-2001 13:49 (eg)
;;;; Last file update: 22-Feb-2007 18:39 (eg)
;;;; Last file update: 22-Feb-2007 19:51 (eg)
;;;;
;;;
......@@ -187,7 +187,7 @@
(PUSH-GREF-TAIL-INV 2) ;; PUSH + GLOBAL-REF + TAIL-INVOKE
(PUSH-UGREF-TAIL-INV 2) ;; Never produced by the compiler
(UNUSED-20 0)
(DEEP-LOC-REF-PUSH 1) ;; peephole: DEEP-LOCAL-SET + PUSH
(UNUSED-19 0)
(UNUSED-18 0)
(UNUSED-17 0)
......
......@@ -21,7 +21,7 @@
;;;;
;;;; Author: Erick Gallesio [eg@unice.fr]
;;;; Creation date: 17-Mar-2001 20:32 (eg)
;;;; Last file update: 22-Feb-2007 18:31 (eg)
;;;; Last file update: 22-Feb-2007 20:06 (eg)
;;;;
; ======================================================================
......@@ -99,6 +99,11 @@
((and (eq? i1 'CONSTANT) (eq? i2 'PUSH))
(replace-2-instr code (list 'CONSTANT-PUSH (this-arg1 code))))
;; [DEEP-LOCAL-REF, PUSH] => DEEP-LOC-REF-PUSH
((and (eq? i1 'DEEP-LOCAL-REF) (eq? i2 'PUSH))
(replace-2-instr code (list 'DEEP-LOC-REF-PUSH (this-arg1 code))))
;; [GOTO x], ... ,x: GOTO y => GOTO y
;; [GOTO x], ... ,x: RETURN => RETURN
((eq? i1 'GOTO)
......
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -119,7 +119,7 @@
# define PUSH_UGREF_INVOKE 114
# define PUSH_GREF_TAIL_INV 115
# define PUSH_UGREF_TAIL_INV 116
# define UNUSED_20 117
# define DEEP_LOC_REF_PUSH 117
# define UNUSED_19 118
# define UNUSED_18 119
# define UNUSED_17 120
......@@ -266,7 +266,7 @@ static void *jump_table[] = {
&&lab_PUSH_UGREF_INVOKE ,
&&lab_PUSH_GREF_TAIL_INV ,
&&lab_PUSH_UGREF_TAIL_INV ,
&&lab_UNUSED_20 ,
&&lab_DEEP_LOC_REF_PUSH ,
&&lab_UNUSED_19 ,
&&lab_UNUSED_18 ,
&&lab_UNUSED_17 ,
......@@ -413,7 +413,7 @@ static char *name_table[] = {
"PUSH_UGREF_INVOKE ",
"PUSH_GREF_TAIL_INV ",
"PUSH_UGREF_TAIL_INV ",
"UNUSED_20 ",
"DEEP_LOC_REF_PUSH ",
"UNUSED_19 ",
"UNUSED_18 ",
"UNUSED_17 ",
......
......@@ -21,7 +21,7 @@
*
* Author: Erick Gallesio [eg@unice.fr]
* Creation date: 1-Mar-2000 19:51 (eg)
* Last file update: 3-Feb-2007 19:19 (eg)
* Last file update: 22-Feb-2007 20:12 (eg)
*/
// INLINER values
......@@ -992,6 +992,19 @@ CASE(DEEP_LOCAL_REF) {
vm->val = FRAME_LOCAL(e, SECOND_BYTE(info));
NEXT1;
}
CASE(DEEP_LOC_REF_PUSH) {
int level, info = fetch_next();
SCM e = vm->env;
/* Go down in the dynamic environment */
for (level = FIRST_BYTE(info); level; level--)
e = (SCM) FRAME_NEXT(e);
push(vm->val = FRAME_LOCAL(e, SECOND_BYTE(info)));
NEXT1;
}
CASE(LOCAL_REF0_PUSH) {push(FRAME_LOCAL(vm->env, 0)); NEXT1;}
CASE(LOCAL_REF1_PUSH) {push(FRAME_LOCAL(vm->env, 1)); NEXT1;}
......@@ -1272,7 +1285,6 @@ CASE(UNUSED_16)
CASE(UNUSED_17)
CASE(UNUSED_18)
CASE(UNUSED_19)
CASE(UNUSED_20)
{
;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment