From 36f31e784b665ba1a2b9b1dcb054f18085b482da Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 12 Jan 2008 20:50:22 -0800 Subject: [PATCH] Fixing x86.64 port --- core/cpu/x86/64/64.factor | 6 ++-- core/cpu/x86/intrinsics/intrinsics.factor | 37 +++++++---------------- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/core/cpu/x86/64/64.factor b/core/cpu/x86/64/64.factor index 08952792f6..745b6efd2d 100755 --- a/core/cpu/x86/64/64.factor +++ b/core/cpu/x86/64/64.factor @@ -173,8 +173,8 @@ USE: cpu.x86.intrinsics T{ x86-backend f 8 } compiler-backend set-global ! The ABI for passing structs by value is pretty messed up -"void*" c-type clone "__stack_value" define-primitive-type -T{ stack-params } "__stack_value" c-type set-c-type-reg-class +<< "void*" c-type clone "__stack_value" define-primitive-type +T{ stack-params } "__stack_value" c-type set-c-type-reg-class >> : struct-types&offset ( struct-type -- pairs ) struct-type-fields [ @@ -200,5 +200,3 @@ M: struct-type flatten-value-type ( type -- seq ) "void*" "double" ? c-type , ] each ] if ; - -12 profiler-prologue set-global diff --git a/core/cpu/x86/intrinsics/intrinsics.factor b/core/cpu/x86/intrinsics/intrinsics.factor index 70de7a99ac..0e9d66498d 100755 --- a/core/cpu/x86/intrinsics/intrinsics.factor +++ b/core/cpu/x86/intrinsics/intrinsics.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2005, 2006 Slava Pestov. +! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: alien arrays cpu.x86.assembler cpu.x86.allot cpu.x86.architecture cpu.architecture kernel kernel.private math @@ -240,34 +240,19 @@ IN: cpu.x86.intrinsics } } define-intrinsics -\ fixnum-shift-fast { - { - [ - "y" operand NEG - "y" operand %untag-fixnum - "x" operand "y" operand SAR - ! Mask off low bits - "x" operand %untag - ] H{ - { +input+ { { f "x" } { f "y" } } } - { +output+ { "x" } } - { +clobber+ { "y" } } - } - } { - [ - "x" operand "y" get neg SAR - ! Mask off low bits - "x" operand %untag - ] H{ - { +input+ { { f "x" } { [ ] "y" } } } - { +output+ { "x" } } - } - } -} define-intrinsics - : %untag-fixnums ( seq -- ) [ %untag-fixnum ] unique-operands ; +\ fixnum-shift-fast [ + "x" operand "y" get + dup 0 < [ neg SAR ] [ SHL ] if + ! Mask off low bits + "x" operand %untag +] H{ + { +input+ { { f "x" } { [ ] "y" } } } + { +output+ { "x" } } +} define-intrinsic + : overflow-check ( word -- ) "end" define-label "z" operand "x" operand MOV