Mon, 12 Aug 2019 18:30:40 +0300
8223147: JFR Backport
8199712: Flight Recorder
8203346: JFR: Inconsistent signature of jfr_add_string_constant
8195817: JFR.stop should require name of recording
8195818: JFR.start should increase autogenerated name by one
8195819: Remove recording=x from jcmd JFR.check output
8203921: JFR thread sampling is missing fixes from JDK-8194552
8203929: Limit amount of data for JFR.dump
8203664: JFR start failure after AppCDS archive created with JFR StartFlightRecording
8003209: JFR events for network utilization
8207392: [PPC64] Implement JFR profiling
8202835: jfr/event/os/TestSystemProcess.java fails on missing events
Summary: Backport JFR from JDK11. Initial integration
Reviewed-by: neugens
duke@435 | 1 | /* |
vkempik@8498 | 2 | * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #include "precompiled.hpp" |
stefank@2314 | 26 | #include "interpreter/bytecodeStream.hpp" |
stefank@2314 | 27 | #include "interpreter/bytecodes.hpp" |
duke@435 | 28 | |
duke@435 | 29 | Bytecodes::Code RawBytecodeStream::raw_next_special(Bytecodes::Code code) { |
duke@435 | 30 | assert(!is_last_bytecode(), "should have been checked"); |
duke@435 | 31 | // set next bytecode position |
kamg@848 | 32 | address bcp = RawBytecodeStream::bcp(); |
kamg@848 | 33 | address end = method()->code_base() + end_bci(); |
vkempik@8498 | 34 | int len = Bytecodes::raw_special_length_at(bcp, end); |
vkempik@8498 | 35 | // Very large tableswitch or lookupswitch size can cause _next_bci to overflow. |
vkempik@8498 | 36 | if (len <= 0 || (_bci > _end_bci - len) || (_bci - len >= _next_bci)) { |
duke@435 | 37 | code = Bytecodes::_illegal; |
duke@435 | 38 | } else { |
vkempik@8498 | 39 | _next_bci += len; |
duke@435 | 40 | // set attributes |
duke@435 | 41 | _is_wide = false; |
duke@435 | 42 | // check for special (uncommon) cases |
duke@435 | 43 | if (code == Bytecodes::_wide) { |
kamg@848 | 44 | if (bcp + 1 >= end) { |
kamg@848 | 45 | code = Bytecodes::_illegal; |
kamg@848 | 46 | } else { |
kamg@848 | 47 | code = (Bytecodes::Code)bcp[1]; |
kamg@848 | 48 | _is_wide = true; |
kamg@848 | 49 | } |
duke@435 | 50 | } |
duke@435 | 51 | } |
jrose@1920 | 52 | _raw_code = code; |
duke@435 | 53 | return code; |
duke@435 | 54 | } |
jrose@1920 | 55 | |
jrose@1920 | 56 | #ifdef ASSERT |
jrose@1920 | 57 | void BaseBytecodeStream::assert_raw_index_size(int size) const { |
jrose@1920 | 58 | if (raw_code() == Bytecodes::_invokedynamic && is_raw()) { |
jrose@1920 | 59 | // in raw mode, pretend indy is "bJJ__" |
jrose@1920 | 60 | assert(size == 2, "raw invokedynamic instruction has 2-byte index only"); |
jrose@1920 | 61 | } else { |
never@2462 | 62 | bytecode().assert_index_size(size, raw_code(), is_wide()); |
jrose@1920 | 63 | } |
jrose@1920 | 64 | } |
jrose@1920 | 65 | |
jrose@1920 | 66 | void BaseBytecodeStream::assert_raw_stream(bool want_raw) const { |
jrose@1920 | 67 | if (want_raw) { |
jrose@1920 | 68 | assert( is_raw(), "this function only works on raw streams"); |
jrose@1920 | 69 | } else { |
jrose@1920 | 70 | assert(!is_raw(), "this function only works on non-raw streams"); |
jrose@1920 | 71 | } |
jrose@1920 | 72 | } |
jrose@1920 | 73 | #endif //ASSERT |