jdk

Форк
0
/
assembler_arm_32.cpp 
92 строки · 3.0 Кб
1
/*
2
 * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
 *
5
 * This code is free software; you can redistribute it and/or modify it
6
 * under the terms of the GNU General Public License version 2 only, as
7
 * published by the Free Software Foundation.
8
 *
9
 * This code is distributed in the hope that it will be useful, but WITHOUT
10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
 * version 2 for more details (a copy is included in the LICENSE file that
13
 * accompanied this code).
14
 *
15
 * You should have received a copy of the GNU General Public License version
16
 * 2 along with this work; if not, write to the Free Software Foundation,
17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
 *
19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
 * or visit www.oracle.com if you need additional information or have any
21
 * questions.
22
 *
23
 */
24

25
#include "precompiled.hpp"
26
#include "asm/assembler.hpp"
27
#include "asm/assembler.inline.hpp"
28
#include "ci/ciEnv.hpp"
29
#include "gc/shared/cardTableBarrierSet.hpp"
30
#include "gc/shared/collectedHeap.inline.hpp"
31
#include "interpreter/interpreter.hpp"
32
#include "interpreter/interpreterRuntime.hpp"
33
#include "interpreter/templateInterpreterGenerator.hpp"
34
#include "memory/resourceArea.hpp"
35
#include "prims/jvm_misc.hpp"
36
#include "prims/methodHandles.hpp"
37
#include "runtime/interfaceSupport.inline.hpp"
38
#include "runtime/objectMonitor.hpp"
39
#include "runtime/os.hpp"
40
#include "runtime/sharedRuntime.hpp"
41
#include "runtime/stubRoutines.hpp"
42
#include "utilities/macros.hpp"
43

44
#ifdef COMPILER2
45
// Convert the raw encoding form into the form expected by the
46
// constructor for Address.
47
Address Address::make_raw(int base, int index, int scale, int disp, relocInfo::relocType disp_reloc) {
48
  RelocationHolder rspec = RelocationHolder::none;
49
  if (disp_reloc != relocInfo::none) {
50
    rspec = Relocation::spec_simple(disp_reloc);
51
  }
52

53
  Register rindex = as_Register(index);
54
  if (rindex != PC) {
55
    assert(disp == 0, "unsupported");
56
    Address madr(as_Register(base), rindex, lsl, scale);
57
    madr._rspec = rspec;
58
    return madr;
59
  } else {
60
    assert(scale == 0, "not supported");
61
    Address madr(as_Register(base), disp);
62
    madr._rspec = rspec;
63
    return madr;
64
  }
65
}
66
#endif
67

68
void AsmOperand::initialize_rotated_imm(unsigned int imm) {
69
  for (int shift = 2; shift <= 24; shift += 2) {
70
    if ((imm & ~(0xff << shift)) == 0) {
71
      _encoding = 1 << 25 | (32 - shift) << 7 | imm >> shift;
72
      return;
73
    }
74
  }
75
  assert((imm & 0x0ffffff0) == 0, "too complicated constant: %d (%x)", imm, imm);
76
  _encoding = 1 << 25 | 4 << 7 | imm >> 28 | imm << 4;
77
}
78

79
bool AsmOperand::is_rotated_imm(unsigned int imm) {
80
  if ((imm >> 8) == 0) {
81
    return true;
82
  }
83
  for (int shift = 2; shift <= 24; shift += 2) {
84
    if ((imm & ~(0xff << shift)) == 0) {
85
      return true;
86
    }
87
  }
88
  if ((imm & 0x0ffffff0) == 0) {
89
    return true;
90
  }
91
  return false;
92
}
93

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.