<commit_before>(in-package #:sicl-clos)

;;;; This function is used to allocate an instance of a built-in
;;;; class.  We can not use a method on ALLOCATE-INSTANCE for this
;;;; purpose, because the AMOP requires the existence of a method on
;;;; ALLOCATE-INSTANCE specialized for BUILT-IN-CLASS, but it also
;;;; requires that method to signal an error. 
;;;;
;;;; Every instance of a built-in class has an initial cell (the
;;;; unique number of the class in the rack.  This cell is
;;;; not counted among the slots, because it is accessed directly,
;;;; using an offset.  The existence of this cell requires us to add 1
;;;; to the size of the rack.
;;;; 
;;;; Furthermore, instances of some built-in classes have additional
;;;; storage following the slots.  In particular, this is true for the
;;;; class ARRAY and subclasses thereof.  For that reason, this
;;;; function takes a keyword argument ADDITIONAL-STORAGE (the default
;;;; value is 0) that indicates how many additional words of storage
;;;; should be allocated following the slots in the rack.

(defun allocate-built-in-instance
    (class &rest initargs &key (additional-storage 0))
  (declare (ignore initargs))
  (unless (class-finalized-p class)
    (finalize-built-in-inheritance class))
  (let* ((size (+ (instance-size class) additional-storage))
	 (slots (allocate-slot-storage size))
	 (instance (allocate-heap-instance class slots)))
    ;; Store the unique number of the class in the instance so that<commit_msg>Allow other keys for ALLOCATE-BUILT-IN-INSTANCE.<commit_after>(in-package #:sicl-clos)

;;;; This function is used to allocate an instance of a built-in
;;;; class.  We can not use a method on ALLOCATE-INSTANCE for this
;;;; purpose, because the AMOP requires the existence of a method on
;;;; ALLOCATE-INSTANCE specialized for BUILT-IN-CLASS, but it also
;;;; requires that method to signal an error. 
;;;;
;;;; Every instance of a built-in class has an initial cell (the
;;;; unique number of the class in the rack.  This cell is
;;;; not counted among the slots, because it is accessed directly,
;;;; using an offset.  The existence of this cell requires us to add 1
;;;; to the size of the rack.
;;;; 
;;;; Furthermore, instances of some built-in classes have additional
;;;; storage following the slots.  In particular, this is true for the
;;;; class ARRAY and subclasses thereof.  For that reason, this
;;;; function takes a keyword argument ADDITIONAL-STORAGE (the default
;;;; value is 0) that indicates how many additional words of storage
;;;; should be allocated following the slots in the rack.

(defun allocate-built-in-instance
    (class &rest initargs &key (additional-storage 0) &allow-other-keys)
  (declare (ignore initargs))
  (unless (class-finalized-p class)
    (finalize-built-in-inheritance class))
  (let* ((size (+ (instance-size class) additional-storage))
	 (slots (allocate-slot-storage size))
	 (instance (allocate-heap-instance class slots)))
    ;; Store the unique number of the class in the instance so that
{'fraction_non_alphanumeric': 0.10781404549950543, 'fraction_numerical': 0.0019782393669634025, 'mean_word_length': 4.32280701754386, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5988671', 'n_tokens_mistral': 850, 'n_tokens_neox': 794, 'n_words': 396}