From 51f2bbd74bd1a4eea3f38572d97f4f4f1a355e21 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg Date: Sat, 26 Sep 2009 01:39:48 -0500 Subject: [PATCH] Completing slot and set-slot changes on x86 --- basis/compiler/cfg/hats/hats.factor | 8 +++++--- basis/compiler/cfg/intrinsics/misc/misc.factor | 2 +- basis/compiler/cfg/intrinsics/slots/slots.factor | 8 ++++---- basis/cpu/architecture/architecture.factor | 4 ++-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/basis/compiler/cfg/hats/hats.factor b/basis/compiler/cfg/hats/hats.factor index 5a42ad2c99..36fa631050 100644 --- a/basis/compiler/cfg/hats/hats.factor +++ b/basis/compiler/cfg/hats/hats.factor @@ -63,9 +63,11 @@ insn-classes get [ : ^^allot-byte-array ( n -- dst ) 2 cells + byte-array ^^allot ; -: ^^offset>slot ( tag slot -- vreg' ) - cell 4 = [ 1 ^^shr-imm ] [ any-rep ^^copy ] if - swap ^^sub-imm ; +: ^^offset>slot ( slot -- vreg' ) + cell 4 = [ 1 ^^shr-imm ] [ any-rep ^^copy ] if ; + +: ^^tag-offset>slot ( slot tag -- vreg' ) + [ ^^offset>slot ] dip ^^sub-imm ; : ^^tag-fixnum ( src -- dst ) tag-bits get ^^shl-imm ; diff --git a/basis/compiler/cfg/intrinsics/misc/misc.factor b/basis/compiler/cfg/intrinsics/misc/misc.factor index f9f3488773..ce005e8353 100644 --- a/basis/compiler/cfg/intrinsics/misc/misc.factor +++ b/basis/compiler/cfg/intrinsics/misc/misc.factor @@ -12,5 +12,5 @@ IN: compiler.cfg.intrinsics.misc : emit-getenv ( node -- ) "userenv" ^^vm-field-ptr swap node-input-infos first literal>> - [ ds-drop 0 ^^slot-imm ] [ ds-pop ^^offset>slot 0 ^^slot ] if* + [ ds-drop 0 ^^slot-imm ] [ ds-pop ^^offset>slot ^^slot ] if* ds-push ; diff --git a/basis/compiler/cfg/intrinsics/slots/slots.factor b/basis/compiler/cfg/intrinsics/slots/slots.factor index 93de5188af..07202ae60b 100644 --- a/basis/compiler/cfg/intrinsics/slots/slots.factor +++ b/basis/compiler/cfg/intrinsics/slots/slots.factor @@ -9,8 +9,8 @@ IN: compiler.cfg.intrinsics.slots : value-tag ( info -- n ) class>> class-tag ; inline : (emit-slot) ( infos -- dst ) - [ 2inputs ^^offset>slot ] [ first value-tag ] bi* - ^^sub-imm ^^slot ; + [ 2inputs ] [ first value-tag ] bi* + ^^tag-offset>slot ^^slot ; : (emit-slot-imm) ( infos -- dst ) ds-drop @@ -28,8 +28,8 @@ IN: compiler.cfg.intrinsics.slots ] [ drop emit-primitive ] if ; : (emit-set-slot) ( infos -- obj-reg ) - [ 3inputs ^^offset>slot ] [ second value-tag ] bi* - ^^sub-imm over [ ##set-slot ] dip ; + [ 3inputs ] [ second value-tag ] bi* + ^^tag-offset>slot over [ ##set-slot ] dip ; : (emit-set-slot-imm) ( infos -- obj-reg ) ds-drop diff --git a/basis/cpu/architecture/architecture.factor b/basis/cpu/architecture/architecture.factor index fbec9f697a..6b41613c00 100644 --- a/basis/cpu/architecture/architecture.factor +++ b/basis/cpu/architecture/architecture.factor @@ -102,9 +102,9 @@ HOOK: %return cpu ( -- ) HOOK: %dispatch cpu ( src temp -- ) -HOOK: %slot cpu ( dst obj slot tag temp -- ) +HOOK: %slot cpu ( dst obj slot -- ) HOOK: %slot-imm cpu ( dst obj slot tag -- ) -HOOK: %set-slot cpu ( src obj slot tag temp -- ) +HOOK: %set-slot cpu ( src obj slot -- ) HOOK: %set-slot-imm cpu ( src obj slot tag -- ) HOOK: %string-nth cpu ( dst obj index temp -- )