hotspot/src/share/vm/classfile/placeholders.cpp
changeset 15188 3916ac601e04
parent 14488 ab48109f7d1b
child 33611 9abd65805e19
equal deleted inserted replaced
15187:fb364e5a0b34 15188:3916ac601e04
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2013, 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.
   140   if (probe) probe->add_seen_thread(thread, action);
   140   if (probe) probe->add_seen_thread(thread, action);
   141   return probe;
   141   return probe;
   142 }
   142 }
   143 
   143 
   144 
   144 
   145 // placeholder used to track class loading internal states
   145 // placeholder is used to track class loading internal states
   146 // placeholder existence now for loading superclass/superinterface
   146 // placeholder existence now for loading superclass/superinterface
   147 // superthreadQ tracks class circularity, while loading superclass/superinterface
   147 // superthreadQ tracks class circularity, while loading superclass/superinterface
   148 // loadInstanceThreadQ tracks load_instance_class calls
   148 // loadInstanceThreadQ tracks load_instance_class calls
   149 // definer() tracks the single thread that owns define token
   149 // definer() tracks the single thread that owns define token
   150 // defineThreadQ tracks waiters on defining thread's results
   150 // defineThreadQ tracks waiters on defining thread's results
   151 // 1st claimant creates placeholder
   151 // 1st claimant creates placeholder
   152 // find_and_add adds SeenThread entry for appropriate queue
   152 // find_and_add adds SeenThread entry for appropriate queue
   153 // All claimants remove SeenThread after completing action
   153 // All claimants remove SeenThread after completing action
   154 // On removal: if definer and all queues empty, remove entry
   154 // On removal: if definer and all queues empty, remove entry
   155 // Note: you can be in both placeholders and systemDictionary
   155 // Note: you can be in both placeholders and systemDictionary
   156 // see parse_stream for redefine classes
       
   157 // Therefore - must always check SD first
   156 // Therefore - must always check SD first
   158 // Ignores the case where entry is not found
   157 // Ignores the case where entry is not found
   159 void PlaceholderTable::find_and_remove(int index, unsigned int hash,
   158 void PlaceholderTable::find_and_remove(int index, unsigned int hash,
   160                        Symbol* name, ClassLoaderData* loader_data, Thread* thread) {
   159                                        Symbol* name, ClassLoaderData* loader_data,
       
   160                                        classloadAction action,
       
   161                                        Thread* thread) {
   161     assert_locked_or_safepoint(SystemDictionary_lock);
   162     assert_locked_or_safepoint(SystemDictionary_lock);
   162     PlaceholderEntry *probe = get_entry(index, hash, name, loader_data);
   163     PlaceholderEntry *probe = get_entry(index, hash, name, loader_data);
   163     if (probe != NULL) {
   164     if (probe != NULL) {
   164        // No other threads using this entry
   165        probe->remove_seen_thread(thread, action);
       
   166        // If no other threads using this entry, and this thread is not using this entry for other states
   165        if ((probe->superThreadQ() == NULL) && (probe->loadInstanceThreadQ() == NULL)
   167        if ((probe->superThreadQ() == NULL) && (probe->loadInstanceThreadQ() == NULL)
   166           && (probe->defineThreadQ() == NULL) && (probe->definer() == NULL)) {
   168           && (probe->defineThreadQ() == NULL) && (probe->definer() == NULL)) {
   167          remove_entry(index, hash, name, loader_data);
   169          remove_entry(index, hash, name, loader_data);
   168        }
   170        }
   169     }
   171     }