Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTERNAL: Refactor the structure of additional item in mblck #756

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ing-eoking
Copy link
Collaborator

@ing-eoking ing-eoking commented Apr 26, 2024

πŸ”— Related Issue

  • jam2in/arcus-works#539

⌨️ What I did

1. memory block μ—μ„œ value_item λ₯Ό μ‚¬μš©ν•˜λ„λ‘ λ³€κ²½ν•©λ‹ˆλ‹€.

  • Additional ritem으둜 ν™œμš©λ˜λŠ” μ•„λž˜μ˜ 3가지 item이 λ™μΌν•œ νƒ€μž…μ„ κ°–κ²Œ 끔 ν•˜κΈ° μœ„ν•¨μž…λ‹ˆλ‹€.
    • hash item : value_item
    • element item : value_item
    • memory block item : mblck_node_t
  • value_item으둜 λ³€κ²½ μ‹œ μ•„λž˜ 사항을 κ³ λ €ν•΄μ•Ό ν–ˆμŠ΅λ‹ˆλ‹€.
    • memory block의 body_len 계산
      - pool->body_len = blck_len - sizeof(void *);
      + pool->body_len = blck_len - (sizeof(void *) + sizeof(uint32_t))

2. Memory Block List 자료 ꡬ쑰 λ‚΄μ—μ„œ Headλ₯Ό μ œμ™Έν•œ Memory Block을 Additional List에 λ„£μ–΄λ‘‘λ‹ˆλ‹€.

  • Additional ListλŠ” 인덱슀 기반(rindex)으둜 λ‹€μŒ item에 μ ‘κ·Όν•  λ•Œ ν™œμš©λ©λ‹ˆλ‹€.

🎯 To Do

  • Ubuntuμ—μ„œ unit test μ‹€νŒ¨ λ°œμƒ : 원인 νŒŒμ•…μ€‘
    • μ΄ˆκΈ°κ°’μœΌλ‘œ NULL이 듀어가지 μ•Šμ„ 수 있음
  • λ©”λͺ¨λ¦¬ λΆ€μ‘± 둜직 μΆ”κ°€
  • mblck_list μ—μ„œ body_len 제거 : value_item 내뢀에 len 정보λ₯Ό λ‹΄μŒ
  • κ΄€λ ¨ 맀크둜 정리
  • λ§ν¬λ“œλ¦¬μŠ€νŠΈ 쑰회λ₯Ό μœ„ν•΄ μ‚¬μš©λœ c->membk 제거

@ing-eoking ing-eoking marked this pull request as ready for review June 17, 2024 01:33
@ing-eoking ing-eoking marked this pull request as draft June 19, 2024 08:49
@ing-eoking ing-eoking marked this pull request as ready for review October 16, 2024 08:55
@ing-eoking
Copy link
Collaborator Author

@namsic

ν•΄λ‹Ή PR도 리뷰 λΆ€νƒλ“œλ¦½λ‹ˆλ‹€.

Comment on lines 45 to +47
mblck_node_t *head;
mblck_node_t *tail;
value_item **addnl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • head의 nextλ₯Ό 톡해 전체 item에 μ ‘κ·Ό κ°€λŠ₯ν•  것인데, addnl을 λ‘λŠ” μ΄μœ λŠ” λ¬΄μ—‡μΈκ°€μš”?
  • value_item arrayλ₯Ό λ‘”λ‹€λ©΄, tail λ“± λ§ν¬λ“œλ¦¬μŠ€νŠΈ κ΄€λ ¨ fieldλ₯Ό μ œκ±°ν•  수 μžˆλŠ” 것이 μ•„λ‹Œμ§€?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. addnl은 ritem read μ‹œ ν™œμš©ν•˜κΈ° μœ„ν•˜μ—¬ μΆ”κ°€ν•œ 것 (HINFO, EINFO와 μœ μ‚¬ν•œ ꡬ쑰λ₯Ό 갖도둝)
  2. mblck은 ritem read 외에도 ν™œμš©ν•˜λŠ” κ²½μš°κ°€ μžˆλŠ”λ° (tokenize_XXX()), 이 λ•Œ list λ°©μ‹μ˜ κ΅¬ν˜„μ΄ ν•„μš”ν•˜λ‹€κ³  함
  3. λ”°λΌμ„œ PR κ΅¬ν˜„μ—μ„œλŠ” ν•˜λ‚˜μ˜ 데이터λ₯Ό array λ°©μ‹μœΌλ‘œλ„ μ ‘κ·Ό(ritem_set_XXX())ν•  수 있고,
    κΈ°μ‘΄ list λ°©μ‹μœΌλ‘œλ„ μ ‘κ·Ό(tokenize_XXX())ν•  수 μžˆλ„λ‘ κ΅¬ν˜„ν•œ μƒνƒœ

@@ -31,7 +31,7 @@ static void do_mblck_pool_init(mblck_pool_t *pool, uint32_t blck_len)
pool->tail = NULL;
pool->head = NULL;
pool->blck_len = blck_len;
pool->body_len = blck_len - sizeof(void *);
pool->body_len = blck_len - (sizeof(void *) + sizeof(uint32_t));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sizeof(void *)와 sizeof(uint32_t)λŠ” 각각 μ–΄λ–€ κ°’μ˜ ν¬κΈ°μΈκ°€μš”?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

old

| <----- blck_len -----> |
        | <- body_len -> |
--------------------------
| *next |      data      |

new

| <-------- blck_len --------> |
        | <--- value_item ---> |
              | <- body_len -> |
--------------------------
| *next | len |       ptr      |
  • value_item.lenκ³Ό pool->body_len은 κ²°κ΅­μ—λŠ” 같은 값을 κ°–κ²Œ λœλ‹€κ³  함

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants