From: John Benediktsson Date: Tue, 15 Feb 2022 19:27:19 +0000 (-0800) Subject: layouts: change max-array-capacity to most-positive-fixnum X-Git-Tag: 0.99~1508 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=ffad6a8dc8e33cf9811d08a02cd46aa3fcce8ee0 layouts: change max-array-capacity to most-positive-fixnum --- diff --git a/core/growable/growable.factor b/core/growable/growable.factor index e6daa965a4..e203b1a722 100644 --- a/core/growable/growable.factor +++ b/core/growable/growable.factor @@ -1,10 +1,9 @@ ! Copyright (C) 2005, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors kernel math math.private sequences -sequences.private ; IN: growable - -MIXIN: growable +MIXIN: growable ! for bootstrap +USING: accessors kernel layouts math math.private sequences +sequences.private ; SLOT: length SLOT: underlying @@ -46,7 +45,9 @@ M: growable set-length ] if length<< ; -: new-size ( old -- new ) 1 + 2 * ; inline +: new-size ( old -- new ) + integer>fixnum-strict 1 fixnum+fast 2 fixnum*fast + dup 0 < [ drop most-positive-fixnum ] when ; inline : ensure ( n seq -- n seq ) bounds-check-head diff --git a/core/layouts/layouts.factor b/core/layouts/layouts.factor index c0c9a277dd..ec9a0a90bd 100644 --- a/core/layouts/layouts.factor +++ b/core/layouts/layouts.factor @@ -73,11 +73,7 @@ SYMBOL: header-bits : most-negative-fixnum ( -- n ) first-bignum neg >fixnum ; inline -: (max-array-capacity) ( b -- n ) - 2 - 2^ 1 - ; inline - -: max-array-capacity ( -- n ) - fixnum-bits (max-array-capacity) ; inline +ALIAS: max-array-capacity most-positive-fixnum : bootstrap-first-bignum ( -- n ) bootstrap-cell-bits (first-bignum) ; @@ -88,8 +84,7 @@ SYMBOL: header-bits : bootstrap-most-negative-fixnum ( -- n ) bootstrap-first-bignum neg ; -: bootstrap-max-array-capacity ( -- n ) - bootstrap-fixnum-bits (max-array-capacity) ; +ALIAS: bootstrap-max-array-capacity bootstrap-most-positive-fixnum M: bignum >integer dup most-negative-fixnum most-positive-fixnum between?