comparison src/share/vm/interpreter/interpreter.cpp @ 6948:e522a00b91aa

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/ after NPG - C++ build works
author Doug Simon <doug.simon@oracle.com>
date Mon, 12 Nov 2012 23:14:12 +0100
parents 957c266d8bc5 a3e2f723f2a5
children 7d815d842ee0
comparison
equal deleted inserted replaced
6711:ae13cc658b80 6948:e522a00b91aa
1 /* 1 /*
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, 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.
30 #include "interpreter/interpreterRuntime.hpp" 30 #include "interpreter/interpreterRuntime.hpp"
31 #include "interpreter/templateTable.hpp" 31 #include "interpreter/templateTable.hpp"
32 #include "memory/allocation.inline.hpp" 32 #include "memory/allocation.inline.hpp"
33 #include "memory/resourceArea.hpp" 33 #include "memory/resourceArea.hpp"
34 #include "oops/arrayOop.hpp" 34 #include "oops/arrayOop.hpp"
35 #include "oops/methodDataOop.hpp" 35 #include "oops/methodData.hpp"
36 #include "oops/methodOop.hpp" 36 #include "oops/method.hpp"
37 #include "oops/oop.inline.hpp" 37 #include "oops/oop.inline.hpp"
38 #include "prims/forte.hpp" 38 #include "prims/forte.hpp"
39 #include "prims/jvmtiExport.hpp" 39 #include "prims/jvmtiExport.hpp"
40 #include "prims/methodHandles.hpp" 40 #include "prims/methodHandles.hpp"
41 #include "runtime/handles.inline.hpp" 41 #include "runtime/handles.inline.hpp"
58 void InterpreterCodelet::verify() { 58 void InterpreterCodelet::verify() {
59 } 59 }
60 60
61 61
62 void InterpreterCodelet::print_on(outputStream* st) const { 62 void InterpreterCodelet::print_on(outputStream* st) const {
63 ttyLocker ttyl;
64
63 if (PrintInterpreter) { 65 if (PrintInterpreter) {
64 st->cr(); 66 st->cr();
65 st->print_cr("----------------------------------------------------------------------"); 67 st->print_cr("----------------------------------------------------------------------");
66 } 68 }
67 69
70 st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "] %d bytes", 72 st->print_cr("[" INTPTR_FORMAT ", " INTPTR_FORMAT "] %d bytes",
71 code_begin(), code_end(), code_size()); 73 code_begin(), code_end(), code_size());
72 74
73 if (PrintInterpreter) { 75 if (PrintInterpreter) {
74 st->cr(); 76 st->cr();
75 Disassembler::decode(code_begin(), code_end(), st); 77 Disassembler::decode(code_begin(), code_end(), st, DEBUG_ONLY(_comments) NOT_DEBUG(CodeComments()));
76 } 78 }
77 } 79 }
78 80
79 81
80 //------------------------------------------------------------------------------------------------------------------------ 82 //------------------------------------------------------------------------------------------------------------------------
310 312
311 //------------------------------------------------------------------------------------------------------------------------ 313 //------------------------------------------------------------------------------------------------------------------------
312 // Deoptimization support 314 // Deoptimization support
313 315
314 // If deoptimization happens, this function returns the point of next bytecode to continue execution 316 // If deoptimization happens, this function returns the point of next bytecode to continue execution
315 address AbstractInterpreter::deopt_continue_after_entry(methodOop method, address bcp, int callee_parameters, bool is_top_frame) { 317 address AbstractInterpreter::deopt_continue_after_entry(Method* method, address bcp, int callee_parameters, bool is_top_frame) {
316 assert(method->contains(bcp), "just checkin'"); 318 assert(method->contains(bcp), "just checkin'");
317 Bytecodes::Code code = Bytecodes::java_code_at(method, bcp); 319 Bytecodes::Code code = Bytecodes::java_code_at(method, bcp);
318 assert(!Interpreter::bytecode_should_reexecute(code), "should not reexecute"); 320 assert(!Interpreter::bytecode_should_reexecute(code), "should not reexecute");
319 int bci = method->bci_from(bcp); 321 int bci = method->bci_from(bcp);
320 int length = -1; // initial value for debugging 322 int length = -1; // initial value for debugging
348 type = Bytecode_invoke(mh, bci).result_type(); 350 type = Bytecode_invoke(mh, bci).result_type();
349 // since the cache entry might not be initialized: 351 // since the cache entry might not be initialized:
350 // (NOT needed for the old calling convension) 352 // (NOT needed for the old calling convension)
351 if (!is_top_frame) { 353 if (!is_top_frame) {
352 int index = Bytes::get_native_u4(bcp+1); 354 int index = Bytes::get_native_u4(bcp+1);
353 method->constants()->cache()->secondary_entry_at(index)->set_parameter_size(callee_parameters); 355 method->constants()->invokedynamic_cp_cache_entry_at(index)->set_parameter_size(callee_parameters);
354 } 356 }
355 break; 357 break;
356 } 358 }
357 359
358 case Bytecodes::_ldc : 360 case Bytecodes::_ldc :
380 382
381 // If deoptimization happens, this function returns the point where the interpreter reexecutes 383 // If deoptimization happens, this function returns the point where the interpreter reexecutes
382 // the bytecode. 384 // the bytecode.
383 // Note: Bytecodes::_athrow is a special case in that it does not return 385 // Note: Bytecodes::_athrow is a special case in that it does not return
384 // Interpreter::deopt_entry(vtos, 0) like others 386 // Interpreter::deopt_entry(vtos, 0) like others
385 address AbstractInterpreter::deopt_reexecute_entry(methodOop method, address bcp) { 387 address AbstractInterpreter::deopt_reexecute_entry(Method* method, address bcp) {
386 assert(method->contains(bcp), "just checkin'"); 388 assert(method->contains(bcp), "just checkin'");
387 Bytecodes::Code code = Bytecodes::java_code_at(method, bcp); 389 Bytecodes::Code code = Bytecodes::java_code_at(method, bcp);
388 #ifdef COMPILER1 390 #ifdef COMPILER1
389 if(code == Bytecodes::_athrow ) { 391 if(code == Bytecodes::_athrow ) {
390 return Interpreter::rethrow_exception_entry(); 392 return Interpreter::rethrow_exception_entry();
481 for (int pages = start_page; pages <= StackShadowPages ; pages++) { 483 for (int pages = start_page; pages <= StackShadowPages ; pages++) {
482 __ bang_stack_with_offset(pages*page_size); 484 __ bang_stack_with_offset(pages*page_size);
483 } 485 }
484 } 486 }
485 } 487 }
488
489 void AbstractInterpreterGenerator::initialize_method_handle_entries() {
490 // method handle entry kinds are generated later in MethodHandlesAdapterGenerator::generate:
491 for (int i = Interpreter::method_handle_invoke_FIRST; i <= Interpreter::method_handle_invoke_LAST; i++) {
492 Interpreter::MethodKind kind = (Interpreter::MethodKind) i;
493 Interpreter::_entry_table[kind] = Interpreter::_entry_table[Interpreter::abstract];
494 }
495 }