hotspot/src/share/vm/code/relocInfo.cpp
changeset 38133 78b95467b9f1
parent 36301 cb578d8c6cba
child 42044 c1e8e7815bf3
equal deleted inserted replaced
38132:ba888a4f352a 38133:78b95467b9f1
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    79   (*this) = prefix_relocInfo(plen);   // write new datalen
    79   (*this) = prefix_relocInfo(plen);   // write new datalen
    80   assert(data() + datalen() == prefix_limit, "pointers must line up");
    80   assert(data() + datalen() == prefix_limit, "pointers must line up");
    81   return (relocInfo*)prefix_limit;
    81   return (relocInfo*)prefix_limit;
    82 }
    82 }
    83 
    83 
    84 
       
    85 void relocInfo::set_type(relocType t) {
    84 void relocInfo::set_type(relocType t) {
    86   int old_offset = addr_offset();
    85   int old_offset = addr_offset();
    87   int old_format = format();
    86   int old_format = format();
    88   (*this) = relocInfo(t, old_offset, old_format);
    87   (*this) = relocInfo(t, old_offset, old_format);
    89   assert(type()==(int)t, "sanity check");
    88   assert(type()==(int)t, "sanity check");
    90   assert(addr_offset()==old_offset, "sanity check");
    89   assert(addr_offset()==old_offset, "sanity check");
    91   assert(format()==old_format, "sanity check");
    90   assert(format()==old_format, "sanity check");
    92 }
    91 }
    93 
    92 
       
    93 nmethod* RelocIterator::code_as_nmethod() const {
       
    94   return _code->as_nmethod();
       
    95 }
    94 
    96 
    95 void relocInfo::set_format(int f) {
    97 void relocInfo::set_format(int f) {
    96   int old_offset = addr_offset();
    98   int old_offset = addr_offset();
    97   assert((f & format_mask) == f, "wrong format");
    99   assert((f & format_mask) == f, "wrong format");
    98   _value = (_value & ~(format_mask << offset_width)) | (f << offset_width);
   100   _value = (_value & ~(format_mask << offset_width)) | (f << offset_width);
   119 
   121 
   120 
   122 
   121 // ----------------------------------------------------------------------------------------------------
   123 // ----------------------------------------------------------------------------------------------------
   122 // Implementation of RelocIterator
   124 // Implementation of RelocIterator
   123 
   125 
   124 void RelocIterator::initialize(nmethod* nm, address begin, address limit) {
   126 void RelocIterator::initialize(CompiledMethod* nm, address begin, address limit) {
   125   initialize_misc();
   127   initialize_misc();
   126 
   128 
   127   if (nm == NULL && begin != NULL) {
   129   if (nm == NULL && begin != NULL) {
   128     // allow nmethod to be deduced from beginning address
   130     // allow nmethod to be deduced from beginning address
   129     CodeBlob* cb = CodeCache::find_blob(begin);
   131     CodeBlob* cb = CodeCache::find_blob(begin);
   130     nm = cb->as_nmethod_or_null();
   132     nm = cb->as_compiled_method_or_null();
   131   }
   133   }
   132   assert(nm != NULL, "must be able to deduce nmethod from other arguments");
   134   assert(nm != NULL, "must be able to deduce nmethod from other arguments");
   133 
   135 
   134   _code    = nm;
   136   _code    = nm;
   135   _current = nm->relocation_begin() - 1;
   137   _current = nm->relocation_begin() - 1;