< prev index next >

hotspot/src/share/vm/asm/codeBuffer.hpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -247,10 +247,11 @@
   CodeString* _strings;
 #ifdef ASSERT
   // Becomes true after copy-out, forbids further use.
   bool _defunct; // Zero bit pattern is "valid", see memset call in decode_env::decode_env
 #endif
+  static const char* _prefix; // defaults to " ;; "
 #endif
 
   CodeString* find(intptr_t offset) const;
   CodeString* find_last(intptr_t offset) const;
 

@@ -261,10 +262,25 @@
     _defunct = true;
 #endif
 #endif
   }
 
+  void set_null() {
+#ifndef PRODUCT
+    _strings = NULL;
+#endif
+  }
+
+  void invalidate() {
+#ifndef PRODUCT
+    assert(is_null(), "Should not invalidate non-empty CodeStrings");
+#ifdef ASSERT
+    _defunct = true;
+#endif
+#endif
+  }
+
 public:
   CodeStrings() {
 #ifndef PRODUCT
     _strings = NULL;
 #ifdef ASSERT

@@ -287,17 +303,25 @@
   void print_block_comment(outputStream* stream, intptr_t offset) const PRODUCT_RETURN;
   // MOVE strings from other to this; invalidate other.
   void assign(CodeStrings& other)  PRODUCT_RETURN;
   // COPY strings from other to this; leave other valid.
   void copy(CodeStrings& other)  PRODUCT_RETURN;
+  // FREE strings; invalidate if contains non comment strings.
   void free() PRODUCT_RETURN;
   // Guarantee that _strings are used at most once; assign invalidates a buffer.
+  // Also used to help detect CodeBuffers that reference freed strings.
   inline void check_valid() const {
 #ifdef ASSERT
     assert(!_defunct, "Use of invalid CodeStrings");
 #endif
   }
+
+  static void set_prefix(const char *prefix) {
+#ifndef PRODUCT
+    _prefix = prefix;
+#endif
+  }
 };
 
 // A CodeBuffer describes a memory space into which assembly
 // code is generated.  This memory space usually occupies the
 // interior of a single BufferBlob, but in some cases it may be

@@ -377,10 +401,11 @@
     _before_expand   = NULL;
     _blob            = NULL;
     _oop_recorder    = NULL;
     _decode_begin    = NULL;
     _overflow_arena  = NULL;
+    _code_strings    = CodeStrings();
   }
 
   void initialize(address code_start, csize_t code_size) {
     _consts.initialize_outer(this,  SECT_CONSTS);
     _insts.initialize_outer(this,   SECT_INSTS);
< prev index next >