hotspot/src/share/vm/interpreter/oopMapCache.cpp
changeset 46727 6e4a84748e2c
parent 38259 b495d1cfe673
child 46996 9cbcd7082efe
equal deleted inserted replaced
46726:7801367e3cc9 46727:6e4a84748e2c
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2017, 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.
    37   friend class OopMapCache;
    37   friend class OopMapCache;
    38   friend class VerifyClosure;
    38   friend class VerifyClosure;
    39 
    39 
    40  protected:
    40  protected:
    41   // Initialization
    41   // Initialization
    42   void fill(methodHandle method, int bci);
    42   void fill(const methodHandle& method, int bci);
    43   // fills the bit mask for native calls
    43   // fills the bit mask for native calls
    44   void fill_for_native(methodHandle method);
    44   void fill_for_native(const methodHandle& method);
    45   void set_mask(CellTypeState* vars, CellTypeState* stack, int stack_top);
    45   void set_mask(CellTypeState* vars, CellTypeState* stack, int stack_top);
    46 
    46 
    47   // Deallocate bit masks and initialize fields
    47   // Deallocate bit masks and initialize fields
    48   void flush();
    48   void flush();
    49 
    49 
    78                                            CellTypeState* stack,
    78                                            CellTypeState* stack,
    79                                            int stack_top);
    79                                            int stack_top);
    80   virtual void fill_init_vars             (GrowableArray<intptr_t> *init_vars);
    80   virtual void fill_init_vars             (GrowableArray<intptr_t> *init_vars);
    81 
    81 
    82  public:
    82  public:
    83   OopMapForCacheEntry(methodHandle method, int bci, OopMapCacheEntry *entry);
    83   OopMapForCacheEntry(const methodHandle& method, int bci, OopMapCacheEntry *entry);
    84 
    84 
    85   // Computes stack map for (method,bci) and initialize entry
    85   // Computes stack map for (method,bci) and initialize entry
    86   void compute_map(TRAPS);
    86   void compute_map(TRAPS);
    87   int  size();
    87   int  size();
    88 };
    88 };
    89 
    89 
    90 
    90 
    91 OopMapForCacheEntry::OopMapForCacheEntry(methodHandle method, int bci, OopMapCacheEntry* entry) : GenerateOopMap(method) {
    91 OopMapForCacheEntry::OopMapForCacheEntry(const methodHandle& method, int bci, OopMapCacheEntry* entry) : GenerateOopMap(method) {
    92   _bci       = bci;
    92   _bci       = bci;
    93   _entry     = entry;
    93   _entry     = entry;
    94   _stack_top = -1;
    94   _stack_top = -1;
    95 }
    95 }
    96 
    96 
   240   void pass_long()                               { /* ignore */ }
   240   void pass_long()                               { /* ignore */ }
   241   void pass_float()                              { /* ignore */ }
   241   void pass_float()                              { /* ignore */ }
   242   void pass_double()                             { /* ignore */ }
   242   void pass_double()                             { /* ignore */ }
   243   void pass_object()                             { set_one(offset()); }
   243   void pass_object()                             { set_one(offset()); }
   244 
   244 
   245   MaskFillerForNative(methodHandle method, uintptr_t* mask, int size) : NativeSignatureIterator(method) {
   245   MaskFillerForNative(const methodHandle& method, uintptr_t* mask, int size) : NativeSignatureIterator(method) {
   246     _mask   = mask;
   246     _mask   = mask;
   247     _size   = size;
   247     _size   = size;
   248     // initialize with 0
   248     // initialize with 0
   249     int i = (size + BitsPerWord - 1) / BitsPerWord;
   249     int i = (size + BitsPerWord - 1) / BitsPerWord;
   250     while (i-- > 0) _mask[i] = 0;
   250     while (i-- > 0) _mask[i] = 0;
   299     debug_only(_bit_mask[0] = 0;)
   299     debug_only(_bit_mask[0] = 0;)
   300   }
   300   }
   301 }
   301 }
   302 
   302 
   303 
   303 
   304 void OopMapCacheEntry::fill_for_native(methodHandle mh) {
   304 void OopMapCacheEntry::fill_for_native(const methodHandle& mh) {
   305   assert(mh->is_native(), "method must be native method");
   305   assert(mh->is_native(), "method must be native method");
   306   set_mask_size(mh->size_of_parameters() * bits_per_entry);
   306   set_mask_size(mh->size_of_parameters() * bits_per_entry);
   307   allocate_bit_mask();
   307   allocate_bit_mask();
   308   // fill mask for parameters
   308   // fill mask for parameters
   309   MaskFillerForNative mf(mh, bit_mask(), mask_size());
   309   MaskFillerForNative mf(mh, bit_mask(), mask_size());
   310   mf.generate();
   310   mf.generate();
   311 }
   311 }
   312 
   312 
   313 
   313 
   314 void OopMapCacheEntry::fill(methodHandle method, int bci) {
   314 void OopMapCacheEntry::fill(const methodHandle& method, int bci) {
   315   HandleMark hm;
   315   HandleMark hm;
   316   // Flush entry to deallocate an existing entry
   316   // Flush entry to deallocate an existing entry
   317   flush();
   317   flush();
   318   set_method(method());
   318   set_method(method());
   319   set_bci(bci);
   319   set_bci(bci);