0 /*
1 * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
|
0 /*
1 * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 *
4 * This code is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 only, as
6 * published by the Free Software Foundation.
7 *
8 * This code is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
11 * version 2 for more details (a copy is included in the LICENSE file that
12 * accompanied this code).
13 *
14 * You should have received a copy of the GNU General Public License version
15 * 2 along with this work; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
19 * or visit www.oracle.com if you need additional information or have any
20 * questions.
|
25 #include "asm/assembler.hpp"
26 #include "asm/assembler.inline.hpp"
27 #include "ci/ciEnv.hpp"
28 #include "gc/shared/cardTableModRefBS.hpp"
29 #include "gc/shared/collectedHeap.inline.hpp"
30 #include "interpreter/interpreter.hpp"
31 #include "interpreter/interpreterRuntime.hpp"
32 #include "interpreter/templateInterpreterGenerator.hpp"
33 #include "memory/resourceArea.hpp"
34 #include "prims/jvm_misc.hpp"
35 #include "prims/methodHandles.hpp"
36 #include "runtime/biasedLocking.hpp"
37 #include "runtime/interfaceSupport.hpp"
38 #include "runtime/objectMonitor.hpp"
39 #include "runtime/os.hpp"
40 #include "runtime/sharedRuntime.hpp"
41 #include "runtime/stubRoutines.hpp"
42 #include "utilities/hashtable.hpp"
43 #include "utilities/macros.hpp"
44 #if INCLUDE_ALL_GCS
45 #include "gc/g1/g1CollectedHeap.inline.hpp"
46 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
47 #include "gc/g1/heapRegion.hpp"
48 #endif // INCLUDE_ALL_GCS
49
50 // Returns whether given imm has equal bit fields <0:size-1> and <size:2*size-1>.
51 inline bool Assembler::LogicalImmediate::has_equal_subpatterns(uintx imm, int size) {
52 uintx mask = right_n_bits(size);
53 uintx subpattern1 = mask_bits(imm, mask);
54 uintx subpattern2 = mask_bits(imm >> size, mask);
55 return subpattern1 == subpattern2;
56 }
57
58 // Returns least size that is a power of two from 2 to 64 with the proviso that given
59 // imm is composed of repeating patterns of this size.
60 inline int Assembler::LogicalImmediate::least_pattern_size(uintx imm) {
61 int size = BitsPerWord;
62 while (size > 2 && has_equal_subpatterns(imm, size >> 1)) {
63 size >>= 1;
64 }
65 return size;
|
25 #include "asm/assembler.hpp"
26 #include "asm/assembler.inline.hpp"
27 #include "ci/ciEnv.hpp"
28 #include "gc/shared/cardTableModRefBS.hpp"
29 #include "gc/shared/collectedHeap.inline.hpp"
30 #include "interpreter/interpreter.hpp"
31 #include "interpreter/interpreterRuntime.hpp"
32 #include "interpreter/templateInterpreterGenerator.hpp"
33 #include "memory/resourceArea.hpp"
34 #include "prims/jvm_misc.hpp"
35 #include "prims/methodHandles.hpp"
36 #include "runtime/biasedLocking.hpp"
37 #include "runtime/interfaceSupport.hpp"
38 #include "runtime/objectMonitor.hpp"
39 #include "runtime/os.hpp"
40 #include "runtime/sharedRuntime.hpp"
41 #include "runtime/stubRoutines.hpp"
42 #include "utilities/hashtable.hpp"
43 #include "utilities/macros.hpp"
44 #if INCLUDE_ALL_GCS
45 #include "gc/g1/g1BarrierSet.hpp"
46 #include "gc/g1/g1CollectedHeap.inline.hpp"
47 #include "gc/g1/heapRegion.hpp"
48 #endif // INCLUDE_ALL_GCS
49
50 // Returns whether given imm has equal bit fields <0:size-1> and <size:2*size-1>.
51 inline bool Assembler::LogicalImmediate::has_equal_subpatterns(uintx imm, int size) {
52 uintx mask = right_n_bits(size);
53 uintx subpattern1 = mask_bits(imm, mask);
54 uintx subpattern2 = mask_bits(imm >> size, mask);
55 return subpattern1 == subpattern2;
56 }
57
58 // Returns least size that is a power of two from 2 to 64 with the proviso that given
59 // imm is composed of repeating patterns of this size.
60 inline int Assembler::LogicalImmediate::least_pattern_size(uintx imm) {
61 int size = BitsPerWord;
62 while (size > 2 && has_equal_subpatterns(imm, size >> 1)) {
63 size >>= 1;
64 }
65 return size;
|