diff src/share/vm/interpreter/interpreter.cpp @ 2142:8012aa3ccede

4926272: methodOopDesc::method_from_bcp is unsafe Reviewed-by: coleenp, jrose, kvn, dcubed
author never
date Thu, 13 Jan 2011 22:15:41 -0800
parents f95d63e2154a
children 3582bf76420e
line wrap: on
line diff
--- a/src/share/vm/interpreter/interpreter.cpp	Wed Jan 12 13:59:18 2011 -0800
+++ b/src/share/vm/interpreter/interpreter.cpp	Thu Jan 13 22:15:41 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -237,10 +237,9 @@
 // Return true if the interpreter can prove that the given bytecode has
 // not yet been executed (in Java semantics, not in actual operation).
 bool AbstractInterpreter::is_not_reached(methodHandle method, int bci) {
-  address bcp = method->bcp_from(bci);
-  Bytecodes::Code code = Bytecodes::code_at(bcp, method());
+  Bytecodes::Code code = method()->code_at(bci);
 
-  if (!Bytecode_at(bcp)->must_rewrite(code)) {
+  if (!Bytecodes::must_rewrite(code)) {
     // might have been reached
     return false;
   }
@@ -286,12 +285,12 @@
 // If deoptimization happens, this function returns the point of next bytecode to continue execution
 address AbstractInterpreter::deopt_continue_after_entry(methodOop method, address bcp, int callee_parameters, bool is_top_frame) {
   assert(method->contains(bcp), "just checkin'");
-  Bytecodes::Code code   = Bytecodes::java_code_at(bcp);
+  Bytecodes::Code code   = Bytecodes::java_code_at(method, bcp);
   assert(!Interpreter::bytecode_should_reexecute(code), "should not reexecute");
   int             bci    = method->bci_from(bcp);
   int             length = -1; // initial value for debugging
   // compute continuation length
-  length = Bytecodes::length_at(bcp);
+  length = Bytecodes::length_at(method, bcp);
   // compute result type
   BasicType type = T_ILLEGAL;
 
@@ -303,7 +302,7 @@
       Thread *thread = Thread::current();
       ResourceMark rm(thread);
       methodHandle mh(thread, method);
-      type = Bytecode_invoke_at(mh, bci)->result_type(thread);
+      type = Bytecode_invoke(mh, bci).result_type(thread);
       // since the cache entry might not be initialized:
       // (NOT needed for the old calling convension)
       if (!is_top_frame) {
@@ -317,7 +316,7 @@
       Thread *thread = Thread::current();
       ResourceMark rm(thread);
       methodHandle mh(thread, method);
-      type = Bytecode_invoke_at(mh, bci)->result_type(thread);
+      type = Bytecode_invoke(mh, bci).result_type(thread);
       // since the cache entry might not be initialized:
       // (NOT needed for the old calling convension)
       if (!is_top_frame) {
@@ -334,7 +333,7 @@
         Thread *thread = Thread::current();
         ResourceMark rm(thread);
         methodHandle mh(thread, method);
-        type = Bytecode_loadconstant_at(mh, bci)->result_type();
+        type = Bytecode_loadconstant(mh, bci).result_type();
         break;
       }
 
@@ -356,7 +355,7 @@
 //       Interpreter::deopt_entry(vtos, 0) like others
 address AbstractInterpreter::deopt_reexecute_entry(methodOop method, address bcp) {
   assert(method->contains(bcp), "just checkin'");
-  Bytecodes::Code code   = Bytecodes::java_code_at(bcp);
+  Bytecodes::Code code   = Bytecodes::java_code_at(method, bcp);
 #ifdef COMPILER1
   if(code == Bytecodes::_athrow ) {
     return Interpreter::rethrow_exception_entry();