< prev index next >

src/share/vm/oops/method.cpp

Print this page




  42 #include "memory/resourceArea.hpp"
  43 #include "oops/constMethod.hpp"
  44 #include "oops/method.hpp"
  45 #include "oops/methodData.hpp"
  46 #include "oops/objArrayOop.inline.hpp"
  47 #include "oops/oop.inline.hpp"
  48 #include "oops/symbol.hpp"
  49 #include "prims/jvmtiExport.hpp"
  50 #include "prims/methodHandles.hpp"
  51 #include "prims/nativeLookup.hpp"
  52 #include "runtime/arguments.hpp"
  53 #include "runtime/compilationPolicy.hpp"
  54 #include "runtime/frame.inline.hpp"
  55 #include "runtime/handles.inline.hpp"
  56 #include "runtime/init.hpp"
  57 #include "runtime/orderAccess.inline.hpp"
  58 #include "runtime/relocator.hpp"
  59 #include "runtime/sharedRuntime.hpp"
  60 #include "runtime/signature.hpp"
  61 #include "utilities/quickSort.hpp"

  62 #include "utilities/xmlstream.hpp"
  63 
  64 // Implementation of Method
  65 
  66 Method* Method::allocate(ClassLoaderData* loader_data,
  67                          int byte_code_size,
  68                          AccessFlags access_flags,
  69                          InlineTableSizes* sizes,
  70                          ConstMethod::MethodType method_type,
  71                          TRAPS) {
  72   assert(!access_flags.is_native() || byte_code_size == 0,
  73          "native methods should not contain byte codes");
  74   ConstMethod* cm = ConstMethod::allocate(loader_data,
  75                                           byte_code_size,
  76                                           sizes,
  77                                           method_type,
  78                                           CHECK_NULL);
  79   int size = Method::size(access_flags.is_native());
  80   return new (loader_data, size, false, MetaspaceObj::MethodType, THREAD) Method(cm, access_flags);
  81 }


 225       warning("oopmap should only be accessed by the "
 226               "VM, GC task or CMS threads (or during debugging)");
 227       InterpreterOopMap local_mask;
 228       method_holder()->mask_for(h_this, bci, &local_mask);
 229       local_mask.print();
 230     }
 231   }
 232 #endif
 233   method_holder()->mask_for(h_this, bci, mask);
 234   return;
 235 }
 236 
 237 
 238 int Method::bci_from(address bcp) const {
 239   if (is_native() && bcp == 0) {
 240     return 0;
 241   }
 242 #ifdef ASSERT
 243   {
 244     ResourceMark rm;
 245     assert(is_native() && bcp == code_base() || contains(bcp) || is_error_reported(),
 246            "bcp doesn't belong to this method: bcp: " INTPTR_FORMAT ", method: %s",
 247            p2i(bcp), name_and_sig_as_C_string());
 248   }
 249 #endif
 250   return bcp - code_base();
 251 }
 252 
 253 
 254 int Method::validate_bci(int bci) const {
 255   return (bci == 0 || bci < code_size()) ? bci : -1;
 256 }
 257 
 258 // Return bci if it appears to be a valid bcp
 259 // Return -1 otherwise.
 260 // Used by profiling code, when invalid data is a possibility.
 261 // The caller is responsible for validating the Method* itself.
 262 int Method::validate_bci_from_bcp(address bcp) const {
 263   // keep bci as -1 if not a valid bci
 264   int bci = -1;
 265   if (bcp == 0 || bcp == code_base()) {




  42 #include "memory/resourceArea.hpp"
  43 #include "oops/constMethod.hpp"
  44 #include "oops/method.hpp"
  45 #include "oops/methodData.hpp"
  46 #include "oops/objArrayOop.inline.hpp"
  47 #include "oops/oop.inline.hpp"
  48 #include "oops/symbol.hpp"
  49 #include "prims/jvmtiExport.hpp"
  50 #include "prims/methodHandles.hpp"
  51 #include "prims/nativeLookup.hpp"
  52 #include "runtime/arguments.hpp"
  53 #include "runtime/compilationPolicy.hpp"
  54 #include "runtime/frame.inline.hpp"
  55 #include "runtime/handles.inline.hpp"
  56 #include "runtime/init.hpp"
  57 #include "runtime/orderAccess.inline.hpp"
  58 #include "runtime/relocator.hpp"
  59 #include "runtime/sharedRuntime.hpp"
  60 #include "runtime/signature.hpp"
  61 #include "utilities/quickSort.hpp"
  62 #include "utilities/vmError.hpp"
  63 #include "utilities/xmlstream.hpp"
  64 
  65 // Implementation of Method
  66 
  67 Method* Method::allocate(ClassLoaderData* loader_data,
  68                          int byte_code_size,
  69                          AccessFlags access_flags,
  70                          InlineTableSizes* sizes,
  71                          ConstMethod::MethodType method_type,
  72                          TRAPS) {
  73   assert(!access_flags.is_native() || byte_code_size == 0,
  74          "native methods should not contain byte codes");
  75   ConstMethod* cm = ConstMethod::allocate(loader_data,
  76                                           byte_code_size,
  77                                           sizes,
  78                                           method_type,
  79                                           CHECK_NULL);
  80   int size = Method::size(access_flags.is_native());
  81   return new (loader_data, size, false, MetaspaceObj::MethodType, THREAD) Method(cm, access_flags);
  82 }


 226       warning("oopmap should only be accessed by the "
 227               "VM, GC task or CMS threads (or during debugging)");
 228       InterpreterOopMap local_mask;
 229       method_holder()->mask_for(h_this, bci, &local_mask);
 230       local_mask.print();
 231     }
 232   }
 233 #endif
 234   method_holder()->mask_for(h_this, bci, mask);
 235   return;
 236 }
 237 
 238 
 239 int Method::bci_from(address bcp) const {
 240   if (is_native() && bcp == 0) {
 241     return 0;
 242   }
 243 #ifdef ASSERT
 244   {
 245     ResourceMark rm;
 246     assert(is_native() && bcp == code_base() || contains(bcp) || VMError::is_error_reported(),
 247            "bcp doesn't belong to this method: bcp: " INTPTR_FORMAT ", method: %s",
 248            p2i(bcp), name_and_sig_as_C_string());
 249   }
 250 #endif
 251   return bcp - code_base();
 252 }
 253 
 254 
 255 int Method::validate_bci(int bci) const {
 256   return (bci == 0 || bci < code_size()) ? bci : -1;
 257 }
 258 
 259 // Return bci if it appears to be a valid bcp
 260 // Return -1 otherwise.
 261 // Used by profiling code, when invalid data is a possibility.
 262 // The caller is responsible for validating the Method* itself.
 263 int Method::validate_bci_from_bcp(address bcp) const {
 264   // keep bci as -1 if not a valid bci
 265   int bci = -1;
 266   if (bcp == 0 || bcp == code_base()) {


< prev index next >