• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/**
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#include "arch/asm_support.h"
17
18.set ALIGNMENT_MASK, ~(TLAB_ALIGNMENT - 1)
19
20// Load tlab start and tlab size from TLAB structure. Relies on fact that tlab start and tlab end are neighbours in TLAB structure.
21.macro LOAD_TLAB_INFO reg_tlab_start, reg_tlab_size
22  .if TLAB_CUR_FREE_POSITION_OFFSET - TLAB_MEMORY_END_ADDR_OFFSET != 8
23    // we need it to be able to load pair of values with one instruction
24    .err
25  .endif
26
27  ldr \reg_tlab_size, [THREAD_REG, #MANAGED_THREAD_TLAB_OFFSET]
28  ldp \reg_tlab_size, \reg_tlab_start, [\reg_tlab_size, #TLAB_MEMORY_END_ADDR_OFFSET]
29  sub \reg_tlab_size, \reg_tlab_size, \reg_tlab_start
30.endm
31
32// store class pointer, next free TLAB pointer and assign return register value with TLAB allocated space.
33.macro FINISH_TLAB_ALLOCATION reg_class_pointer, reg_new_string, reg_next_free_tlab_pointer
34  str \reg_class_pointer, [\reg_new_string, #OBJECT_HEADER_CLASS_POINTER_OFFSET]
35  mov x0, \reg_new_string
36  // Store next free TLAB pointer
37  ldr \reg_new_string, [THREAD_REG, #MANAGED_THREAD_TLAB_OFFSET]
38  add x20, \reg_new_string, #TLAB_CUR_FREE_POSITION_OFFSET
39  stlr \reg_next_free_tlab_pointer, [x20]
40.endm
41