src/hotspot/share/oops/oop.hpp
changeset 48831 05894c073b7e
parent 48618 688e5cbd0b91
child 49041 44122f767467
equal deleted inserted replaced
48830:11920d5d14a8 48831:05894c073b7e
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   141   inline address* address_field_addr(int offset) const;
   141   inline address* address_field_addr(int offset) const;
   142 
   142 
   143   inline static bool is_null(oop obj)       { return obj == NULL; }
   143   inline static bool is_null(oop obj)       { return obj == NULL; }
   144   inline static bool is_null(narrowOop obj) { return obj == 0; }
   144   inline static bool is_null(narrowOop obj) { return obj == 0; }
   145 
   145 
       
   146   // Standard compare function returns negative value if o1 < o2
       
   147   //                                   0              if o1 == o2
       
   148   //                                   positive value if o1 > o2
       
   149   inline static int  compare(oop o1, oop o2) {
       
   150     void* o1_addr = (void*)o1;
       
   151     void* o2_addr = (void*)o2;
       
   152     if (o1_addr < o2_addr) {
       
   153       return -1;
       
   154     } else if (o1_addr > o2_addr) {
       
   155       return 1;
       
   156     } else {
       
   157       return 0;
       
   158     }
       
   159   }
       
   160 
   146   // Decode an oop pointer from a narrowOop if compressed.
   161   // Decode an oop pointer from a narrowOop if compressed.
   147   // These are overloaded for oop and narrowOop as are the other functions
   162   // These are overloaded for oop and narrowOop as are the other functions
   148   // below so that they can be called in template functions.
   163   // below so that they can be called in template functions.
   149   static inline oop decode_heap_oop_not_null(oop v) { return v; }
   164   static inline oop decode_heap_oop_not_null(oop v) { return v; }
   150   static inline oop decode_heap_oop_not_null(narrowOop v);
   165   static inline oop decode_heap_oop_not_null(narrowOop v);