--- old/src/share/vm/compiler/oopMap.cpp 2015-10-08 07:23:56.000000000 -1000 +++ new/src/share/vm/compiler/oopMap.cpp 2015-10-08 07:23:56.000000000 -1000 @@ -39,6 +39,9 @@ #ifdef COMPILER2 #include "opto/optoreg.hpp" #endif +#ifdef SPARC +#include "vmreg_sparc.inline.hpp" +#endif // OopMapStream @@ -48,7 +51,7 @@ _size = oop_map->omv_count(); _position = 0; _valid_omv = false; -} +} OopMapStream::OopMapStream(const ImmutableOopMap* oop_map, int oop_types_mask) { _stream = new CompressedReadStream(oop_map->data_addr()); @@ -272,10 +275,15 @@ static void add_derived_oop(oop* base, oop* derived) { #ifndef TIERED COMPILER1_PRESENT(ShouldNotReachHere();) +#if INCLUDE_JVMCI + if (UseJVMCICompiler) { + ShouldNotReachHere(); + } +#endif #endif // TIERED -#ifdef COMPILER2 +#if defined(COMPILER2) || INCLUDE_JVMCI DerivedPointerTable::add(derived, base); -#endif // COMPILER2 +#endif // COMPILER2 || INCLUDE_JVMCI } @@ -284,7 +292,7 @@ // Print oopmap and regmap tty->print_cr("------ "); CodeBlob* cb = fr->cb(); - ImmutableOopMapSet* maps = cb->oop_maps(); + const ImmutableOopMapSet* maps = cb->oop_maps(); const ImmutableOopMap* map = cb->oop_map_for_return_address(fr->pc()); map->print(); if( cb->is_nmethod() ) { @@ -321,7 +329,7 @@ NOT_PRODUCT(if (TraceCodeBlobStacks) trace_codeblob_maps(fr, reg_map);) - ImmutableOopMapSet* maps = cb->oop_maps(); + const ImmutableOopMapSet* maps = cb->oop_maps(); const ImmutableOopMap* map = cb->oop_map_for_return_address(fr->pc()); assert(map != NULL, "no ptr map found"); @@ -333,6 +341,11 @@ if (!oms.is_done()) { #ifndef TIERED COMPILER1_PRESENT(ShouldNotReachHere();) +#if INCLUDE_JVMCI + if (UseJVMCICompiler) { + ShouldNotReachHere(); + } +#endif #endif // !TIERED // Protect the operation on the derived pointers. This // protects the addition of derived pointers to the shared @@ -448,7 +461,7 @@ // Check that runtime stubs save all callee-saved registers #ifdef COMPILER2 - assert(cb->is_compiled_by_c1() || !cb->is_runtime_stub() || + assert(cb->is_compiled_by_c1() || cb->is_compiled_by_jvmci() || !cb->is_runtime_stub() || (nof_callee >= SAVED_ON_ENTRY_REG_COUNT || nof_callee >= C_SAVED_ON_ENTRY_REG_COUNT), "must save all"); #endif // COMPILER2 @@ -462,13 +475,18 @@ bool ImmutableOopMap::has_derived_pointer() const { #ifndef TIERED COMPILER1_PRESENT(return false); +#if INCLUDE_JVMCI + if (UseJVMCICompiler) { + return false; + } +#endif #endif // !TIERED -#ifdef COMPILER2 - OopMapStream oms((OopMap*)this,OopMapValue::derived_oop_value); +#if defined(COMPILER2) || INCLUDE_JVMCI + OopMapStream oms(this,OopMapValue::derived_oop_value); return oms.is_done(); #else return false; -#endif // COMPILER2 +#endif // COMPILER2 || INCLUDE_JVMCI } #endif //PRODUCT @@ -601,74 +619,9 @@ } #endif -class ImmutableOopMapBuilder { -private: - class Mapping; - -private: - const OopMapSet* _set; - const OopMap* _empty; - const OopMap* _last; - int _empty_offset; - int _last_offset; - int _offset; - 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) : _set(set), _new_set(NULL), _empty(NULL), _last(NULL), _empty_offset(-1), _last_offset(-1), _offset(0) { - _mapping = NEW_RESOURCE_ARRAY(Mapping, _set->size()); - } - - int heap_size(); - ImmutableOopMapSet* build(); -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); -}; +ImmutableOopMapBuilder::ImmutableOopMapBuilder(const OopMapSet* set) : _set(set), _new_set(NULL), _empty(NULL), _last(NULL), _empty_offset(-1), _last_offset(-1), _offset(0), _required(-1) { + _mapping = NEW_RESOURCE_ARRAY(Mapping, _set->size()); +} int ImmutableOopMapBuilder::size_for(const OopMap* map) const { return align_size_up(sizeof(ImmutableOopMap) + map->data_size(), 8); @@ -713,6 +666,7 @@ int total = base + pairs + _offset; DEBUG_ONLY(total += 8); + _required = total; return total; } @@ -764,31 +718,35 @@ } #endif -ImmutableOopMapSet* ImmutableOopMapBuilder::build() { - int required = heap_size(); - - // We need to allocate a chunk big enough to hold the ImmutableOopMapSet and all of its ImmutableOopMaps - address buffer = (address) NEW_C_HEAP_ARRAY(unsigned char, required, mtCode); - DEBUG_ONLY(memset(&buffer[required-8], 0xff, 8)); +ImmutableOopMapSet* ImmutableOopMapBuilder::generate_into(address buffer) { + DEBUG_ONLY(memset(&buffer[_required-8], 0xff, 8)); - _new_set = new (buffer) ImmutableOopMapSet(_set, required); - fill(_new_set, required); + _new_set = new (buffer) ImmutableOopMapSet(_set, _required); + fill(_new_set, _required); - DEBUG_ONLY(verify(buffer, required, _new_set)); + DEBUG_ONLY(verify(buffer, _required, _new_set)); return _new_set; } +ImmutableOopMapSet* ImmutableOopMapBuilder::build() { + _required = heap_size(); + + // We need to allocate a chunk big enough to hold the ImmutableOopMapSet and all of its ImmutableOopMaps + address buffer = (address) NEW_C_HEAP_ARRAY(unsigned char, _required, mtCode); + return generate_into(buffer); +} + ImmutableOopMapSet* ImmutableOopMapSet::build_from(const OopMapSet* oopmap_set) { ResourceMark mark; ImmutableOopMapBuilder builder(oopmap_set); return builder.build(); } - + //------------------------------DerivedPointerTable--------------------------- -#ifdef COMPILER2 +#if defined(COMPILER2) || INCLUDE_JVMCI class DerivedPointerEntry : public CHeapObj { private: @@ -881,4 +839,4 @@ _active = false; } -#endif // COMPILER2 +#endif // COMPILER2 || INCLUDE_JVMCI