src/hotspot/share/classfile/javaClasses.inline.hpp
author stefank
Mon, 07 May 2018 14:57:25 +0200
changeset 50057 f945444fabc3
parent 49786 7444101401b2
child 50063 50c0d24d3971
permissions -rw-r--r--
8202647: Add deduplicate_string function to CollectedHeap Reviewed-by: rehn, sjohanss
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
29081
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
     1
/*
49786
7444101401b2 8192025: Less referential references
kbarrett
parents: 49041
diff changeset
     2
 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
29081
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
     4
 *
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
     7
 * published by the Free Software Foundation.
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
     8
 *
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    13
 * accompanied this code).
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    14
 *
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    18
 *
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    21
 * questions.
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    22
 *
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    23
 */
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    24
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    25
#ifndef SHARE_VM_CLASSFILE_JAVACLASSES_INLINE_HPP
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    26
#define SHARE_VM_CLASSFILE_JAVACLASSES_INLINE_HPP
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    27
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    28
#include "classfile/javaClasses.hpp"
48618
688e5cbd0b91 8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents: 47998
diff changeset
    29
#include "oops/access.inline.hpp"
29081
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    30
#include "oops/oop.inline.hpp"
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    31
#include "oops/oopsHierarchy.hpp"
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
    32
35498
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    33
void java_lang_String::set_coder(oop string, jbyte coder) {
43422
d4693bf78777 8172169: Re-examine String field optionality
redestad
parents: 40020
diff changeset
    34
  assert(initialized && (coder_offset > 0), "Must be initialized");
d4693bf78777 8172169: Re-examine String field optionality
redestad
parents: 40020
diff changeset
    35
  string->byte_field_put(coder_offset, coder);
35498
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    36
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    37
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    38
void java_lang_String::set_value_raw(oop string, typeArrayOop buffer) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    39
  assert(initialized, "Must be initialized");
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    40
  string->obj_field_put_raw(value_offset, buffer);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    41
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    42
void java_lang_String::set_value(oop string, typeArrayOop buffer) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    43
  assert(initialized && (value_offset > 0), "Must be initialized");
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    44
  string->obj_field_put(value_offset, (oop)buffer);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    45
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    46
void java_lang_String::set_hash(oop string, unsigned int hash) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    47
  assert(initialized && (hash_offset > 0), "Must be initialized");
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    48
  string->int_field_put(hash_offset, hash);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    49
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    50
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    51
// Accessors
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    52
typeArrayOop java_lang_String::value(oop java_string) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    53
  assert(initialized && (value_offset > 0), "Must be initialized");
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    54
  assert(is_instance(java_string), "must be java_string");
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    55
  return (typeArrayOop) java_string->obj_field(value_offset);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    56
}
48618
688e5cbd0b91 8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents: 47998
diff changeset
    57
typeArrayOop java_lang_String::value_no_keepalive(oop java_string) {
688e5cbd0b91 8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents: 47998
diff changeset
    58
  assert(initialized && (value_offset > 0), "Must be initialized");
688e5cbd0b91 8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents: 47998
diff changeset
    59
  assert(is_instance(java_string), "must be java_string");
688e5cbd0b91 8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents: 47998
diff changeset
    60
  return (typeArrayOop) java_string->obj_field_access<AS_NO_KEEPALIVE>(value_offset);
688e5cbd0b91 8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents: 47998
diff changeset
    61
}
35498
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    62
unsigned int java_lang_String::hash(oop java_string) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    63
  assert(initialized && (hash_offset > 0), "Must be initialized");
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    64
  assert(is_instance(java_string), "must be java_string");
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    65
  return java_string->int_field(hash_offset);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    66
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    67
bool java_lang_String::is_latin1(oop java_string) {
43422
d4693bf78777 8172169: Re-examine String field optionality
redestad
parents: 40020
diff changeset
    68
  assert(initialized && (coder_offset > 0), "Must be initialized");
35498
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    69
  assert(is_instance(java_string), "must be java_string");
43422
d4693bf78777 8172169: Re-examine String field optionality
redestad
parents: 40020
diff changeset
    70
  jbyte coder = java_string->byte_field(coder_offset);
d4693bf78777 8172169: Re-examine String field optionality
redestad
parents: 40020
diff changeset
    71
  assert(CompactStrings || coder == CODER_UTF16, "Must be UTF16 without CompactStrings");
d4693bf78777 8172169: Re-examine String field optionality
redestad
parents: 40020
diff changeset
    72
  return coder == CODER_LATIN1;
35498
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    73
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    74
int java_lang_String::length(oop java_string) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    75
  assert(initialized, "Must be initialized");
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    76
  assert(is_instance(java_string), "must be java_string");
48618
688e5cbd0b91 8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents: 47998
diff changeset
    77
  typeArrayOop value = java_lang_String::value_no_keepalive(java_string);
688e5cbd0b91 8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents: 47998
diff changeset
    78
  if (value == NULL) {
35498
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    79
    return 0;
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    80
  }
48618
688e5cbd0b91 8192003: Refactor weak references in StringTable to use the Access API
eosterlund
parents: 47998
diff changeset
    81
  int arr_length = value->length();
35498
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    82
  if (!is_latin1(java_string)) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    83
    assert((arr_length & 1) == 0, "should be even for UTF16 string");
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    84
    arr_length >>= 1; // convert number of bytes to number of elements
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    85
  }
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    86
  return arr_length;
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    87
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    88
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    89
bool java_lang_String::is_instance_inlined(oop obj) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    90
  return obj != NULL && obj->klass() == SystemDictionary::String_klass();
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    91
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    92
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    93
// Accessors
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    94
oop java_lang_ref_Reference::referent(oop ref) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    95
  return ref->obj_field(referent_offset);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    96
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    97
void java_lang_ref_Reference::set_referent(oop ref, oop value) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    98
  ref->obj_field_put(referent_offset, value);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
    99
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   100
void java_lang_ref_Reference::set_referent_raw(oop ref, oop value) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   101
  ref->obj_field_put_raw(referent_offset, value);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   102
}
49041
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48618
diff changeset
   103
HeapWord* java_lang_ref_Reference::referent_addr_raw(oop ref) {
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48618
diff changeset
   104
  return ref->obj_field_addr_raw<HeapWord>(referent_offset);
35498
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   105
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   106
oop java_lang_ref_Reference::next(oop ref) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   107
  return ref->obj_field(next_offset);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   108
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   109
void java_lang_ref_Reference::set_next(oop ref, oop value) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   110
  ref->obj_field_put(next_offset, value);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   111
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   112
void java_lang_ref_Reference::set_next_raw(oop ref, oop value) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   113
  ref->obj_field_put_raw(next_offset, value);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   114
}
49041
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48618
diff changeset
   115
HeapWord* java_lang_ref_Reference::next_addr_raw(oop ref) {
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48618
diff changeset
   116
  return ref->obj_field_addr_raw<HeapWord>(next_offset);
35498
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   117
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   118
oop java_lang_ref_Reference::discovered(oop ref) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   119
  return ref->obj_field(discovered_offset);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   120
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   121
void java_lang_ref_Reference::set_discovered(oop ref, oop value) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   122
  ref->obj_field_put(discovered_offset, value);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   123
}
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   124
void java_lang_ref_Reference::set_discovered_raw(oop ref, oop value) {
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   125
  ref->obj_field_put_raw(discovered_offset, value);
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   126
}
49041
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48618
diff changeset
   127
HeapWord* java_lang_ref_Reference::discovered_addr_raw(oop ref) {
44122f767467 8198286: Direct memory accessors in typeArrayOop.hpp should use Access API
eosterlund
parents: 48618
diff changeset
   128
  return ref->obj_field_addr_raw<HeapWord>(discovered_offset);
35498
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   129
}
49786
7444101401b2 8192025: Less referential references
kbarrett
parents: 49041
diff changeset
   130
oop java_lang_ref_Reference::queue(oop ref) {
7444101401b2 8192025: Less referential references
kbarrett
parents: 49041
diff changeset
   131
  return ref->obj_field(queue_offset);
7444101401b2 8192025: Less referential references
kbarrett
parents: 49041
diff changeset
   132
}
7444101401b2 8192025: Less referential references
kbarrett
parents: 49041
diff changeset
   133
void java_lang_ref_Reference::set_queue(oop ref, oop value) {
7444101401b2 8192025: Less referential references
kbarrett
parents: 49041
diff changeset
   134
  return ref->obj_field_put(queue_offset, value);
7444101401b2 8192025: Less referential references
kbarrett
parents: 49041
diff changeset
   135
}
47998
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents: 47216
diff changeset
   136
bool java_lang_ref_Reference::is_phantom(oop ref) {
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents: 47216
diff changeset
   137
  return InstanceKlass::cast(ref->klass())->reference_type() == REF_PHANTOM;
fb0275c320a0 8189871: Refactor GC barriers to use declarative semantics
eosterlund
parents: 47216
diff changeset
   138
}
35498
392b50de06c6 8146401: Clean up oop.hpp: add inline directives and fix header files
goetz
parents: 34280
diff changeset
   139
29081
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   140
inline void java_lang_invoke_CallSite::set_target_volatile(oop site, oop target) {
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   141
  site->obj_field_put_volatile(_target_offset, target);
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   142
}
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   143
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   144
inline oop  java_lang_invoke_CallSite::target(oop site) {
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   145
  return site->obj_field(_target_offset);
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   146
}
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   147
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   148
inline void java_lang_invoke_CallSite::set_target(oop site, oop target) {
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   149
  site->obj_field_put(_target_offset, target);
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   150
}
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   151
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   152
inline bool java_lang_invoke_CallSite::is_instance(oop obj) {
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   153
  return obj != NULL && is_subclass(obj->klass());
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   154
}
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   155
31037
01a5c5fa5681 8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents: 30263
diff changeset
   156
inline bool java_lang_invoke_MethodHandleNatives_CallSiteContext::is_instance(oop obj) {
01a5c5fa5681 8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents: 30263
diff changeset
   157
  return obj != NULL && is_subclass(obj->klass());
01a5c5fa5681 8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents: 30263
diff changeset
   158
}
01a5c5fa5681 8079205: CallSite dependency tracking is broken after sun.misc.Cleaner became automatically cleared
vlivanov
parents: 30263
diff changeset
   159
29081
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   160
inline bool java_lang_invoke_MemberName::is_instance(oop obj) {
46505
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents: 44520
diff changeset
   161
  return obj != NULL && obj->klass() == SystemDictionary::MemberName_klass();
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents: 44520
diff changeset
   162
}
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents: 44520
diff changeset
   163
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents: 44520
diff changeset
   164
inline bool java_lang_invoke_ResolvedMethodName::is_instance(oop obj) {
fd4bc78630b1 8174749: Use hash table/oops for MemberName table
coleenp
parents: 44520
diff changeset
   165
  return obj != NULL && obj->klass() == SystemDictionary::ResolvedMethodName_klass();
29081
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   166
}
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   167
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   168
inline bool java_lang_invoke_MethodType::is_instance(oop obj) {
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   169
  return obj != NULL && obj->klass() == SystemDictionary::MethodType_klass();
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   170
}
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   171
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   172
inline bool java_lang_invoke_MethodHandle::is_instance(oop obj) {
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   173
  return obj != NULL && is_subclass(obj->klass());
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   174
}
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   175
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   176
inline bool java_lang_Class::is_instance(oop obj) {
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   177
  return obj != NULL && obj->klass() == SystemDictionary::Class_klass();
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   178
}
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   179
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   180
inline bool java_lang_invoke_DirectMethodHandle::is_instance(oop obj) {
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   181
  return obj != NULL && is_subclass(obj->klass());
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   182
}
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   183
44520
0553e129e0ec 8177530: Module system implementation refresh (4/2017)
alanb
parents: 43422
diff changeset
   184
inline bool java_lang_Module::is_instance(oop obj) {
0553e129e0ec 8177530: Module system implementation refresh (4/2017)
alanb
parents: 43422
diff changeset
   185
  return obj != NULL && obj->klass() == SystemDictionary::Module_klass();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35498
diff changeset
   186
}
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35498
diff changeset
   187
34280
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   188
inline int Backtrace::merge_bci_and_version(int bci, int version) {
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   189
  // only store u2 for version, checking for overflow.
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   190
  if (version > USHRT_MAX || version < 0) version = USHRT_MAX;
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   191
  assert((jushort)bci == bci, "bci should be short");
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   192
  return build_int_from_shorts(version, bci);
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   193
}
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   194
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   195
inline int Backtrace::merge_mid_and_cpref(int mid, int cpref) {
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   196
  // only store u2 for mid and cpref, checking for overflow.
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   197
  assert((jushort)mid == mid, "mid should be short");
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   198
  assert((jushort)cpref == cpref, "cpref should be short");
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   199
  return build_int_from_shorts(cpref, mid);
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   200
}
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   201
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   202
inline int Backtrace::bci_at(unsigned int merged) {
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   203
  return extract_high_short_from_int(merged);
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   204
}
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   205
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   206
inline int Backtrace::version_at(unsigned int merged) {
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   207
  return extract_low_short_from_int(merged);
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   208
}
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   209
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   210
inline int Backtrace::mid_at(unsigned int merged) {
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   211
  return extract_high_short_from_int(merged);
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   212
}
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   213
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   214
inline int Backtrace::cpref_at(unsigned int merged) {
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   215
  return extract_low_short_from_int(merged);
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   216
}
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   217
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   218
inline int Backtrace::get_line_number(const methodHandle& method, int bci) {
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   219
  int line_number = 0;
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   220
  if (method->is_native()) {
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   221
    // Negative value different from -1 below, enabling Java code in
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   222
    // class java.lang.StackTraceElement to distinguish "native" from
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   223
    // "no LineNumberTable".  JDK tests for -2.
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   224
    line_number = -2;
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   225
  } else {
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   226
    // Returns -1 if no LineNumberTable, and otherwise actual line number
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   227
    line_number = method->line_number_from_bci(bci);
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   228
    if (line_number == -1 && ShowHiddenFrames) {
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   229
      line_number = bci + 1000000;
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   230
    }
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   231
  }
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   232
  return line_number;
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   233
}
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   234
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   235
inline Symbol* Backtrace::get_source_file_name(InstanceKlass* holder, int version) {
37475
0da78fa10d78 8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 36508
diff changeset
   236
  // RedefineClasses() currently permits redefine operations to
0da78fa10d78 8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 36508
diff changeset
   237
  // happen in parallel using a "last one wins" philosophy. That
0da78fa10d78 8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 36508
diff changeset
   238
  // spec laxness allows the constant pool entry associated with
0da78fa10d78 8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 36508
diff changeset
   239
  // the source_file_name_index for any older constant pool version
0da78fa10d78 8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 36508
diff changeset
   240
  // to be unstable so we shouldn't try to use it.
0da78fa10d78 8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 36508
diff changeset
   241
  if (holder->constants()->version() != version) {
0da78fa10d78 8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 36508
diff changeset
   242
    return NULL;
0da78fa10d78 8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 36508
diff changeset
   243
  } else {
0da78fa10d78 8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 36508
diff changeset
   244
    return holder->source_file_name();
0da78fa10d78 8148772: VM crash in nsk/jvmti/RedefineClasses/StressRedefine: assert failed: Corrupted constant pool
coleenp
parents: 36508
diff changeset
   245
  }
34280
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   246
}
72bfaaffee36 8143911: Reintegrate JEP 259: Stack-Walking API
mchung
parents: 34273
diff changeset
   247
29081
c61eb4914428 8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
diff changeset
   248
#endif // SHARE_VM_CLASSFILE_JAVACLASSES_INLINE_HPP