28 #include "opto/c2_MacroAssembler.hpp"
29 #include "opto/compile.hpp"
30 #include "opto/intrinsicnode.hpp"
31 #include "opto/matcher.hpp"
32 #include "opto/output.hpp"
33 #include "opto/subnode.hpp"
34 #include "runtime/stubRoutines.hpp"
35
36 #ifdef PRODUCT
37 #define BLOCK_COMMENT(str) /* nothing */
38 #define STOP(error) stop(error)
39 #else
40 #define BLOCK_COMMENT(str) block_comment(str)
41 #define STOP(error) block_comment(error); stop(error)
42 #endif
43
44 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
45
46 typedef void (MacroAssembler::* chr_insn)(Register Rt, const Address &adr);
47
48 // Search for str1 in str2 and return index or -1
49 void C2_MacroAssembler::string_indexof(Register str2, Register str1,
50 Register cnt2, Register cnt1,
51 Register tmp1, Register tmp2,
52 Register tmp3, Register tmp4,
53 Register tmp5, Register tmp6,
54 int icnt1, Register result, int ae) {
55 // NOTE: tmp5, tmp6 can be zr depending on specific method version
56 Label LINEARSEARCH, LINEARSTUB, LINEAR_MEDIUM, DONE, NOMATCH, MATCH;
57
58 Register ch1 = rscratch1;
59 Register ch2 = rscratch2;
60 Register cnt1tmp = tmp1;
61 Register cnt2tmp = tmp2;
62 Register cnt1_neg = cnt1;
63 Register cnt2_neg = cnt2;
64 Register result_tmp = tmp4;
65
66 bool isL = ae == StrIntrinsicNode::LL;
67
|
28 #include "opto/c2_MacroAssembler.hpp"
29 #include "opto/compile.hpp"
30 #include "opto/intrinsicnode.hpp"
31 #include "opto/matcher.hpp"
32 #include "opto/output.hpp"
33 #include "opto/subnode.hpp"
34 #include "runtime/stubRoutines.hpp"
35
36 #ifdef PRODUCT
37 #define BLOCK_COMMENT(str) /* nothing */
38 #define STOP(error) stop(error)
39 #else
40 #define BLOCK_COMMENT(str) block_comment(str)
41 #define STOP(error) block_comment(error); stop(error)
42 #endif
43
44 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
45
46 typedef void (MacroAssembler::* chr_insn)(Register Rt, const Address &adr);
47
48 void C2_MacroAssembler::entry_barrier() {
49 BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
50 if (BarrierSet::barrier_set()->barrier_set_nmethod() != NULL) {
51 // Dummy labels for just measuring the code size
52 Label dummy_slow_path;
53 Label dummy_continuation;
54 Label dummy_guard;
55 Label* slow_path = &dummy_slow_path;
56 Label* continuation = &dummy_continuation;
57 Label* guard = &dummy_guard;
58 if (!Compile::current()->output()->in_scratch_emit_size()) {
59 // Use real labels from actual stub when not emitting code for the purpose of measuring its size
60 C2EntryBarrierStub* stub = new (Compile::current()->comp_arena()) C2EntryBarrierStub();
61 Compile::current()->output()->add_stub(stub);
62 slow_path = &stub->entry();
63 continuation = &stub->continuation();
64 guard = &stub->guard();
65 }
66 // In the C2 code, we move the non-hot part of nmethod entry barriers out-of-line to a stub.
67 bs->nmethod_entry_barrier(this, slow_path, continuation, guard);
68 }
69 }
70
71 int C2_MacroAssembler::entry_barrier_stub_size() {
72 return 4 * 6;
73 }
74
75 // Search for str1 in str2 and return index or -1
76 void C2_MacroAssembler::string_indexof(Register str2, Register str1,
77 Register cnt2, Register cnt1,
78 Register tmp1, Register tmp2,
79 Register tmp3, Register tmp4,
80 Register tmp5, Register tmp6,
81 int icnt1, Register result, int ae) {
82 // NOTE: tmp5, tmp6 can be zr depending on specific method version
83 Label LINEARSEARCH, LINEARSTUB, LINEAR_MEDIUM, DONE, NOMATCH, MATCH;
84
85 Register ch1 = rscratch1;
86 Register ch2 = rscratch2;
87 Register cnt1tmp = tmp1;
88 Register cnt2tmp = tmp2;
89 Register cnt1_neg = cnt1;
90 Register cnt2_neg = cnt2;
91 Register result_tmp = tmp4;
92
93 bool isL = ae == StrIntrinsicNode::LL;
94
|