From 10464e7e4e0158a97c3df037d9e32656c5b3c793 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Mon, 24 Aug 2015 22:44:30 +0200 Subject: [PATCH] VM: LEAF_FRAME_SIZE is 16 bytes on all platforms so we can simplify it --- basis/bootstrap/assembler/x86.32.factor | 1 - basis/bootstrap/assembler/x86.64.unix.factor | 1 - basis/bootstrap/assembler/x86.64.windows.factor | 1 - core/layouts/layouts.factor | 2 ++ vm/cpu-x86.32.hpp | 5 ++--- vm/layouts.hpp | 3 +++ vm/os-linux-x86.64.hpp | 5 ++--- vm/os-macosx-x86.64.hpp | 5 ++--- vm/os-windows.64.hpp | 5 ++--- 9 files changed, 13 insertions(+), 15 deletions(-) diff --git a/basis/bootstrap/assembler/x86.32.factor b/basis/bootstrap/assembler/x86.32.factor index 5f24bb5efc..9a08731cb0 100644 --- a/basis/bootstrap/assembler/x86.32.factor +++ b/basis/bootstrap/assembler/x86.32.factor @@ -8,7 +8,6 @@ IN: bootstrap.x86 4 \ cell set -: leaf-stack-frame-size ( -- n ) 4 bootstrap-cells ; : signal-handler-stack-frame-size ( -- n ) 12 bootstrap-cells ; : stack-frame-size ( -- n ) 8 bootstrap-cells ; : shift-arg ( -- reg ) ECX ; diff --git a/basis/bootstrap/assembler/x86.64.unix.factor b/basis/bootstrap/assembler/x86.64.unix.factor index 2ae65d2029..dcf05b1f4c 100644 --- a/basis/bootstrap/assembler/x86.64.unix.factor +++ b/basis/bootstrap/assembler/x86.64.unix.factor @@ -4,7 +4,6 @@ USING: cpu.x86.assembler.operands kernel layouts parser sequences ; IN: bootstrap.x86 -: leaf-stack-frame-size ( -- n ) 2 bootstrap-cells ; : signal-handler-stack-frame-size ( -- n ) 20 bootstrap-cells ; : stack-frame-size ( -- n ) 4 bootstrap-cells ; : nv-regs ( -- seq ) { RBX R12 R13 R14 R15 } ; diff --git a/basis/bootstrap/assembler/x86.64.windows.factor b/basis/bootstrap/assembler/x86.64.windows.factor index c353109211..960a7724a1 100644 --- a/basis/bootstrap/assembler/x86.64.windows.factor +++ b/basis/bootstrap/assembler/x86.64.windows.factor @@ -6,7 +6,6 @@ IN: bootstrap.x86 DEFER: stack-reg -: leaf-stack-frame-size ( -- n ) 2 bootstrap-cells ; : signal-handler-stack-frame-size ( -- n ) 24 bootstrap-cells ; : stack-frame-size ( -- n ) 8 bootstrap-cells ; : nv-regs ( -- seq ) { RBX RSI RDI R12 R13 R14 R15 } ; diff --git a/core/layouts/layouts.factor b/core/layouts/layouts.factor index 2e2b1fe680..2c5c91f6ef 100644 --- a/core/layouts/layouts.factor +++ b/core/layouts/layouts.factor @@ -32,6 +32,8 @@ SYMBOL: header-bits : hashcode-shift ( -- n ) tag-bits get header-bits get + ; +: leaf-stack-frame-size ( -- n ) 16 ; + ! We do this in its own compilation unit so that they can be ! folded below << diff --git a/vm/cpu-x86.32.hpp b/vm/cpu-x86.32.hpp index 38dcb7700a..0feaa1b03e 100644 --- a/vm/cpu-x86.32.hpp +++ b/vm/cpu-x86.32.hpp @@ -2,9 +2,8 @@ namespace factor { #define FACTOR_CPU_STRING "x86.32" -/* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size, -and stack-frame-size constants in bootstrap/assembler/x86.32.factor */ -static const unsigned LEAF_FRAME_SIZE = 16; +/* Must match the signal-handler-stack-frame-size and stack-frame-size + constants in bootstrap/assembler/x86.32.factor */ static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 48; static const unsigned JIT_FRAME_SIZE = 32; diff --git a/vm/layouts.hpp b/vm/layouts.hpp index eb9218ab46..e295e2a000 100644 --- a/vm/layouts.hpp +++ b/vm/layouts.hpp @@ -9,6 +9,9 @@ inline static cell alignment_for(cell a, cell b) { return align(a, b) - a; } static const cell data_alignment = 16; +/* Must match leaf-stack-frame-size in core/layouts/layouts.factor */ +#define LEAF_FRAME_SIZE 16 + #define WORD_SIZE (signed)(sizeof(cell) * 8) #define TAG_MASK 15 diff --git a/vm/os-linux-x86.64.hpp b/vm/os-linux-x86.64.hpp index 6ec15e7ed9..6f87837b4c 100644 --- a/vm/os-linux-x86.64.hpp +++ b/vm/os-linux-x86.64.hpp @@ -25,9 +25,8 @@ inline static void uap_clear_fpu_status(void* uap) { #define FUNCTION_CODE_POINTER(ptr) ptr #define FUNCTION_TOC_POINTER(ptr) ptr -/* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size, -and stack-frame-size constants in bootstrap/assembler/x86.64.unix.factor */ -static const unsigned LEAF_FRAME_SIZE = 16; +/* Must match the signal-handler-stack-frame-size and stack-frame-size + constants in bootstrap/assembler/x86.64.unix.factor */ static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 160; static const unsigned JIT_FRAME_SIZE = 32; diff --git a/vm/os-macosx-x86.64.hpp b/vm/os-macosx-x86.64.hpp index d1787bf6b9..c80dc70e4b 100644 --- a/vm/os-macosx-x86.64.hpp +++ b/vm/os-macosx-x86.64.hpp @@ -67,9 +67,8 @@ inline static void uap_clear_fpu_status(void* uap) { mach_clear_fpu_status(UAP_FS(uap)); } -/* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size, -and stack-frame-size constants in basis/bootstrap/assembler/x86.64.unix.factor */ -static const unsigned LEAF_FRAME_SIZE = 16; +/* Must match the signal-handler-stack-frame-size and stack-frame-size + constants in basis/bootstrap/assembler/x86.64.unix.factor */ static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 160; static const unsigned JIT_FRAME_SIZE = 32; diff --git a/vm/os-windows.64.hpp b/vm/os-windows.64.hpp index 06a0d33bb5..f3fc8dead8 100644 --- a/vm/os-windows.64.hpp +++ b/vm/os-windows.64.hpp @@ -7,9 +7,8 @@ namespace factor { #define MXCSR(ctx) (ctx)->MxCsr -/* Must match the leaf-stack-frame-size, signal-handler-stack-frame-size, -and stack-frame-size constants in basis/bootstap/assembler/x86.64.windows.factor */ -static const unsigned LEAF_FRAME_SIZE = 16; +/* Must match the signal-handler-stack-frame-size and stack-frame-size + constants in basis/bootstap/assembler/x86.64.windows.factor */ static const unsigned SIGNAL_HANDLER_STACK_FRAME_SIZE = 192; static const unsigned JIT_FRAME_SIZE = 64; }