<commit_before>from rsqueakvm import constants, error
from rsqueakvm.model.base import W_Object
from rsqueakvm.model.compiled_methods import W_CompiledMethod, W_PreSpurCompiledMethod, W_SpurCompiledMethod
from rsqueakvm.model.numeric import W_Float, W_SmallInteger, W_LargePositiveInteger1Word
from rsqueakvm.model.pointers import W_PointersObject
from rsqueakvm.model.database import W_DBObject
from rsqueakvm.model.variable import W_BytesObject, W_WordsObject
from rsqueakvm.storage import AbstractCachingShadow, AbstractGenericShadow
from rsqueakvm.util.version import elidable_for_version, Version
from rsqueakvm.plugins.database import dbm

from rpython.rlib import jit

import pdb

POINTERS = 0
BYTES = 1
WORDS = 2
WEAK_POINTERS = 3
COMPILED_METHOD = 4
FLOAT = 5
LARGE_POSITIVE_INTEGER = 6
FORWARDER_AND_INVALID = 7

# TODO: refactor
@jit.elidable
def inherits_from(w_cls, space):
    s_cls = w_cls.class_shadow(space)
    while s_cls is not None:
        if not s_cls.provides_getname:
            break
        if s_cls.getname() == "DBObject class":
            return True
        s_cls = s_cls.s_superclass()
    return False

class ClassShadowError(error.SmalltalkException):
    exception_type = "ClassShadowError"

class ClassShadow(AbstractCachingShadow):
    """A shadow for Smalltalk objects that are classes
    (i.e. used as the class of another Smalltalk object).
    """

    _attrs_ = ["name", "_instance_size", "instance_varsized", "instance_kind",
                "_s_methoddict", "_s_superclass", "subclass_s"]<commit_msg>inherits_from(w_cls, space) is not elidable<commit_after>from rsqueakvm import constants, error
from rsqueakvm.model.base import W_Object
from rsqueakvm.model.compiled_methods import W_CompiledMethod, W_PreSpurCompiledMethod, W_SpurCompiledMethod
from rsqueakvm.model.numeric import W_Float, W_SmallInteger, W_LargePositiveInteger1Word
from rsqueakvm.model.pointers import W_PointersObject
from rsqueakvm.model.database import W_DBObject
from rsqueakvm.model.variable import W_BytesObject, W_WordsObject
from rsqueakvm.storage import AbstractCachingShadow, AbstractGenericShadow
from rsqueakvm.util.version import elidable_for_version, Version
from rsqueakvm.plugins.database import dbm

from rpython.rlib import jit

import pdb

POINTERS = 0
BYTES = 1
WORDS = 2
WEAK_POINTERS = 3
COMPILED_METHOD = 4
FLOAT = 5
LARGE_POSITIVE_INTEGER = 6
FORWARDER_AND_INVALID = 7

# TODO: refactor
# @jit.elidable  # translation fails when turned on
def inherits_from(w_cls, space):
    s_cls = w_cls.class_shadow(space)
    while s_cls is not None:
        if not s_cls.provides_getname:
            break
        if s_cls.getname() == "DBObject class":
            return True
        s_cls = s_cls.s_superclass()
    return False

class ClassShadowError(error.SmalltalkException):
    exception_type = "ClassShadowError"

class ClassShadow(AbstractCachingShadow):
    """A shadow for Smalltalk objects that are classes
    (i.e. used as the class of another Smalltalk object).
    """

    _attrs_ = ["name", "_instance_size", "instance_varsized", "instance_kind",
                "_s_methoddict", "_s_superclass", "subclass_s"]
{'fraction_non_alphanumeric': 0.06989247311827956, 'fraction_numerical': 0.0056925996204933585, 'mean_word_length': 4.6786355475763015, 'pattern_counts': {'":': 2, '<': 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': '3369210', 'n_tokens_mistral': 1034, 'n_tokens_neox': 1006, 'n_words': 264}