src/hotspot/share/code/vtableStubs.cpp
changeset 49655 d6893a76c554
parent 47216 71c04702a3d5
child 51618 54b344d9dd4e
equal deleted inserted replaced
49654:16f53c9c7493 49655:d6893a76c554
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2018, 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.
    58   if (_chunk == NULL || _chunk + real_size > _chunk_end) {
    58   if (_chunk == NULL || _chunk + real_size > _chunk_end) {
    59     const int bytes = chunk_factor * real_size + pd_code_alignment();
    59     const int bytes = chunk_factor * real_size + pd_code_alignment();
    60 
    60 
    61    // There is a dependency on the name of the blob in src/share/vm/prims/jvmtiCodeBlobEvents.cpp
    61    // There is a dependency on the name of the blob in src/share/vm/prims/jvmtiCodeBlobEvents.cpp
    62    // If changing the name, update the other file accordingly.
    62    // If changing the name, update the other file accordingly.
    63     BufferBlob* blob = BufferBlob::create("vtable chunks", bytes);
    63     VtableBlob* blob = VtableBlob::create("vtable chunks", bytes);
    64     if (blob == NULL) {
    64     if (blob == NULL) {
    65       return NULL;
    65       return NULL;
    66     }
    66     }
    67     _chunk = blob->content_begin();
    67     _chunk = blob->content_begin();
    68     _chunk_end = _chunk + bytes;
    68     _chunk_end = _chunk + bytes;
   165   s->set_next(_table[h]);
   165   s->set_next(_table[h]);
   166   _table[h] = s;
   166   _table[h] = s;
   167   _number_of_vtable_stubs++;
   167   _number_of_vtable_stubs++;
   168 }
   168 }
   169 
   169 
   170 
   170 VtableStub* VtableStubs::entry_point(address pc) {
   171 bool VtableStubs::is_entry_point(address pc) {
       
   172   MutexLocker ml(VtableStubs_lock);
   171   MutexLocker ml(VtableStubs_lock);
   173   VtableStub* stub = (VtableStub*)(pc - VtableStub::entry_offset());
   172   VtableStub* stub = (VtableStub*)(pc - VtableStub::entry_offset());
   174   uint hash = VtableStubs::hash(stub->is_vtable_stub(), stub->index());
   173   uint hash = VtableStubs::hash(stub->is_vtable_stub(), stub->index());
   175   VtableStub* s;
   174   VtableStub* s;
   176   for (s = _table[hash]; s != NULL && s != stub; s = s->next()) {}
   175   for (s = _table[hash]; s != NULL && s != stub; s = s->next()) {}
   177   return s == stub;
   176   if (s == stub) {
   178 }
   177     return s;
   179 
   178   }
       
   179   return NULL;
       
   180 }
   180 
   181 
   181 bool VtableStubs::contains(address pc) {
   182 bool VtableStubs::contains(address pc) {
   182   // simple solution for now - we may want to use
   183   // simple solution for now - we may want to use
   183   // a faster way if this function is called often
   184   // a faster way if this function is called often
   184   return stub_containing(pc) != NULL;
   185   return stub_containing(pc) != NULL;