src/share/vm/code/dependencies.cpp

Print this page


   1 /*
   2  * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
   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 it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 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 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 # include "incls/_precompiled.incl"
  26 # include "incls/_dependencies.cpp.incl"








  27 
  28 
  29 #ifdef ASSERT
  30 static bool must_be_in_vm() {
  31   Thread* thread = Thread::current();
  32   if (thread->is_Java_thread())
  33     return ((JavaThread*)thread)->thread_state() == _thread_in_vm;
  34   else
  35     return true;  //something like this: thread->is_VM_thread();
  36 }
  37 #endif //ASSERT
  38 
  39 void Dependencies::initialize(ciEnv* env) {
  40   Arena* arena = env->arena();
  41   _oop_recorder = env->oop_recorder();
  42   _log = env->log();
  43   _dep_seen = new(arena) GrowableArray<int>(arena, 500, 0, 0);
  44   DEBUG_ONLY(_deps[end_marker] = NULL);
  45   for (int i = (int)FIRST_TYPE; i < (int)TYPE_LIMIT; i++) {
  46     _deps[i] = new(arena) GrowableArray<ciObject*>(arena, 10, 0, 0);


   1 /*
   2  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
   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 it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 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 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "ci/ciArrayKlass.hpp"
  27 #include "ci/ciEnv.hpp"
  28 #include "ci/ciKlass.hpp"
  29 #include "ci/ciMethod.hpp"
  30 #include "code/dependencies.hpp"
  31 #include "compiler/compileLog.hpp"
  32 #include "oops/oop.inline.hpp"
  33 #include "runtime/handles.inline.hpp"
  34 #include "utilities/copy.hpp"
  35 
  36 
  37 #ifdef ASSERT
  38 static bool must_be_in_vm() {
  39   Thread* thread = Thread::current();
  40   if (thread->is_Java_thread())
  41     return ((JavaThread*)thread)->thread_state() == _thread_in_vm;
  42   else
  43     return true;  //something like this: thread->is_VM_thread();
  44 }
  45 #endif //ASSERT
  46 
  47 void Dependencies::initialize(ciEnv* env) {
  48   Arena* arena = env->arena();
  49   _oop_recorder = env->oop_recorder();
  50   _log = env->log();
  51   _dep_seen = new(arena) GrowableArray<int>(arena, 500, 0, 0);
  52   DEBUG_ONLY(_deps[end_marker] = NULL);
  53   for (int i = (int)FIRST_TYPE; i < (int)TYPE_LIMIT; i++) {
  54     _deps[i] = new(arena) GrowableArray<ciObject*>(arena, 10, 0, 0);