< prev index next >

src/share/vm/classfile/javaClasses.hpp

Print this page
rev 9803 : 8146401: Clean up oop.hpp: add inline directives and fix header files

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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.

@@ -58,16 +58,11 @@
 
   static bool initialized;
 
   static Handle basic_create(int length, bool byte_arr, TRAPS);
 
-  static void set_coder(oop string, jbyte coder) {
-    assert(initialized, "Must be initialized");
-    if (coder_offset > 0) {
-      string->byte_field_put(coder_offset, coder);
-    }
-  }
+  static inline void set_coder(oop string, jbyte coder);
 
  public:
 
   // Coders
   enum Coder {

@@ -108,59 +103,19 @@
   static int coder_offset_in_bytes()   {
     assert(initialized && (coder_offset > 0), "Must be initialized");
     return coder_offset;
   }
 
-  static void set_value_raw(oop string, typeArrayOop buffer) {
-    assert(initialized, "Must be initialized");
-    string->obj_field_put_raw(value_offset, buffer);
-  }
-  static void set_value(oop string, typeArrayOop buffer) {
-    assert(initialized && (value_offset > 0), "Must be initialized");
-    string->obj_field_put(value_offset, (oop)buffer);
-  }
-  static void set_hash(oop string, unsigned int hash) {
-    assert(initialized && (hash_offset > 0), "Must be initialized");
-    string->int_field_put(hash_offset, hash);
-  }
+  static inline void set_value_raw(oop string, typeArrayOop buffer);
+  static inline void set_value(oop string, typeArrayOop buffer);
+  static inline void set_hash(oop string, unsigned int hash);
 
   // Accessors
-  static typeArrayOop value(oop java_string) {
-    assert(initialized && (value_offset > 0), "Must be initialized");
-    assert(is_instance(java_string), "must be java_string");
-    return (typeArrayOop) java_string->obj_field(value_offset);
-  }
-  static unsigned int hash(oop java_string) {
-    assert(initialized && (hash_offset > 0), "Must be initialized");
-    assert(is_instance(java_string), "must be java_string");
-    return java_string->int_field(hash_offset);
-  }
-  static bool is_latin1(oop java_string) {
-    assert(initialized, "Must be initialized");
-    assert(is_instance(java_string), "must be java_string");
-    if (coder_offset > 0) {
-      jbyte coder = java_string->byte_field(coder_offset);
-      assert(CompactStrings || coder == CODER_UTF16, "Must be UTF16 without CompactStrings");
-      return coder == CODER_LATIN1;
-    } else {
-      return false;
-    }
-  }
-  static int length(oop java_string) {
-    assert(initialized, "Must be initialized");
-    assert(is_instance(java_string), "must be java_string");
-    typeArrayOop value_array = ((typeArrayOop)java_string->obj_field(value_offset));
-    if (value_array == NULL) {
-     return 0;
-    }
-    int arr_length = value_array->length();
-    if (!is_latin1(java_string)) {
-      assert((arr_length & 1) == 0, "should be even for UTF16 string");
-      arr_length >>= 1; // convert number of bytes to number of elements
-    }
-    return arr_length;
-  }
+  static inline typeArrayOop value(oop java_string);
+  static inline unsigned int hash(oop java_string);
+  static inline bool is_latin1(oop java_string);
+  static inline int length(oop java_string);
   static int utf8_length(oop java_string);
 
   // String converters
   static char*  as_utf8_string(oop java_string);
   static char*  as_utf8_string(oop java_string, char* buf, int buflen);

@@ -217,11 +172,11 @@
   static Symbol* as_symbol(Handle java_string, TRAPS);
   static Symbol* as_symbol_or_null(oop java_string);
 
   // Testers
   static bool is_instance(oop obj);
-  static bool is_instance_inlined(oop obj);
+  static inline bool is_instance_inlined(oop obj);
 
   // Debugging
   static void print(oop java_string, outputStream* st);
   friend class JavaClasses;
   friend class StringTable;

@@ -908,46 +863,23 @@
   static int static_lock_offset;
   static int static_pending_offset;
   static int number_of_fake_oop_fields;
 
   // Accessors
-  static oop referent(oop ref) {
-    return ref->obj_field(referent_offset);
-  }
-  static void set_referent(oop ref, oop value) {
-    ref->obj_field_put(referent_offset, value);
-  }
-  static void set_referent_raw(oop ref, oop value) {
-    ref->obj_field_put_raw(referent_offset, value);
-  }
-  static HeapWord* referent_addr(oop ref) {
-    return ref->obj_field_addr<HeapWord>(referent_offset);
-  }
-  static oop next(oop ref) {
-    return ref->obj_field(next_offset);
-  }
-  static void set_next(oop ref, oop value) {
-    ref->obj_field_put(next_offset, value);
-  }
-  static void set_next_raw(oop ref, oop value) {
-    ref->obj_field_put_raw(next_offset, value);
-  }
-  static HeapWord* next_addr(oop ref) {
-    return ref->obj_field_addr<HeapWord>(next_offset);
-  }
-  static oop discovered(oop ref) {
-    return ref->obj_field(discovered_offset);
-  }
-  static void set_discovered(oop ref, oop value) {
-    ref->obj_field_put(discovered_offset, value);
-  }
-  static void set_discovered_raw(oop ref, oop value) {
-    ref->obj_field_put_raw(discovered_offset, value);
-  }
-  static HeapWord* discovered_addr(oop ref) {
-    return ref->obj_field_addr<HeapWord>(discovered_offset);
-  }
+  static inline oop referent(oop ref);
+  static inline void set_referent(oop ref, oop value);
+  static inline void set_referent_raw(oop ref, oop value);
+  static inline HeapWord* referent_addr(oop ref);
+  static inline oop next(oop ref);
+  static inline void set_next(oop ref, oop value);
+  static inline void set_next_raw(oop ref, oop value);
+  static inline HeapWord* next_addr(oop ref);
+  static inline oop discovered(oop ref);
+  static inline void set_discovered(oop ref, oop value);
+  static inline void set_discovered_raw(oop ref, oop value);
+  static inline HeapWord* discovered_addr(oop ref);
+
   // Accessors for statics
   static oop  pending_list_lock();
   static oop  pending_list();
 
   static HeapWord*  pending_list_lock_addr();
< prev index next >