changeset 7094:eec7173947a1

removed remaining use of the C++ "compiler interface" (i.e. ci) by Graal for installing dependencies
author Doug Simon <doug.simon@oracle.com>
date Thu, 29 Nov 2012 17:13:13 +0100
parents dff79b1f82f1
children b3c94e1e18e9
files src/share/vm/code/dependencies.cpp src/share/vm/code/dependencies.hpp src/share/vm/graal/graalCodeInstaller.cpp src/share/vm/graal/graalCodeInstaller.hpp src/share/vm/graal/graalCompiler.cpp src/share/vm/graal/graalCompilerToVM.cpp src/share/vm/graal/graalEnv.cpp src/share/vm/graal/graalEnv.hpp
diffstat 8 files changed, 310 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/code/dependencies.cpp	Thu Nov 29 10:18:32 2012 +0100
+++ b/src/share/vm/code/dependencies.cpp	Thu Nov 29 17:13:13 2012 +0100
@@ -50,6 +50,9 @@
   _oop_recorder = env->oop_recorder();
   _log = env->log();
   _dep_seen = new(arena) GrowableArray<int>(arena, 500, 0, 0);
+#ifdef GRAAL
+  _using_dep_values = false;
+#endif // GRAAL
   DEBUG_ONLY(_deps[end_marker] = NULL);
   for (int i = (int)FIRST_TYPE; i < (int)TYPE_LIMIT; i++) {
     _deps[i] = new(arena) GrowableArray<ciBaseObject*>(arena, 10, 0, 0);
@@ -119,6 +122,55 @@
   assert_common_2(call_site_target_value, call_site, method_handle);
 }
 
+#ifdef GRAAL
+
+Dependencies::Dependencies(Arena* arena, OopRecorder* oop_recorder) {
+  _oop_recorder = oop_recorder;
+  _log = NULL;
+  _dep_seen = new(arena) GrowableArray<int>(arena, 500, 0, 0);
+  _using_dep_values = true;
+  DEBUG_ONLY(_dep_values[end_marker] = NULL);
+  for (int i = (int)FIRST_TYPE; i < (int)TYPE_LIMIT; i++) {
+    _dep_values[i] = new(arena) GrowableArray<DepValue>(arena, 10, 0, DepValue());
+  }
+  _content_bytes = NULL;
+  _size_in_bytes = (size_t)-1;
+
+  assert(TYPE_LIMIT <= (1<<LG2_TYPE_LIMIT), "sanity");
+}
+
+void Dependencies::assert_evol_method(DepValue m) {
+  assert_common_1(evol_method, m);
+}
+
+void Dependencies::assert_leaf_type(DepValue ctxk_dv) {
+  Klass* ctxk = ctxk_dv.as_klass();
+  if (ctxk->oop_is_array()) {
+    // As a special case, support this assertion on an array type,
+    // which reduces to an assertion on its element type.
+    // Note that this cannot be done with assertions that
+    // relate to concreteness or abstractness.
+    BasicType elemt = ArrayKlass::cast(ctxk)->element_type();
+    if (is_java_primitive(elemt))  return;   // Ex:  int[][]
+    ctxk = ObjArrayKlass::cast(ctxk)->bottom_klass();
+    //if (ctxk->is_final())  return;            // Ex:  String[][]
+  }
+  check_ctxk(ctxk);
+  assert_common_1(leaf_type, ctxk_dv);
+}
+
+void Dependencies::assert_abstract_with_unique_concrete_subtype(DepValue ctxk, DepValue conck) {
+  check_ctxk_abstract(ctxk.as_klass());
+  assert_common_2(abstract_with_unique_concrete_subtype, ctxk, conck);
+}
+
+void Dependencies::assert_unique_concrete_method(DepValue ctxk, DepValue uniqm) {
+  check_ctxk(ctxk.as_klass());
+  assert_common_2(unique_concrete_method, ctxk, uniqm);
+}
+#endif // GRAAL
+
+
 // Helper function.  If we are adding a new dep. under ctxk2,
 // try to find an old dep. under a broader* ctxk1.  If there is
 //
@@ -230,6 +282,78 @@
   deps->append(x2);
 }
 
+#ifdef GRAAL
+bool Dependencies::maybe_merge_ctxk(GrowableArray<DepValue>* deps,
+                                    int ctxk_i, DepValue ctxk2_dv) {
+  Klass* ctxk1 = deps->at(ctxk_i).as_klass();
+  Klass* ctxk2 = ctxk2_dv.as_klass();
+  if (ctxk2->is_subtype_of(ctxk1)) {
+    return true;  // success, and no need to change
+  } else if (ctxk1->is_subtype_of(ctxk2)) {
+    // new context class fully subsumes previous one
+    deps->at_put(ctxk_i, ctxk2_dv);
+    return true;
+  } else {
+    return false;
+  }
+}
+
+void Dependencies::assert_common_1(DepType dept, DepValue x) {
+  assert(dep_args(dept) == 1, "sanity");
+  //log_dependency(dept, x);
+  GrowableArray<DepValue>* deps = _dep_values[dept];
+
+  // see if the same (or a similar) dep is already recorded
+  if (note_dep_seen(dept, x)) {
+    assert(deps->find(x) >= 0, "sanity");
+  } else {
+    deps->append(x);
+  }
+}
+
+void Dependencies::assert_common_2(DepType dept,
+                                   DepValue x0, DepValue x1) {
+  assert(dep_args(dept) == 2, "sanity");
+  //log_dependency(dept, x0, x1);
+  GrowableArray<DepValue>* deps = _dep_values[dept];
+
+  // see if the same (or a similar) dep is already recorded
+  bool has_ctxk = has_explicit_context_arg(dept);
+  if (has_ctxk) {
+    assert(dep_context_arg(dept) == 0, "sanity");
+    if (note_dep_seen(dept, x1)) {
+      // look in this bucket for redundant assertions
+      const int stride = 2;
+      for (int i = deps->length(); (i -= stride) >= 0; ) {
+        DepValue y1 = deps->at(i+1);
+        if (x1 == y1) {  // same subject; check the context
+          if (maybe_merge_ctxk(deps, i+0, x0)) {
+            return;
+          }
+        }
+      }
+    }
+  } else {
+    assert(dep_implicit_context_arg(dept) == 0, "sanity");
+    if (note_dep_seen(dept, x0) && note_dep_seen(dept, x1)) {
+      // look in this bucket for redundant assertions
+      const int stride = 2;
+      for (int i = deps->length(); (i -= stride) >= 0; ) {
+        DepValue y0 = deps->at(i+0);
+        DepValue y1 = deps->at(i+1);
+        if (x0 == y0 && x1 == y1) {
+          return;
+        }
+      }
+    }
+  }
+
+  // append the assertion in the correct bucket:
+  deps->append(x0);
+  deps->append(x1);
+}
+#endif // GRAAL
+
 /// Support for encoding dependencies into an nmethod:
 
 void Dependencies::copy_to(nmethod* nm) {
@@ -256,7 +380,40 @@
 static int sort_dep_arg_3(ciBaseObject** p1, ciBaseObject** p2)
 { return sort_dep(p1, p2, 3); }
 
+#ifdef GRAAL
+// metadata deps are sorted before object deps
+static int sort_dep_value(DepValue* p1, DepValue* p2, int narg) {
+  for (int i = 0; i < narg; i++) {
+    int diff = p1[i].sort_key() - p2[i].sort_key();
+    if (diff != 0)  return diff;
+  }
+  return 0;
+}
+static int sort_dep_value_arg_1(DepValue* p1, DepValue* p2)
+{ return sort_dep_value(p1, p2, 1); }
+static int sort_dep_value_arg_2(DepValue* p1, DepValue* p2)
+{ return sort_dep_value(p1, p2, 2); }
+static int sort_dep_value_arg_3(DepValue* p1, DepValue* p2)
+{ return sort_dep_value(p1, p2, 3); }
+#endif // GRAAL
+
 void Dependencies::sort_all_deps() {
+#ifdef GRAAL
+  if (_using_dep_values) {
+    for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) {
+      DepType dept = (DepType)deptv;
+      GrowableArray<DepValue>* deps = _dep_values[dept];
+      if (deps->length() <= 1)  continue;
+      switch (dep_args(dept)) {
+      case 1: deps->sort(sort_dep_value_arg_1, 1); break;
+      case 2: deps->sort(sort_dep_value_arg_2, 2); break;
+      case 3: deps->sort(sort_dep_value_arg_3, 3); break;
+      default: ShouldNotReachHere();
+      }
+    }
+    return;
+  }
+#endif // GRAAL
   for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) {
     DepType dept = (DepType)deptv;
     GrowableArray<ciBaseObject*>* deps = _deps[dept];
@@ -272,6 +429,16 @@
 
 size_t Dependencies::estimate_size_in_bytes() {
   size_t est_size = 100;
+#ifdef GRAAL
+  if (_using_dep_values) {
+    for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) {
+      DepType dept = (DepType)deptv;
+      GrowableArray<DepValue>* deps = _dep_values[dept];
+      est_size += deps->length() * 2;  // tags and argument(s)
+    }
+    return est_size;
+  }
+#endif // GRAAL
   for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) {
     DepType dept = (DepType)deptv;
     GrowableArray<ciBaseObject*>* deps = _deps[dept];
@@ -311,6 +478,37 @@
   // cast is safe, no deps can overflow INT_MAX
   CompressedWriteStream bytes((int)estimate_size_in_bytes());
 
+#ifdef GRAAL
+  if (_using_dep_values) {
+    for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) {
+      DepType dept = (DepType)deptv;
+      GrowableArray<DepValue>* deps = _dep_values[dept];
+      if (deps->length() == 0)  continue;
+      int stride = dep_args(dept);
+      int ctxkj  = dep_context_arg(dept);  // -1 if no context arg
+      assert(stride > 0, "sanity");
+      for (int i = 0; i < deps->length(); i += stride) {
+        jbyte code_byte = (jbyte)dept;
+        int skipj = -1;
+        if (ctxkj >= 0 && ctxkj+1 < stride) {
+          Klass*  ctxk = deps->at(i+ctxkj+0).as_klass();
+          DepValue x     = deps->at(i+ctxkj+1);  // following argument
+          if (ctxk == ctxk_encoded_as_null(dept, x.as_metadata())) {
+            skipj = ctxkj;  // we win:  maybe one less oop to keep track of
+            code_byte |= default_context_type_bit;
+          }
+        }
+        bytes.write_byte(code_byte);
+        for (int j = 0; j < stride; j++) {
+          if (j == skipj)  continue;
+          DepValue v = deps->at(i+j);
+          int idx = v.index();
+          bytes.write_int(idx);
+        }
+      }
+    }
+  } else {
+#endif // GRAAL
   for (int deptv = (int)FIRST_TYPE; deptv < (int)TYPE_LIMIT; deptv++) {
     DepType dept = (DepType)deptv;
     GrowableArray<ciBaseObject*>* deps = _deps[dept];
@@ -344,6 +542,9 @@
       }
     }
   }
+#ifdef GRAAL
+  }
+#endif // GRAAL
 
   // write a sentinel byte to mark the end
   bytes.write_byte(end_marker);
@@ -360,7 +561,6 @@
   _size_in_bytes = bytes.position();
 }
 
-
 const char* Dependencies::_dep_name[TYPE_LIMIT] = {
   "end_marker",
   "evol_method",
--- a/src/share/vm/code/dependencies.hpp	Thu Nov 29 10:18:32 2012 +0100
+++ b/src/share/vm/code/dependencies.hpp	Thu Nov 29 17:13:13 2012 +0100
@@ -59,6 +59,43 @@
 class   CallSiteDepChange;
 class No_Safepoint_Verifier;
 
+#ifdef GRAAL
+
+// Dependency values that don't rely on the ciBaseObject types.
+class DepValue VALUE_OBJ_CLASS_SPEC {
+private:
+  OopRecorder* _oop_recorder;
+  int _index; // positive -> metadata, negative -> object
+
+public:
+  DepValue() : _oop_recorder(NULL), _index(max_jint) {}
+  DepValue(OopRecorder* oop_recorder, Metadata* metadata) : _oop_recorder(oop_recorder) {
+    int index = oop_recorder->find_index(metadata);
+    _index = index;
+  }
+  DepValue(OopRecorder* oop_recorder, jobject obj) : _oop_recorder(oop_recorder) {
+    int index = oop_recorder->find_index(obj);
+    _index = -(index + 1);
+  }
+
+  // Used to sort values in order of index with metadata values preceding object values
+  int sort_key() const { return -_index; }
+
+  bool operator == (const DepValue& dv) const   { return dv._oop_recorder == _oop_recorder && dv._index == _index; }
+
+  bool is_valid() const             { return _index != max_jint; }
+  int  index() const                { assert(is_valid(), "oops"); return _index < 0 ? -(_index + 1) : _index; }
+  bool is_metadata() const          { assert(is_valid(), "oops"); return _index >= 0; }
+  bool is_method() const            { assert(is_valid(), "oops"); return as_metadata()->is_method(); }
+  bool is_klass() const             { assert(is_valid(), "oops"); return as_metadata()->is_klass(); }
+  bool is_object() const            { return !is_metadata(); }
+
+  Metadata*  as_metadata() const    { assert(is_metadata(), "oops"); return _oop_recorder->metadata_at(index()); }
+  Klass*     as_klass() const       { assert(is_klass(), "oops"); return (Klass*) as_metadata(); }
+  Method*    as_method() const      { assert(is_method(), "oops"); return (Method*) as_metadata(); }
+};
+#endif
+
 class Dependencies: public ResourceObj {
  public:
   // Note: In the comments on dependency types, most uses of the terms
@@ -204,6 +241,10 @@
   // State for writing a new set of dependencies:
   GrowableArray<int>*       _dep_seen;  // (seen[h->ident] & (1<<dept))
   GrowableArray<ciBaseObject*>*  _deps[TYPE_LIMIT];
+#ifdef GRAAL
+  bool _using_dep_values;
+  GrowableArray<DepValue>*  _dep_values[TYPE_LIMIT];
+#endif
 
   static const char* _dep_name[TYPE_LIMIT];
   static int         _dep_args[TYPE_LIMIT];
@@ -222,8 +263,25 @@
     return (seen & (1<<dept)) != 0;
   }
 
+#ifdef GRAAL
+  bool note_dep_seen(int dept, DepValue x) {
+    assert(dept < BitsPerInt, "oops");
+    // place metadata deps at even indexes, object deps at odd indexes
+    int x_id = x.is_metadata() ? x.index() * 2 : (x.index() * 2) + 1;
+    assert(_dep_seen != NULL, "deps must be writable");
+    int seen = _dep_seen->at_grow(x_id, 0);
+    _dep_seen->at_put(x_id, seen | (1<<dept));
+    // return true if we've already seen dept/x
+    return (seen & (1<<dept)) != 0;
+  }
+#endif
+
   bool maybe_merge_ctxk(GrowableArray<ciBaseObject*>* deps,
                         int ctxk_i, ciKlass* ctxk);
+#ifdef GRAAL
+  bool maybe_merge_ctxk(GrowableArray<DepValue>* deps,
+                        int ctxk_i, DepValue ctxk);
+#endif
 
   void sort_all_deps();
   size_t estimate_size_in_bytes();
@@ -245,6 +303,9 @@
   Dependencies(ciEnv* env) {
     initialize(env);
   }
+#ifdef GRAAL
+  Dependencies(Arena* arena, OopRecorder* oop_recorder);
+#endif // GRAAL
 
  private:
   // Check for a valid context type.
@@ -277,6 +338,25 @@
   void assert_has_no_finalizable_subclasses(ciKlass* ctxk);
   void assert_call_site_target_value(ciCallSite* call_site, ciMethodHandle* method_handle);
 
+#ifdef GRAAL
+ private:
+  static void check_ctxk(Klass* ctxk) {
+    assert(ctxk->oop_is_instance(), "java types only");
+  }
+  static void check_ctxk_abstract(Klass* ctxk) {
+    check_ctxk(ctxk);
+    assert(ctxk->is_abstract(), "must be abstract");
+  }
+  void assert_common_1(DepType dept, DepValue x);
+  void assert_common_2(DepType dept, DepValue x0, DepValue x1);
+
+ public:
+  void assert_evol_method(DepValue m);
+  void assert_leaf_type(DepValue ctxk);
+  void assert_unique_concrete_method(DepValue ctxk, DepValue uniqm);
+  void assert_abstract_with_unique_concrete_subtype(DepValue ctxk, DepValue conck);
+#endif // GRAAL
+
   // Define whether a given method or type is concrete.
   // These methods define the term "concrete" as used in this module.
   // For this module, an "abstract" class is one which is non-concrete.
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Thu Nov 29 10:18:32 2012 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Thu Nov 29 17:13:13 2012 +0100
@@ -264,9 +264,8 @@
 }
 
 void CodeInstaller::initialize_assumptions(oop target_method) {
-  _oop_recorder = new OopRecorder(_env->arena());
-  _env->set_oop_recorder(_oop_recorder);
-  _dependencies = new Dependencies(_env);
+  _oop_recorder = new OopRecorder(&_arena);
+  _dependencies = new Dependencies(&_arena, _oop_recorder);
   Handle assumptions_handle = CompilationResult::assumptions(HotSpotCompilationResult::comp(target_method));
   if (!assumptions_handle.is_null()) {
     objArrayHandle assumptions(Thread::current(), (objArrayOop)Assumptions::list(assumptions_handle()));
@@ -291,7 +290,6 @@
 
 // constructor used to create a method
 CodeInstaller::CodeInstaller(Handle& comp_result, methodHandle method, GraalEnv::CodeInstallResult& result, nmethod*& nm, Handle installed_code) {
-  _env = CURRENT_ENV;
   GraalCompiler::initialize_buffer_blob();
   CodeBuffer buffer(JavaThread::current()->get_buffer_blob());
   jobject comp_result_obj = JNIHandles::make_local(comp_result());
@@ -316,10 +314,8 @@
 // constructor used to create a stub
 CodeInstaller::CodeInstaller(Handle& target_method, BufferBlob*& blob, jlong& id) {
   No_Safepoint_Verifier no_safepoint;
-  _env = CURRENT_ENV;
   
-  _oop_recorder = new OopRecorder(_env->arena());
-  _env->set_oop_recorder(_oop_recorder);
+  _oop_recorder = new OopRecorder(&_arena);
   initialize_fields(target_method(), NULL);
   assert(_name != NULL, "installMethod needs NON-NULL name");
 
@@ -365,10 +361,9 @@
   buffer.initialize_stubs_size(256);
   buffer.initialize_consts_size(_constants_size);
 
-  _debug_recorder = new DebugInformationRecorder(_env->oop_recorder());
+  _debug_recorder = new DebugInformationRecorder(_oop_recorder);
   _debug_recorder->set_oopmaps(new OopMapSet());
   
-  _env->set_debug_info(_debug_recorder);
   buffer.initialize_oop_recorder(_oop_recorder);
 
   _instructions = buffer.insts();
@@ -404,33 +399,35 @@
 void CodeInstaller::assumption_MethodContents(Handle assumption) {
   Handle method_handle = Assumptions_MethodContents::method(assumption());
   methodHandle method = getMethodFromHotSpotMethod(method_handle());
-  ciMethod* m = (ciMethod*) CURRENT_ENV->get_method(method());
-
-  _dependencies->assert_evol_method(m);
+  DepValue method_dv(_oop_recorder, method());
+  _dependencies->assert_evol_method(method_dv);
 }
 
 void CodeInstaller::assumption_ConcreteSubtype(Handle assumption) {
   Handle context_handle = Assumptions_ConcreteSubtype::context(assumption());
-  ciKlass* context = (ciKlass*) CURRENT_ENV->get_klass(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(context_handle)));
-
-  Handle type_handle = Assumptions_ConcreteSubtype::subtype(assumption());
-  ciKlass* type = (ciKlass*) CURRENT_ENV->get_klass(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(type_handle)));
+  Handle subtype_handle = Assumptions_ConcreteSubtype::subtype(assumption());
+  Klass* context = asKlass(HotSpotResolvedObjectType::metaspaceKlass(context_handle));
+  Klass* subtype = asKlass(HotSpotResolvedObjectType::metaspaceKlass(subtype_handle));
 
-  _dependencies->assert_leaf_type(type);
-  if (context != type) {
+  DepValue subtype_dv(_oop_recorder, subtype);
+  _dependencies->assert_leaf_type(subtype_dv);
+  if (context != subtype) {
     assert(context->is_abstract(), "");
-    _dependencies->assert_abstract_with_unique_concrete_subtype(context, type);
+    DepValue context_dv(_oop_recorder, context);
+    _dependencies->assert_abstract_with_unique_concrete_subtype(context_dv, subtype_dv);
   }
 }
 
 void CodeInstaller::assumption_ConcreteMethod(Handle assumption) {
   Handle impl_handle = Assumptions_ConcreteMethod::impl(assumption());
+  Handle context_handle = Assumptions_ConcreteMethod::context(assumption());
+
   methodHandle impl = getMethodFromHotSpotMethod(impl_handle());
-  ciMethod* m = (ciMethod*) CURRENT_ENV->get_method(impl());
-  
-  Handle context_handle = Assumptions_ConcreteMethod::context(assumption());
-  ciKlass* context = (ciKlass*) CURRENT_ENV->get_klass(java_lang_Class::as_Klass(HotSpotResolvedObjectType::javaMirror(context_handle)));
-  _dependencies->assert_unique_concrete_method(context, m);
+  Klass* context = asKlass(HotSpotResolvedObjectType::metaspaceKlass(context_handle));
+
+  DepValue context_dv(_oop_recorder, context);
+  DepValue impl_dv(_oop_recorder, impl());
+  _dependencies->assert_unique_concrete_method(context_dv, impl_dv);
 }
 
 void CodeInstaller::process_exception_handlers() {
--- a/src/share/vm/graal/graalCodeInstaller.hpp	Thu Nov 29 10:18:32 2012 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.hpp	Thu Nov 29 17:13:13 2012 +0100
@@ -54,7 +54,7 @@
     MARK_ACCESS_FIELD_PATCHING      = 0x4002
   };
 
-  ciEnv*        _env;
+  Arena         _arena;
 
   oop           _comp_result;
   oop           _name;
--- a/src/share/vm/graal/graalCompiler.cpp	Thu Nov 29 10:18:32 2012 +0100
+++ b/src/share/vm/graal/graalCompiler.cpp	Thu Nov 29 17:13:13 2012 +0100
@@ -161,13 +161,11 @@
 
   assert(_initialized, "must already be initialized");
   ResourceMark rm;
-  ciEnv* current_env = JavaThread::current()->env();
-  JavaThread::current()->set_env(NULL);
+  assert(JavaThread::current()->env() == NULL, "ciEnv should be null");
   JavaThread::current()->set_compiling(true);
   Handle holder = GraalCompiler::createHotSpotResolvedObjectType(method, CHECK);
   jboolean success = VMToCompiler::compileMethod(method(), holder, entry_bci, blocking, method->graal_priority());
   JavaThread::current()->set_compiling(false);
-  JavaThread::current()->set_env(current_env);
   if (success != JNI_TRUE) {
     method->clear_queued_for_compilation();
     CompilationPolicy::policy()->delay_compilation(method());
--- a/src/share/vm/graal/graalCompilerToVM.cpp	Thu Nov 29 10:18:32 2012 +0100
+++ b/src/share/vm/graal/graalCompilerToVM.cpp	Thu Nov 29 17:13:13 2012 +0100
@@ -28,7 +28,6 @@
 #include "oops/fieldStreams.hpp"
 #include "runtime/javaCalls.hpp"
 #include "c1/c1_Runtime1.hpp"
-#include "ci/ciMethodData.hpp"
 #include "compiler/compileBroker.hpp"
 #include "compiler/compilerOracle.hpp"
 #include "graal/graalCompilerToVM.hpp"
@@ -741,8 +740,6 @@
   Handle compResultHandle = JNIHandles::resolve(compResult);
   nmethod* nm = NULL;
   methodHandle method = getMethodFromHotSpotMethod(HotSpotCompilationResult::method(compResult));
-  Arena arena;
-  ciEnv env(&arena);
   Handle installed_code_handle = JNIHandles::resolve(installed_code);
   GraalEnv::CodeInstallResult result;
   CodeInstaller installer(compResultHandle, method, result, nm, installed_code_handle);
--- a/src/share/vm/graal/graalEnv.cpp	Thu Nov 29 10:18:32 2012 +0100
+++ b/src/share/vm/graal/graalEnv.cpp	Thu Nov 29 17:13:13 2012 +0100
@@ -45,8 +45,6 @@
 #include "c1/c1_Runtime1.hpp"
 
 // ------------------------------------------------------------------
-// ciEnv::check_klass_accessiblity
-//
 // Note: the logic of this method should mirror the logic of
 // constantPoolOopDesc::verify_constant_pool_resolve.
 bool GraalEnv::check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass) {
@@ -68,7 +66,6 @@
 }
 
 // ------------------------------------------------------------------
-// ciEnv::get_klass_by_name_impl
 KlassHandle GraalEnv::get_klass_by_name_impl(KlassHandle& accessing_klass,
                                           constantPoolHandle& cpool,
                                           Symbol* sym,
@@ -120,7 +117,7 @@
                                                  sym->utf8_length()-1,
                                                  CHECK_(KlassHandle()));
 
-    // Get element ciKlass recursively.
+    // Get element Klass recursively.
     KlassHandle elem_klass =
       get_klass_by_name_impl(accessing_klass,
                              cpool,
@@ -148,7 +145,6 @@
 }
 
 // ------------------------------------------------------------------
-// ciEnv::get_klass_by_name
 KlassHandle GraalEnv::get_klass_by_name(KlassHandle& accessing_klass,
                                   Symbol* klass_name,
                                   bool require_local) {
@@ -161,8 +157,6 @@
 }
 
 // ------------------------------------------------------------------
-// ciEnv::get_klass_by_index_impl
-//
 // Implementation of get_klass_by_index.
 KlassHandle GraalEnv::get_klass_by_index_impl(constantPoolHandle& cpool,
                                         int index,
@@ -222,8 +216,6 @@
 }
 
 // ------------------------------------------------------------------
-// ciEnv::get_klass_by_index
-//
 // Get a klass from the constant pool.
 KlassHandle GraalEnv::get_klass_by_index(constantPoolHandle& cpool,
                                    int index,
@@ -235,8 +227,6 @@
 }
 
 // ------------------------------------------------------------------
-// ciEnv::get_field_by_index_impl
-//
 // Implementation of get_field_by_index.
 //
 // Implementation note: the results of field lookups are cached
@@ -257,9 +247,6 @@
   Symbol* signature = cpool->symbol_at(sig_index);
 
   // Get the field's declared holder.
-  //
-  // Note: we actually create a ciInstanceKlass for this klass,
-  // even though we may not need to.
   int holder_index = cpool->klass_ref_index_at(index);
   bool holder_is_accessible;
   KlassHandle declared_holder = get_klass_by_index(cpool, holder_index,
@@ -284,8 +271,6 @@
 }
 
 // ------------------------------------------------------------------
-// ciEnv::get_field_by_index
-//
 // Get a field by index from a klass's constant pool.
 void GraalEnv::get_field_by_index(instanceKlassHandle& accessor, fieldDescriptor& fd, int index) {
   ResourceMark rm;
@@ -293,8 +278,6 @@
 }
 
 // ------------------------------------------------------------------
-// ciEnv::lookup_method
-//
 // Perform an appropriate method lookup based on accessor, holder,
 // name, signature, and bytecode.
 methodHandle GraalEnv::lookup_method(instanceKlassHandle& h_accessor,
@@ -332,7 +315,6 @@
 
 
 // ------------------------------------------------------------------
-// ciEnv::get_method_by_index_impl
 methodHandle GraalEnv::get_method_by_index_impl(constantPoolHandle& cpool,
                                           int index, Bytecodes::Code bc,
                                           instanceKlassHandle& accessor) {
@@ -360,23 +342,16 @@
   }
 
   // Either the declared holder was not loaded, or the method could
-  // not be found.  Create a dummy ciMethod to represent the failed
-  // lookup.
+  // not be found.
 
   return NULL;
 }
 
 // ------------------------------------------------------------------
-// ciEnv::get_instance_klass_for_declared_method_holder
 instanceKlassHandle GraalEnv::get_instance_klass_for_declared_method_holder(KlassHandle& method_holder) {
-  // For the case of <array>.clone(), the method holder can be a ciArrayKlass
-  // instead of a ciInstanceKlass.  For that case simply pretend that the
+  // For the case of <array>.clone(), the method holder can be an ArrayKlass*
+  // instead of an InstanceKlass*.  For that case simply pretend that the
   // declared holder is Object.clone since that's where the call will bottom out.
-  // A more correct fix would trickle out through many interfaces in CI,
-  // requiring ciInstanceKlass* to become ciKlass* and many more places would
-  // require checks to make sure the expected type was found.  Given that this
-  // only occurs for clone() the more extensive fix seems like overkill so
-  // instead we simply smear the array type into Object.
   if (method_holder->oop_is_instance()) {
     return instanceKlassHandle(method_holder());
   } else if (method_holder->oop_is_array()) {
@@ -389,7 +364,6 @@
 
 
 // ------------------------------------------------------------------
-// ciEnv::get_method_by_index
 methodHandle GraalEnv::get_method_by_index(constantPoolHandle& cpool,
                                      int index, Bytecodes::Code bc,
                                      instanceKlassHandle& accessor) {
@@ -399,7 +373,6 @@
 }
 
 // ------------------------------------------------------------------
-// ciEnv::check_for_system_dictionary_modification
 // Check for changes to the system dictionary during compilation
 // class loads, evolution, breakpoints
 bool GraalEnv::check_for_system_dictionary_modification(Dependencies* dependencies) {
@@ -427,7 +400,6 @@
 }
 
 // ------------------------------------------------------------------
-// ciEnv::register_method
 GraalEnv::CodeInstallResult GraalEnv::register_method(
                                 methodHandle& method,
                                 nmethod*& nm,
--- a/src/share/vm/graal/graalEnv.hpp	Thu Nov 29 10:18:32 2012 +0100
+++ b/src/share/vm/graal/graalEnv.hpp	Thu Nov 29 17:13:13 2012 +0100
@@ -34,7 +34,6 @@
 
 class CompileTask;
 
-// ciEnv
 //
 // This class is the top level broker for requests from the compiler
 // to the VM.
@@ -136,12 +135,8 @@
                        bool                      has_unsafe_access,
                        Handle                    installed_code);
 
-  static ciKlass*  find_system_klass(ciSymbol* klass_name);
-  // Note:  To find a class from its name string, use ciSymbol::make,
-  // but consider adding to vmSymbols.hpp instead.
-
-  // converts the ciKlass* representing the holder of a method into a
-  // ciInstanceKlass*.  This is needed since the holder of a method in
+  // converts the Klass* representing the holder of a method into a
+  // InstanceKlass*.  This is needed since the holder of a method in
   // the bytecodes could be an array type.  Basically this converts
   // array types into java/lang/Object and other types stay as they are.
   static instanceKlassHandle get_instance_klass_for_declared_method_holder(KlassHandle& klass);