Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/shark/sharkStateScanner.cpp
32285 views
/*1* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.2* Copyright 2008, 2009 Red Hat, Inc.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 it6* under the terms of the GNU General Public License version 2 only, as7* published by the Free Software Foundation.8*9* This code is distributed in the hope that it will be useful, but WITHOUT10* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12* version 2 for more details (a copy is included in the LICENSE file that13* accompanied this code).14*15* You should have received a copy of the GNU General Public License version16* 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 USA20* or visit www.oracle.com if you need additional information or have any21* questions.22*23*/2425#include "precompiled.hpp"26#include "shark/sharkState.hpp"27#include "shark/sharkStateScanner.hpp"2829using namespace llvm;3031void SharkStateScanner::scan(SharkState* state) {32start_frame();3334// Expression stack35stack_integrity_checks(state);36start_stack(state->stack_depth());37for (int i = state->stack_depth() - 1; i >= 0; i--) {38process_stack_slot(39i,40state->stack_addr(i),41stack()->stack_slots_offset() +42i + max_stack() - state->stack_depth());43}44end_stack();4546// Monitors47start_monitors(state->num_monitors());48for (int i = 0; i < state->num_monitors(); i++) {49process_monitor(50i,51stack()->monitor_offset(i),52stack()->monitor_object_offset(i));53}54end_monitors();5556// Frame header57start_frame_header();58process_oop_tmp_slot(59state->oop_tmp_addr(), stack()->oop_tmp_slot_offset());60process_method_slot(state->method_addr(), stack()->method_slot_offset());61process_pc_slot(stack()->pc_slot_offset());62end_frame_header();6364// Local variables65locals_integrity_checks(state);66start_locals();67for (int i = 0; i < max_locals(); i++) {68process_local_slot(69i,70state->local_addr(i),71stack()->locals_slots_offset() + max_locals() - 1 - i);72}73end_locals();7475end_frame();76}7778#ifndef PRODUCT79void SharkStateScanner::stack_integrity_checks(SharkState* state) {80for (int i = 0; i < state->stack_depth(); i++) {81if (state->stack(i)) {82if (state->stack(i)->is_two_word())83assert(state->stack(i - 1) == NULL, "should be");84}85else {86assert(state->stack(i + 1)->is_two_word(), "should be");87}88}89}9091void SharkStateScanner::locals_integrity_checks(SharkState* state) {92for (int i = 0; i < max_locals(); i++) {93if (state->local(i)) {94if (state->local(i)->is_two_word())95assert(state->local(i + 1) == NULL, "should be");96}97}98}99#endif // !PRODUCT100101102