<commit_before>;;;; Copyright (c) 2011-2015 <NAME> <<EMAIL>>
;;;; This code is licensed under the MIT license.

(in-package :mezzano.runtime)

(declaim (inline eql))
(defun eql (x y)
  (or (eq x y)
      (and (sys.int::%value-has-tag-p x sys.int::+tag-object+)
           (sys.int::%value-has-tag-p y sys.int::+tag-object+)
           (eq (sys.int::%object-tag x) (sys.int::%object-tag y))
           (<= sys.int::+first-numeric-object-tag+
               (sys.int::%object-tag x)
               sys.int::+last-numeric-object-tag+)
           (= x y))))

(declaim (inline sys.int::%value-has-tag-p))
(defun sys.int::%value-has-tag-p (value tag)
  (eq (sys.int::%tag-field value) tag))

(declaim (inline sys.int::%type-check))
(defun sys.int::%type-check (object object-tag expected-type)
  (unless (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
               (eq (sys.int::%object-tag object) object-tag))
    (sys.int::raise-type-error object expected-type)))

(declaim (inline lognot))
(defun lognot (integer)
  (logxor integer -1))

;; ARM makes it difficult to detect overflow when shifting left.
(declaim (inline %fixnum-left-shift))
(defun %fixnum-left-shift (integer count)
  (dotimes (i count)
     (setf integer (+ integer integer)))
  integer)

(declaim (inline sys.int::%simple-1d-array-p))
(defun sys.int::%simple-1d-array-p (object)
  (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
       (<= (sys.int::%object-tag object) sys.int::+last-simple-1d-array-object-tag+)))

(declaim (inline simple-vector-p))
(defun simple-vector-p (object)
  (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
       (eq (sys.int::%object-tag object) sys.int::+object-tag-array-t+)))

(declaim (inline sys.int::character-array-p))
(defun sys.int::character-array-p (object)
  (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
       (let ((tag (sys.int::%object-tag object)))
         (or (eq tag sys.int::+object-tag-simple-string+)
             (eq tag sys.int::+object-tag-string+)))))

(declaim (inline arrayp))
(defun arrayp (object)
  (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
       (<= (sys.int::%object-tag object) sys.int::+last-complex-array-object-tag+)))

(declaim (inline sys.int::complex-array-p))
(defun sys.int::complex-array-p (object)
  (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
       (<= sys.int::+first-complex-array-object-tag+
           (sys.int::%object-tag object)
           sys.int::+last-complex-array-object-tag+)))

(declaim (inline sys.int::%bounds-check))
(defun sys.int::%bounds-check (object slot)
  (unless (sys.int::fixnump slot)
    (sys.int::raise-type-error slot 'fixnum))
  (unless (< slot (sys.int::%object-header-data object))
    (sys.int::raise-bounds-error object slot)))

(declaim (inline characterp))
(defun characterp (object)
  (sys.int::%value-has-tag-p object sys.int::+tag-character+))

(declaim (inline rem))
(defun rem (number divisor)
  (multiple-value-bind (quot rem)
      (truncate number divisor)
    (declare (ignore quot))
    rem))

(declaim (inline functionp))
(defun functionp (object)
  (<= sys.int::+first-function-object-tag+
      (sys.int::%object-tag object)
      sys.int::+last-function-object-tag+))

(declaim (inline sys.int::%object-of-type-p))
(defun sys.int::%object-of-type-p (object object-tag)
  (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
       (eq (sys.int::%object-tag object) object-tag)))

(defun sys.int::%atomic-fixnum-add-object (object slot delta)
  (prog1<commit_msg>Fix FUNCTIONP on ARM64.<commit_after>;;;; Copyright (c) 2011-2015 <NAME> <<EMAIL>>
;;;; This code is licensed under the MIT license.

(in-package :mezzano.runtime)

(declaim (inline eql))
(defun eql (x y)
  (or (eq x y)
      (and (sys.int::%value-has-tag-p x sys.int::+tag-object+)
           (sys.int::%value-has-tag-p y sys.int::+tag-object+)
           (eq (sys.int::%object-tag x) (sys.int::%object-tag y))
           (<= sys.int::+first-numeric-object-tag+
               (sys.int::%object-tag x)
               sys.int::+last-numeric-object-tag+)
           (= x y))))

(declaim (inline sys.int::%value-has-tag-p))
(defun sys.int::%value-has-tag-p (value tag)
  (eq (sys.int::%tag-field value) tag))

(declaim (inline sys.int::%type-check))
(defun sys.int::%type-check (object object-tag expected-type)
  (unless (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
               (eq (sys.int::%object-tag object) object-tag))
    (sys.int::raise-type-error object expected-type)))

(declaim (inline lognot))
(defun lognot (integer)
  (logxor integer -1))

;; ARM makes it difficult to detect overflow when shifting left.
(declaim (inline %fixnum-left-shift))
(defun %fixnum-left-shift (integer count)
  (dotimes (i count)
     (setf integer (+ integer integer)))
  integer)

(declaim (inline sys.int::%simple-1d-array-p))
(defun sys.int::%simple-1d-array-p (object)
  (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
       (<= (sys.int::%object-tag object) sys.int::+last-simple-1d-array-object-tag+)))

(declaim (inline simple-vector-p))
(defun simple-vector-p (object)
  (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
       (eq (sys.int::%object-tag object) sys.int::+object-tag-array-t+)))

(declaim (inline sys.int::character-array-p))
(defun sys.int::character-array-p (object)
  (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
       (let ((tag (sys.int::%object-tag object)))
         (or (eq tag sys.int::+object-tag-simple-string+)
             (eq tag sys.int::+object-tag-string+)))))

(declaim (inline arrayp))
(defun arrayp (object)
  (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
       (<= (sys.int::%object-tag object) sys.int::+last-complex-array-object-tag+)))

(declaim (inline sys.int::complex-array-p))
(defun sys.int::complex-array-p (object)
  (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
       (<= sys.int::+first-complex-array-object-tag+
           (sys.int::%object-tag object)
           sys.int::+last-complex-array-object-tag+)))

(declaim (inline sys.int::%bounds-check))
(defun sys.int::%bounds-check (object slot)
  (unless (sys.int::fixnump slot)
    (sys.int::raise-type-error slot 'fixnum))
  (unless (< slot (sys.int::%object-header-data object))
    (sys.int::raise-bounds-error object slot)))

(declaim (inline characterp))
(defun characterp (object)
  (sys.int::%value-has-tag-p object sys.int::+tag-character+))

(declaim (inline rem))
(defun rem (number divisor)
  (multiple-value-bind (quot rem)
      (truncate number divisor)
    (declare (ignore quot))
    rem))

(declaim (inline functionp))
(defun functionp (object)
  (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
       (<= sys.int::+first-function-object-tag+
           (sys.int::%object-tag object)
           sys.int::+last-function-object-tag+)))

(declaim (inline sys.int::%object-of-type-p))
(defun sys.int::%object-of-type-p (object object-tag)
  (and (sys.int::%value-has-tag-p object sys.int::+tag-object+)
       (eq (sys.int::%object-tag object) object-tag)))

(defun sys.int::%atomic-fixnum-add-object (object slot delta)
  (prog1
{'fraction_non_alphanumeric': 0.20110803324099724, 'fraction_numerical': 0.003878116343490305, 'mean_word_length': 3.6347881899871632, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 9, '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': '4700562', 'n_tokens_mistral': 2730, 'n_tokens_neox': 2667, 'n_words': 530}