379 } 380 381 StackValueCollection* interpretedVFrame::expressions() const { 382 return stack_data(true); 383 } 384 385 /* 386 * Worker routine for fetching references and/or values 387 * for a particular bci in the interpretedVFrame. 388 * 389 * Returns data for either "locals" or "expressions", 390 * using bci relative oop_map (oop_mask) information. 391 * 392 * @param expressions bool switch controlling what data to return 393 (false == locals / true == expression) 394 * 395 */ 396 StackValueCollection* interpretedVFrame::stack_data(bool expressions) const { 397 398 InterpreterOopMap oop_mask; 399 // oopmap for current bci 400 if ((TraceDeoptimization && Verbose) JVMCI_ONLY( || PrintDeoptimizationDetails)) { 401 methodHandle m_h(Thread::current(), method()); 402 OopMapCache::compute_one_oop_map(m_h, bci(), &oop_mask); 403 } else { 404 method()->mask_for(bci(), &oop_mask); 405 } 406 407 const int mask_len = oop_mask.number_of_entries(); 408 409 // If the method is native, method()->max_locals() is not telling the truth. 410 // For our purposes, max locals instead equals the size of parameters. 411 const int max_locals = method()->is_native() ? 412 method()->size_of_parameters() : method()->max_locals(); 413 414 assert(mask_len >= max_locals, "invariant"); 415 416 const int length = expressions ? mask_len - max_locals : max_locals; 417 assert(length >= 0, "invariant"); 418 419 StackValueCollection* const result = new StackValueCollection(length); 420 421 if (0 == length) { 422 return result; 423 } 424 425 if (expressions) { 426 stack_expressions(result, length, max_locals, oop_mask, fr()); | 379 } 380 381 StackValueCollection* interpretedVFrame::expressions() const { 382 return stack_data(true); 383 } 384 385 /* 386 * Worker routine for fetching references and/or values 387 * for a particular bci in the interpretedVFrame. 388 * 389 * Returns data for either "locals" or "expressions", 390 * using bci relative oop_map (oop_mask) information. 391 * 392 * @param expressions bool switch controlling what data to return 393 (false == locals / true == expression) 394 * 395 */ 396 StackValueCollection* interpretedVFrame::stack_data(bool expressions) const { 397 398 InterpreterOopMap oop_mask; 399 method()->mask_for(bci(), &oop_mask); 400 const int mask_len = oop_mask.number_of_entries(); 401 402 // If the method is native, method()->max_locals() is not telling the truth. 403 // For our purposes, max locals instead equals the size of parameters. 404 const int max_locals = method()->is_native() ? 405 method()->size_of_parameters() : method()->max_locals(); 406 407 assert(mask_len >= max_locals, "invariant"); 408 409 const int length = expressions ? mask_len - max_locals : max_locals; 410 assert(length >= 0, "invariant"); 411 412 StackValueCollection* const result = new StackValueCollection(length); 413 414 if (0 == length) { 415 return result; 416 } 417 418 if (expressions) { 419 stack_expressions(result, length, max_locals, oop_mask, fr()); |