--- old/src/share/vm/compiler/oopMap.hpp 2015-10-08 07:23:57.000000000 -1000 +++ new/src/share/vm/compiler/oopMap.hpp 2015-10-08 07:23:56.000000000 -1000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -184,6 +184,8 @@ void copy_data_to(address addr) const; OopMap* deep_copy(); + bool has_derived_pointer() const PRODUCT_RETURN0; + bool legal_vm_reg_name(VMReg local) { return OopMapValue::legal_vm_reg_name(local); } @@ -350,13 +352,82 @@ #endif }; +class ImmutableOopMapBuilder { +private: + class Mapping; + +private: + const OopMapSet* _set; + const OopMap* _empty; + const OopMap* _last; + int _empty_offset; + int _last_offset; + int _offset; + int _required; + Mapping* _mapping; + ImmutableOopMapSet* _new_set; + + /* Used for bookkeeping when building ImmutableOopMaps */ + class Mapping : public ResourceObj { + public: + enum kind_t { OOPMAP_UNKNOWN = 0, OOPMAP_NEW = 1, OOPMAP_EMPTY = 2, OOPMAP_DUPLICATE = 3 }; + + kind_t _kind; + int _offset; + int _size; + const OopMap* _map; + const OopMap* _other; + + Mapping() : _kind(OOPMAP_UNKNOWN), _offset(-1), _size(-1), _map(NULL) {} + + void set(kind_t kind, int offset, int size, const OopMap* map = 0, const OopMap* other = 0) { + _kind = kind; + _offset = offset; + _size = size; + _map = map; + _other = other; + } + }; + +public: + ImmutableOopMapBuilder(const OopMapSet* set); + + int heap_size(); + ImmutableOopMapSet* build(); + ImmutableOopMapSet* generate_into(address buffer); +private: + bool is_empty(const OopMap* map) const { + return map->count() == 0; + } + + bool is_last_duplicate(const OopMap* map) { + if (_last != NULL && _last->count() > 0 && _last->equals(map)) { + return true; + } + return false; + } + +#ifdef ASSERT + void verify(address buffer, int size, const ImmutableOopMapSet* set); +#endif + + bool has_empty() const { + return _empty_offset != -1; + } + + int size_for(const OopMap* map) const; + void fill_pair(ImmutableOopMapPair* pair, const OopMap* map, int offset, const ImmutableOopMapSet* set); + int fill_map(ImmutableOopMapPair* pair, const OopMap* map, int offset, const ImmutableOopMapSet* set); + void fill(ImmutableOopMapSet* set, int size); +}; + // Derived pointer support. This table keeps track of all derived points on a // stack. It is cleared before each scavenge/GC. During the traversal of all // oops, it is filled in with references to all locations that contains a // derived oop (assumed to be very few). When the GC is complete, the derived // pointers are updated based on their base pointers new value and an offset. -#ifdef COMPILER2 +#if defined(COMPILER2) || INCLUDE_JVMCI class DerivedPointerTable : public AllStatic { friend class VMStructs; private: @@ -392,6 +463,6 @@ } } }; -#endif // COMPILER2 +#endif // COMPILER2 || INCLUDE_JVMCI #endif // SHARE_VM_COMPILER_OOPMAP_HPP