equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright (c) 2016 SAP SE. All rights reserved. |
3 * Copyright (c) 2016, 2018 SAP SE. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. |
8 * published by the Free Software Foundation. |
37 |
37 |
38 #define __ ce->masm()-> |
38 #define __ ce->masm()-> |
39 #undef CHECK_BAILOUT |
39 #undef CHECK_BAILOUT |
40 #define CHECK_BAILOUT() { if (ce->compilation()->bailed_out()) return; } |
40 #define CHECK_BAILOUT() { if (ce->compilation()->bailed_out()) return; } |
41 |
41 |
42 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, |
42 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index, LIR_Opr array) |
43 bool throw_index_out_of_bounds_exception) : |
43 : _throw_index_out_of_bounds_exception(false), _index(index), _array(array) { |
44 _throw_index_out_of_bounds_exception(throw_index_out_of_bounds_exception), |
44 assert(info != NULL, "must have info"); |
45 _index(index) { |
45 _info = new CodeEmitInfo(info); |
|
46 } |
|
47 |
|
48 RangeCheckStub::RangeCheckStub(CodeEmitInfo* info, LIR_Opr index) |
|
49 : _throw_index_out_of_bounds_exception(true), _index(index), _array(NULL) { |
46 assert(info != NULL, "must have info"); |
50 assert(info != NULL, "must have info"); |
47 _info = new CodeEmitInfo(info); |
51 _info = new CodeEmitInfo(info); |
48 } |
52 } |
49 |
53 |
50 void RangeCheckStub::emit_code(LIR_Assembler* ce) { |
54 void RangeCheckStub::emit_code(LIR_Assembler* ce) { |
69 Runtime1::StubID stub_id; |
73 Runtime1::StubID stub_id; |
70 if (_throw_index_out_of_bounds_exception) { |
74 if (_throw_index_out_of_bounds_exception) { |
71 stub_id = Runtime1::throw_index_exception_id; |
75 stub_id = Runtime1::throw_index_exception_id; |
72 } else { |
76 } else { |
73 stub_id = Runtime1::throw_range_check_failed_id; |
77 stub_id = Runtime1::throw_range_check_failed_id; |
|
78 __ lgr_if_needed(Z_R0_scratch, _array->as_pointer_register()); |
74 } |
79 } |
75 ce->emit_call_c(Runtime1::entry_for (stub_id)); |
80 ce->emit_call_c(Runtime1::entry_for (stub_id)); |
76 CHECK_BAILOUT(); |
81 CHECK_BAILOUT(); |
77 ce->add_call_info_here(_info); |
82 ce->add_call_info_here(_info); |
78 ce->verify_oop_map(_info); |
83 ce->verify_oop_map(_info); |