<commit_before>namespace factor {

// gc_info should be kept in sync with:
//   core/vm/vm.factor

struct gc_info {
  uint32_t scrub_d_count;
  uint32_t scrub_r_count;
  uint32_t check_d_count;
  uint32_t check_r_count;
  uint32_t gc_root_count;
  uint32_t derived_root_count;
  uint32_t return_address_count;

  cell callsite_bitmap_size() {
    return
        scrub_d_count +
        scrub_r_count +
        check_d_count +
        check_r_count +
        gc_root_count;
  }

  cell total_bitmap_size() {
    return return_address_count * callsite_bitmap_size();
  }

  cell total_bitmap_bytes() { return ((total_bitmap_size() + 7) / 8); }

  uint32_t* return_addresses() {
    return (uint32_t*)this - return_address_count;
  }

  uint32_t* base_pointer_map() {
    return return_addresses() - return_address_count * derived_root_count;
  }

  uint8_t* gc_info_bitmap() {
    return (uint8_t*)base_pointer_map() - total_bitmap_bytes();
  }

  cell callsite_scrub_d(cell index) {
    cell base = 0;
    return base + index * scrub_d_count;
  }

  cell callsite_scrub_r(cell index) {
    cell base = return_address_count * scrub_d_count;
    return base + index * scrub_r_count;
  }

  cell callsite_check_d(cell index) {
    cell base =
        return_address_count * scrub_d_count +
        return_address_count * scrub_r_count;
    return base + index * check_d_count;
  }

  cell callsite_check_r(cell index) {
    cell base =
        return_address_count * scrub_d_count +
        return_address_count * scrub_r_count +
        return_address_count * check_d_count;
    return base + index + check_r_count;
  }

  cell callsite_gc_roots(cell index) {
    cell base =
        return_address_count * scrub_d_count +
        return_address_count * scrub_r_count +
        return_address_count * check_d_count +
        return_address_count * check_r_count;
    return base + index * gc_root_count;
  }

  uint32_t lookup_base_pointer(cell index, cell derived_root) {
    return base_pointer_map()[index * derived_root_count + derived_root];
  }

  cell return_address_index(cell return_address);
};

}
<commit_msg>VM: silly error: should be index * check_r_count, not index + check_r_count<commit_after>namespace factor {

// gc_info should be kept in sync with:
//   core/vm/vm.factor

struct gc_info {
  uint32_t scrub_d_count;
  uint32_t scrub_r_count;
  uint32_t check_d_count;
  uint32_t check_r_count;
  uint32_t gc_root_count;
  uint32_t derived_root_count;
  uint32_t return_address_count;

  cell callsite_bitmap_size() {
    return
        scrub_d_count +
        scrub_r_count +
        check_d_count +
        check_r_count +
        gc_root_count;
  }

  cell total_bitmap_size() {
    return return_address_count * callsite_bitmap_size();
  }

  cell total_bitmap_bytes() { return ((total_bitmap_size() + 7) / 8); }

  uint32_t* return_addresses() {
    return (uint32_t*)this - return_address_count;
  }

  uint32_t* base_pointer_map() {
    return return_addresses() - return_address_count * derived_root_count;
  }

  uint8_t* gc_info_bitmap() {
    return (uint8_t*)base_pointer_map() - total_bitmap_bytes();
  }

  cell callsite_scrub_d(cell index) {
    cell base = 0;
    return base + index * scrub_d_count;
  }

  cell callsite_scrub_r(cell index) {
    cell base = return_address_count * scrub_d_count;
    return base + index * scrub_r_count;
  }

  cell callsite_check_d(cell index) {
    cell base =
        return_address_count * scrub_d_count +
        return_address_count * scrub_r_count;
    return base + index * check_d_count;
  }

  cell callsite_check_r(cell index) {
    cell base =
        return_address_count * scrub_d_count +
        return_address_count * scrub_r_count +
        return_address_count * check_d_count;
    return base + index * check_r_count;
  }

  cell callsite_gc_roots(cell index) {
    cell base =
        return_address_count * scrub_d_count +
        return_address_count * scrub_r_count +
        return_address_count * check_d_count +
        return_address_count * check_r_count;
    return base + index * gc_root_count;
  }

  uint32_t lookup_base_pointer(cell index, cell derived_root) {
    return base_pointer_map()[index * derived_root_count + derived_root];
  }

  cell return_address_index(cell return_address);
};

}

{'fraction_non_alphanumeric': 0.07704841713221601, 'fraction_numerical': 0.012569832402234637, 'mean_word_length': 3.4207818930041154, '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': '5581599', 'n_tokens_mistral': 1547, 'n_tokens_neox': 1506, 'n_words': 287}