Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/code/location.cpp
32285 views
/*1* Copyright (c) 1997, 2010, 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 it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 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 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "code/debugInfo.hpp"26#include "code/location.hpp"2728void Location::print_on(outputStream* st) const {29if(type() == invalid) {30// product of Location::invalid_loc() or Location::Location().31switch (where()) {32case on_stack: st->print("empty"); break;33case in_register: st->print("invalid"); break;34}35return;36}37switch (where()) {38case on_stack: st->print("stack[%d]", stack_offset()); break;39case in_register: st->print("reg %s [%d]", reg()->name(), register_number()); break;40default: st->print("Wrong location where %d", where());41}42switch (type()) {43case normal: break;44case oop: st->print(",oop"); break;45case narrowoop: st->print(",narrowoop"); break;46case int_in_long: st->print(",int"); break;47case lng: st->print(",long"); break;48case float_in_dbl: st->print(",float"); break;49case dbl: st->print(",double"); break;50case addr: st->print(",address"); break;51default: st->print("Wrong location type %d", type());52}53}545556Location::Location(DebugInfoReadStream* stream) {57_value = (juint) stream->read_int();58}596061void Location::write_on(DebugInfoWriteStream* stream) {62stream->write_int(_value);63}646566// Valid argument to Location::new_stk_loc()?67bool Location::legal_offset_in_bytes(int offset_in_bytes) {68if ((offset_in_bytes % BytesPerInt) != 0) return false;69return (juint)(offset_in_bytes / BytesPerInt) < (OFFSET_MASK >> OFFSET_SHIFT);70}717273