From 85c3ccbb98a62fc1c2ef710aebc60c824afa5c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Mon, 21 Mar 2016 18:10:39 +0100 Subject: [PATCH] slots: add initial value for integer-array-capacity, fixes part of #1571 --- core/classes/tuple/tuple-tests.factor | 10 ++++++++++ core/slots/slots.factor | 1 + 2 files changed, 11 insertions(+) diff --git a/core/classes/tuple/tuple-tests.factor b/core/classes/tuple/tuple-tests.factor index ea1deadf94..c702cc03a6 100644 --- a/core/classes/tuple/tuple-tests.factor +++ b/core/classes/tuple/tuple-tests.factor @@ -701,6 +701,16 @@ TUPLE: boa-coercer-test { x array-capacity } ; { T{ boa-coercer-test f 0 } } [ T{ boa-coercer-test } ] unit-test +TUPLE: boa-iac { x integer-array-capacity initial: 77 } ; + +{ fixnum bignum 77 } [ + 30 boa-iac boa x>> class-of + 10 >bignum boa-iac boa x>> class-of + boa-iac new x>> +] unit-test + +[ -99 boa-iac boa ] [ bad-slot-value? ] must-fail-with + ! Make sure that tuple reshaping updates code heap roots TUPLE: code-heap-ref ; diff --git a/core/slots/slots.factor b/core/slots/slots.factor index e3f6ea995b..6d393f1255 100644 --- a/core/slots/slots.factor +++ b/core/slots/slots.factor @@ -203,6 +203,7 @@ M: anonymous-intersection initial-value* { [ dup "initial-value" word-prop ] [ dup "initial-value" word-prop t ] } { [ \ f bootstrap-word over class<= ] [ f t ] } { [ \ array-capacity bootstrap-word over class<= ] [ 0 t ] } + { [ \ integer-array-capacity bootstrap-word over class<= ] [ 0 t ] } { [ bignum bootstrap-word over class<= ] [ 0 >bignum t ] } { [ float bootstrap-word over class<= ] [ 0.0 t ] } { [ string bootstrap-word over class<= ] [ "" t ] }