comparison src/share/vm/runtime/sharedRuntime.cpp @ 18058:54bc75c144b0

Merge
author asaha
date Thu, 29 May 2014 13:14:25 -0700
parents 78bbf4d43a14
children 0bf37f737702
comparison
equal deleted inserted replaced
18055:1fa005fb28f5 18058:54bc75c144b0
1 /* 1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2014, 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.
80 #endif 80 #endif
81 #ifdef COMPILER1 81 #ifdef COMPILER1
82 #include "c1/c1_Runtime1.hpp" 82 #include "c1/c1_Runtime1.hpp"
83 #endif 83 #endif
84 84
85 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
86
85 // Shared stub locations 87 // Shared stub locations
86 RuntimeStub* SharedRuntime::_wrong_method_blob; 88 RuntimeStub* SharedRuntime::_wrong_method_blob;
87 RuntimeStub* SharedRuntime::_wrong_method_abstract_blob; 89 RuntimeStub* SharedRuntime::_wrong_method_abstract_blob;
88 RuntimeStub* SharedRuntime::_ic_miss_blob; 90 RuntimeStub* SharedRuntime::_ic_miss_blob;
89 RuntimeStub* SharedRuntime::_resolve_opt_virtual_call_blob; 91 RuntimeStub* SharedRuntime::_resolve_opt_virtual_call_blob;
406 return (f <= (double)0.0) ? (double)0.0 - f : f; 408 return (f <= (double)0.0) ? (double)0.0 - f : f;
407 } 409 }
408 410
409 #endif 411 #endif
410 412
411 #if defined(__SOFTFP__) || defined(PPC) 413 #if defined(__SOFTFP__) || defined(PPC32)
412 double SharedRuntime::dsqrt(double f) { 414 double SharedRuntime::dsqrt(double f) {
413 return sqrt(f); 415 return sqrt(f);
414 } 416 }
415 #endif 417 #endif
416 418
492 thread->set_is_method_handle_return(nm->is_method_handle_return(return_address)); 494 thread->set_is_method_handle_return(nm->is_method_handle_return(return_address));
493 // native nmethods don't have exception handlers 495 // native nmethods don't have exception handlers
494 assert(!nm->is_native_method(), "no exception handler"); 496 assert(!nm->is_native_method(), "no exception handler");
495 assert(nm->header_begin() != nm->exception_begin(), "no exception handler"); 497 assert(nm->header_begin() != nm->exception_begin(), "no exception handler");
496 if (nm->is_deopt_pc(return_address)) { 498 if (nm->is_deopt_pc(return_address)) {
499 // If we come here because of a stack overflow, the stack may be
500 // unguarded. Reguard the stack otherwise if we return to the
501 // deopt blob and the stack bang causes a stack overflow we
502 // crash.
503 bool guard_pages_enabled = thread->stack_yellow_zone_enabled();
504 if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack();
505 assert(guard_pages_enabled, "stack banging in deopt blob may cause crash");
497 return SharedRuntime::deopt_blob()->unpack_with_exception(); 506 return SharedRuntime::deopt_blob()->unpack_with_exception();
498 } else { 507 } else {
499 return nm->exception_begin(); 508 return nm->exception_begin();
500 } 509 }
501 } 510 }
951 /** 960 /**
952 * This function ought to be a void function, but cannot be because 961 * This function ought to be a void function, but cannot be because
953 * it gets turned into a tail-call on sparc, which runs into dtrace bug 962 * it gets turned into a tail-call on sparc, which runs into dtrace bug
954 * 6254741. Once that is fixed we can remove the dummy return value. 963 * 6254741. Once that is fixed we can remove the dummy return value.
955 */ 964 */
956 int SharedRuntime::dtrace_object_alloc(oopDesc* o) { 965 int SharedRuntime::dtrace_object_alloc(oopDesc* o, int size) {
957 return dtrace_object_alloc_base(Thread::current(), o); 966 return dtrace_object_alloc_base(Thread::current(), o, size);
958 } 967 }
959 968
960 int SharedRuntime::dtrace_object_alloc_base(Thread* thread, oopDesc* o) { 969 int SharedRuntime::dtrace_object_alloc_base(Thread* thread, oopDesc* o, int size) {
961 assert(DTraceAllocProbes, "wrong call"); 970 assert(DTraceAllocProbes, "wrong call");
962 Klass* klass = o->klass(); 971 Klass* klass = o->klass();
963 int size = o->size();
964 Symbol* name = klass->name(); 972 Symbol* name = klass->name();
965 #ifndef USDT2 973 #ifndef USDT2
966 HS_DTRACE_PROBE4(hotspot, object__alloc, get_java_tid(thread), 974 HS_DTRACE_PROBE4(hotspot, object__alloc, get_java_tid(thread),
967 name->bytes(), name->utf8_length(), size * HeapWordSize); 975 name->bytes(), name->utf8_length(), size * HeapWordSize);
968 #else /* USDT2 */ 976 #else /* USDT2 */
2398 assert(ic_miss != NULL, "must have handler"); 2406 assert(ic_miss != NULL, "must have handler");
2399 2407
2400 ResourceMark rm; 2408 ResourceMark rm;
2401 2409
2402 NOT_PRODUCT(int insts_size); 2410 NOT_PRODUCT(int insts_size);
2403 AdapterBlob* B = NULL; 2411 AdapterBlob* new_adapter = NULL;
2404 AdapterHandlerEntry* entry = NULL; 2412 AdapterHandlerEntry* entry = NULL;
2405 AdapterFingerPrint* fingerprint = NULL; 2413 AdapterFingerPrint* fingerprint = NULL;
2406 { 2414 {
2407 MutexLocker mu(AdapterHandlerLibrary_lock); 2415 MutexLocker mu(AdapterHandlerLibrary_lock);
2408 // make sure data structure is initialized 2416 // make sure data structure is initialized
2430 // Lookup method signature's fingerprint 2438 // Lookup method signature's fingerprint
2431 entry = _adapters->lookup(total_args_passed, sig_bt); 2439 entry = _adapters->lookup(total_args_passed, sig_bt);
2432 2440
2433 #ifdef ASSERT 2441 #ifdef ASSERT
2434 AdapterHandlerEntry* shared_entry = NULL; 2442 AdapterHandlerEntry* shared_entry = NULL;
2435 if (VerifyAdapterSharing && entry != NULL) { 2443 // Start adapter sharing verification only after the VM is booted.
2444 if (VerifyAdapterSharing && (entry != NULL)) {
2436 shared_entry = entry; 2445 shared_entry = entry;
2437 entry = NULL; 2446 entry = NULL;
2438 } 2447 }
2439 #endif 2448 #endif
2440 2449
2446 int comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, false); 2455 int comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, false);
2447 2456
2448 // Make a C heap allocated version of the fingerprint to store in the adapter 2457 // Make a C heap allocated version of the fingerprint to store in the adapter
2449 fingerprint = new AdapterFingerPrint(total_args_passed, sig_bt); 2458 fingerprint = new AdapterFingerPrint(total_args_passed, sig_bt);
2450 2459
2460 // StubRoutines::code2() is initialized after this function can be called. As a result,
2461 // VerifyAdapterCalls and VerifyAdapterSharing can fail if we re-use code that generated
2462 // prior to StubRoutines::code2() being set. Checks refer to checks generated in an I2C
2463 // stub that ensure that an I2C stub is called from an interpreter frame.
2464 bool contains_all_checks = StubRoutines::code2() != NULL;
2465
2451 // Create I2C & C2I handlers 2466 // Create I2C & C2I handlers
2452
2453 BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache 2467 BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache
2454 if (buf != NULL) { 2468 if (buf != NULL) {
2455 CodeBuffer buffer(buf); 2469 CodeBuffer buffer(buf);
2456 short buffer_locs[20]; 2470 short buffer_locs[20];
2457 buffer.insts()->initialize_shared_locs((relocInfo*)buffer_locs, 2471 buffer.insts()->initialize_shared_locs((relocInfo*)buffer_locs,
2458 sizeof(buffer_locs)/sizeof(relocInfo)); 2472 sizeof(buffer_locs)/sizeof(relocInfo));
2473
2459 MacroAssembler _masm(&buffer); 2474 MacroAssembler _masm(&buffer);
2460
2461 entry = SharedRuntime::generate_i2c2i_adapters(&_masm, 2475 entry = SharedRuntime::generate_i2c2i_adapters(&_masm,
2462 total_args_passed, 2476 total_args_passed,
2463 comp_args_on_stack, 2477 comp_args_on_stack,
2464 sig_bt, 2478 sig_bt,
2465 regs, 2479 regs,
2466 fingerprint); 2480 fingerprint);
2467
2468 #ifdef ASSERT 2481 #ifdef ASSERT
2469 if (VerifyAdapterSharing) { 2482 if (VerifyAdapterSharing) {
2470 if (shared_entry != NULL) { 2483 if (shared_entry != NULL) {
2471 assert(shared_entry->compare_code(buf->code_begin(), buffer.insts_size(), total_args_passed, sig_bt), 2484 assert(shared_entry->compare_code(buf->code_begin(), buffer.insts_size()), "code must match");
2472 "code must match");
2473 // Release the one just created and return the original 2485 // Release the one just created and return the original
2474 _adapters->free_entry(entry); 2486 _adapters->free_entry(entry);
2475 return shared_entry; 2487 return shared_entry;
2476 } else { 2488 } else {
2477 entry->save_code(buf->code_begin(), buffer.insts_size(), total_args_passed, sig_bt); 2489 entry->save_code(buf->code_begin(), buffer.insts_size());
2478 } 2490 }
2479 } 2491 }
2480 #endif 2492 #endif
2481 2493
2482 B = AdapterBlob::create(&buffer); 2494 new_adapter = AdapterBlob::create(&buffer);
2483 NOT_PRODUCT(insts_size = buffer.insts_size()); 2495 NOT_PRODUCT(insts_size = buffer.insts_size());
2484 } 2496 }
2485 if (B == NULL) { 2497 if (new_adapter == NULL) {
2486 // CodeCache is full, disable compilation 2498 // CodeCache is full, disable compilation
2487 // Ought to log this but compile log is only per compile thread 2499 // Ought to log this but compile log is only per compile thread
2488 // and we're some non descript Java thread. 2500 // and we're some non descript Java thread.
2489 MutexUnlocker mu(AdapterHandlerLibrary_lock); 2501 MutexUnlocker mu(AdapterHandlerLibrary_lock);
2490 CompileBroker::handle_full_code_cache(); 2502 CompileBroker::handle_full_code_cache();
2491 return NULL; // Out of CodeCache space 2503 return NULL; // Out of CodeCache space
2492 } 2504 }
2493 entry->relocate(B->content_begin()); 2505 entry->relocate(new_adapter->content_begin());
2494 #ifndef PRODUCT 2506 #ifndef PRODUCT
2495 // debugging suppport 2507 // debugging suppport
2496 if (PrintAdapterHandlers || PrintStubCode) { 2508 if (PrintAdapterHandlers || PrintStubCode) {
2497 ttyLocker ttyl; 2509 ttyLocker ttyl;
2498 entry->print_adapter_on(tty); 2510 entry->print_adapter_on(tty);
2507 tty->cr(); 2519 tty->cr();
2508 } 2520 }
2509 } 2521 }
2510 } 2522 }
2511 #endif 2523 #endif
2512 2524 // Add the entry only if the entry contains all required checks (see sharedRuntime_xxx.cpp)
2513 _adapters->add(entry); 2525 // The checks are inserted only if -XX:+VerifyAdapterCalls is specified.
2526 if (contains_all_checks || !VerifyAdapterCalls) {
2527 _adapters->add(entry);
2528 }
2514 } 2529 }
2515 // Outside of the lock 2530 // Outside of the lock
2516 if (B != NULL) { 2531 if (new_adapter != NULL) {
2517 char blob_id[256]; 2532 char blob_id[256];
2518 jio_snprintf(blob_id, 2533 jio_snprintf(blob_id,
2519 sizeof(blob_id), 2534 sizeof(blob_id),
2520 "%s(%s)@" PTR_FORMAT, 2535 "%s(%s)@" PTR_FORMAT,
2521 B->name(), 2536 new_adapter->name(),
2522 fingerprint->as_string(), 2537 fingerprint->as_string(),
2523 B->content_begin()); 2538 new_adapter->content_begin());
2524 Forte::register_stub(blob_id, B->content_begin(), B->content_end()); 2539 Forte::register_stub(blob_id, new_adapter->content_begin(),new_adapter->content_end());
2525 2540
2526 if (JvmtiExport::should_post_dynamic_code_generated()) { 2541 if (JvmtiExport::should_post_dynamic_code_generated()) {
2527 JvmtiExport::post_dynamic_code_generated(blob_id, B->content_begin(), B->content_end()); 2542 JvmtiExport::post_dynamic_code_generated(blob_id, new_adapter->content_begin(), new_adapter->content_end());
2528 } 2543 }
2529 } 2544 }
2530 return entry; 2545 return entry;
2531 } 2546 }
2532 2547
2554 2569
2555 void AdapterHandlerEntry::deallocate() { 2570 void AdapterHandlerEntry::deallocate() {
2556 delete _fingerprint; 2571 delete _fingerprint;
2557 #ifdef ASSERT 2572 #ifdef ASSERT
2558 if (_saved_code) FREE_C_HEAP_ARRAY(unsigned char, _saved_code, mtCode); 2573 if (_saved_code) FREE_C_HEAP_ARRAY(unsigned char, _saved_code, mtCode);
2559 if (_saved_sig) FREE_C_HEAP_ARRAY(Basictype, _saved_sig, mtCode);
2560 #endif 2574 #endif
2561 } 2575 }
2562 2576
2563 2577
2564 #ifdef ASSERT 2578 #ifdef ASSERT
2565 // Capture the code before relocation so that it can be compared 2579 // Capture the code before relocation so that it can be compared
2566 // against other versions. If the code is captured after relocation 2580 // against other versions. If the code is captured after relocation
2567 // then relative instructions won't be equivalent. 2581 // then relative instructions won't be equivalent.
2568 void AdapterHandlerEntry::save_code(unsigned char* buffer, int length, int total_args_passed, BasicType* sig_bt) { 2582 void AdapterHandlerEntry::save_code(unsigned char* buffer, int length) {
2569 _saved_code = NEW_C_HEAP_ARRAY(unsigned char, length, mtCode); 2583 _saved_code = NEW_C_HEAP_ARRAY(unsigned char, length, mtCode);
2570 _code_length = length; 2584 _saved_code_length = length;
2571 memcpy(_saved_code, buffer, length); 2585 memcpy(_saved_code, buffer, length);
2572 _total_args_passed = total_args_passed; 2586 }
2573 _saved_sig = NEW_C_HEAP_ARRAY(BasicType, _total_args_passed, mtCode); 2587
2574 memcpy(_saved_sig, sig_bt, _total_args_passed * sizeof(BasicType)); 2588
2575 } 2589 bool AdapterHandlerEntry::compare_code(unsigned char* buffer, int length) {
2576 2590 if (length != _saved_code_length) {
2577
2578 bool AdapterHandlerEntry::compare_code(unsigned char* buffer, int length, int total_args_passed, BasicType* sig_bt) {
2579 if (length != _code_length) {
2580 return false; 2591 return false;
2581 } 2592 }
2582 for (int i = 0; i < length; i++) { 2593
2583 if (buffer[i] != _saved_code[i]) { 2594 return (memcmp(buffer, _saved_code, length) == 0) ? true : false;
2584 return false; 2595 }
2585 } 2596 #endif
2586 } 2597
2587 return true; 2598
2588 } 2599 /**
2589 #endif 2600 * Create a native wrapper for this native method. The wrapper converts the
2590 2601 * Java-compiled calling convention to the native convention, handles
2591 2602 * arguments, and transitions to native. On return from the native we transition
2592 // Create a native wrapper for this native method. The wrapper converts the 2603 * back to java blocking if a safepoint is in progress.
2593 // java compiled calling convention to the native convention, handlizes 2604 */
2594 // arguments, and transitions to native. On return from the native we transition 2605 void AdapterHandlerLibrary::create_native_wrapper(methodHandle method) {
2595 // back to java blocking if a safepoint is in progress.
2596 nmethod *AdapterHandlerLibrary::create_native_wrapper(methodHandle method, int compile_id) {
2597 ResourceMark rm; 2606 ResourceMark rm;
2598 nmethod* nm = NULL; 2607 nmethod* nm = NULL;
2599 2608
2600 assert(method->is_native(), "must be native"); 2609 assert(method->is_native(), "must be native");
2601 assert(method->is_method_handle_intrinsic() || 2610 assert(method->is_method_handle_intrinsic() ||
2602 method->has_native_function(), "must have something valid to call!"); 2611 method->has_native_function(), "must have something valid to call!");
2603 2612
2604 { 2613 {
2605 // perform the work while holding the lock, but perform any printing outside the lock 2614 // Perform the work while holding the lock, but perform any printing outside the lock
2606 MutexLocker mu(AdapterHandlerLibrary_lock); 2615 MutexLocker mu(AdapterHandlerLibrary_lock);
2607 // See if somebody beat us to it 2616 // See if somebody beat us to it
2608 nm = method->code(); 2617 nm = method->code();
2609 if (nm) { 2618 if (nm != NULL) {
2610 return nm; 2619 return;
2611 } 2620 }
2621
2622 const int compile_id = CompileBroker::assign_compile_id(method, CompileBroker::standard_entry_bci);
2623 assert(compile_id > 0, "Must generate native wrapper");
2624
2612 2625
2613 ResourceMark rm; 2626 ResourceMark rm;
2614
2615 BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache 2627 BufferBlob* buf = buffer_blob(); // the temporary code buffer in CodeCache
2616 if (buf != NULL) { 2628 if (buf != NULL) {
2617 CodeBuffer buffer(buf); 2629 CodeBuffer buffer(buf);
2618 double locs_buf[20]; 2630 double locs_buf[20];
2619 buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo)); 2631 buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo));
2641 // are just trampolines so the argument registers must be outgoing ones. 2653 // are just trampolines so the argument registers must be outgoing ones.
2642 const bool is_outgoing = method->is_method_handle_intrinsic(); 2654 const bool is_outgoing = method->is_method_handle_intrinsic();
2643 int comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, is_outgoing); 2655 int comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, is_outgoing);
2644 2656
2645 // Generate the compiled-to-native wrapper code 2657 // Generate the compiled-to-native wrapper code
2646 nm = SharedRuntime::generate_native_wrapper(&_masm, 2658 nm = SharedRuntime::generate_native_wrapper(&_masm, method, compile_id, sig_bt, regs, ret_type);
2647 method, 2659
2648 compile_id, 2660 if (nm != NULL) {
2649 sig_bt, 2661 method->set_code(method, nm);
2650 regs, 2662 }
2651 ret_type); 2663 }
2652 } 2664 } // Unlock AdapterHandlerLibrary_lock
2653 } 2665
2654
2655 // Must unlock before calling set_code
2656 2666
2657 // Install the generated code. 2667 // Install the generated code.
2658 if (nm != NULL) { 2668 if (nm != NULL) {
2659 if (PrintCompilation) { 2669 if (PrintCompilation) {
2660 ttyLocker ttyl; 2670 ttyLocker ttyl;
2661 CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : ""); 2671 CompileTask::print_compilation(tty, nm, method->is_static() ? "(static)" : "");
2662 } 2672 }
2663 method->set_code(method, nm);
2664 nm->post_compiled_method_load_event(); 2673 nm->post_compiled_method_load_event();
2665 } else { 2674 } else {
2666 // CodeCache is full, disable compilation 2675 // CodeCache is full, disable compilation
2667 CompileBroker::handle_full_code_cache(); 2676 CompileBroker::handle_full_code_cache();
2668 } 2677 }
2669 return nm;
2670 } 2678 }
2671 2679
2672 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* thread)) 2680 JRT_ENTRY_NO_ASYNC(void, SharedRuntime::block_for_jni_critical(JavaThread* thread))
2673 assert(thread == JavaThread::current(), "must be"); 2681 assert(thread == JavaThread::current(), "must be");
2674 // The code is about to enter a JNI lazy critical native method and 2682 // The code is about to enter a JNI lazy critical native method and
2682 GC_locker::lock_critical(thread); 2690 GC_locker::lock_critical(thread);
2683 GC_locker::unlock_critical(thread); 2691 GC_locker::unlock_critical(thread);
2684 JRT_END 2692 JRT_END
2685 2693
2686 #ifdef HAVE_DTRACE_H 2694 #ifdef HAVE_DTRACE_H
2687 // Create a dtrace nmethod for this method. The wrapper converts the 2695 /**
2688 // java compiled calling convention to the native convention, makes a dummy call 2696 * Create a dtrace nmethod for this method. The wrapper converts the
2689 // (actually nops for the size of the call instruction, which become a trap if 2697 * Java-compiled calling convention to the native convention, makes a dummy call
2690 // probe is enabled). The returns to the caller. Since this all looks like a 2698 * (actually nops for the size of the call instruction, which become a trap if
2691 // leaf no thread transition is needed. 2699 * probe is enabled), and finally returns to the caller. Since this all looks like a
2692 2700 * leaf, no thread transition is needed.
2701 */
2693 nmethod *AdapterHandlerLibrary::create_dtrace_nmethod(methodHandle method) { 2702 nmethod *AdapterHandlerLibrary::create_dtrace_nmethod(methodHandle method) {
2694 ResourceMark rm; 2703 ResourceMark rm;
2695 nmethod* nm = NULL; 2704 nmethod* nm = NULL;
2696 2705
2697 if (PrintCompilation) { 2706 if (PrintCompilation) {
2698 ttyLocker ttyl; 2707 ttyLocker ttyl;
2699 tty->print("--- n%s "); 2708 tty->print("--- n ");
2700 method->print_short_name(tty); 2709 method->print_short_name(tty);
2701 if (method->is_static()) { 2710 if (method->is_static()) {
2702 tty->print(" (static)"); 2711 tty->print(" (static)");
2703 } 2712 }
2704 tty->cr(); 2713 tty->cr();
2741 jlsValue->char_at_addr(jlsOffset); 2750 jlsValue->char_at_addr(jlsOffset);
2742 assert(TypeArrayKlass::cast(jlsValue->klass())->element_type() == T_CHAR, "compressed string"); 2751 assert(TypeArrayKlass::cast(jlsValue->klass())->element_type() == T_CHAR, "compressed string");
2743 (void) UNICODE::as_utf8(jlsPos, jlsLen, (char *)dst, max_dtrace_string_size); 2752 (void) UNICODE::as_utf8(jlsPos, jlsLen, (char *)dst, max_dtrace_string_size);
2744 } 2753 }
2745 #endif // ndef HAVE_DTRACE_H 2754 #endif // ndef HAVE_DTRACE_H
2755
2756 int SharedRuntime::convert_ints_to_longints_argcnt(int in_args_count, BasicType* in_sig_bt) {
2757 int argcnt = in_args_count;
2758 if (CCallingConventionRequiresIntsAsLongs) {
2759 for (int in = 0; in < in_args_count; in++) {
2760 BasicType bt = in_sig_bt[in];
2761 switch (bt) {
2762 case T_BOOLEAN:
2763 case T_CHAR:
2764 case T_BYTE:
2765 case T_SHORT:
2766 case T_INT:
2767 argcnt++;
2768 break;
2769 default:
2770 break;
2771 }
2772 }
2773 } else {
2774 assert(0, "This should not be needed on this platform");
2775 }
2776
2777 return argcnt;
2778 }
2779
2780 void SharedRuntime::convert_ints_to_longints(int i2l_argcnt, int& in_args_count,
2781 BasicType*& in_sig_bt, VMRegPair*& in_regs) {
2782 if (CCallingConventionRequiresIntsAsLongs) {
2783 VMRegPair *new_in_regs = NEW_RESOURCE_ARRAY(VMRegPair, i2l_argcnt);
2784 BasicType *new_in_sig_bt = NEW_RESOURCE_ARRAY(BasicType, i2l_argcnt);
2785
2786 int argcnt = 0;
2787 for (int in = 0; in < in_args_count; in++, argcnt++) {
2788 BasicType bt = in_sig_bt[in];
2789 VMRegPair reg = in_regs[in];
2790 switch (bt) {
2791 case T_BOOLEAN:
2792 case T_CHAR:
2793 case T_BYTE:
2794 case T_SHORT:
2795 case T_INT:
2796 // Convert (bt) to (T_LONG,bt).
2797 new_in_sig_bt[argcnt ] = T_LONG;
2798 new_in_sig_bt[argcnt+1] = bt;
2799 assert(reg.first()->is_valid() && !reg.second()->is_valid(), "");
2800 new_in_regs[argcnt ].set2(reg.first());
2801 new_in_regs[argcnt+1].set_bad();
2802 argcnt++;
2803 break;
2804 default:
2805 // No conversion needed.
2806 new_in_sig_bt[argcnt] = bt;
2807 new_in_regs[argcnt] = reg;
2808 break;
2809 }
2810 }
2811 assert(argcnt == i2l_argcnt, "must match");
2812
2813 in_regs = new_in_regs;
2814 in_sig_bt = new_in_sig_bt;
2815 in_args_count = i2l_argcnt;
2816 } else {
2817 assert(0, "This should not be needed on this platform");
2818 }
2819 }
2746 2820
2747 // ------------------------------------------------------------------------- 2821 // -------------------------------------------------------------------------
2748 // Java-Java calling convention 2822 // Java-Java calling convention
2749 // (what you use when Java calls Java) 2823 // (what you use when Java calls Java)
2750 2824