comparison src/share/vm/prims/jvm.cpp @ 1980:828eafbd85cc

6348631: remove the use of the HPI library from Hotspot Summary: move functions from hpi library to hotspot, communicate with licensees and open source community, check jdk for dependency, file CCC request Reviewed-by: coleenp, acorn, dsamersoff
author ikrylov
date Wed, 01 Dec 2010 18:26:32 -0500
parents f95d63e2154a
children ccfcb502af3f
comparison
equal deleted inserted replaced
1972:f95d63e2154a 1980:828eafbd85cc
41 #include "prims/nativeLookup.hpp" 41 #include "prims/nativeLookup.hpp"
42 #include "prims/privilegedStack.hpp" 42 #include "prims/privilegedStack.hpp"
43 #include "runtime/arguments.hpp" 43 #include "runtime/arguments.hpp"
44 #include "runtime/dtraceJSDT.hpp" 44 #include "runtime/dtraceJSDT.hpp"
45 #include "runtime/handles.inline.hpp" 45 #include "runtime/handles.inline.hpp"
46 #include "runtime/hpi.hpp"
47 #include "runtime/init.hpp" 46 #include "runtime/init.hpp"
48 #include "runtime/interfaceSupport.hpp" 47 #include "runtime/interfaceSupport.hpp"
49 #include "runtime/java.hpp" 48 #include "runtime/java.hpp"
50 #include "runtime/javaCalls.hpp" 49 #include "runtime/javaCalls.hpp"
51 #include "runtime/jfieldIDWorkaround.hpp" 50 #include "runtime/jfieldIDWorkaround.hpp"
63 #include "utilities/events.hpp" 62 #include "utilities/events.hpp"
64 #include "utilities/histogram.hpp" 63 #include "utilities/histogram.hpp"
65 #include "utilities/top.hpp" 64 #include "utilities/top.hpp"
66 #include "utilities/utf8.hpp" 65 #include "utilities/utf8.hpp"
67 #ifdef TARGET_OS_FAMILY_linux 66 #ifdef TARGET_OS_FAMILY_linux
68 # include "hpi_linux.hpp"
69 # include "jvm_linux.h" 67 # include "jvm_linux.h"
70 #endif 68 #endif
71 #ifdef TARGET_OS_FAMILY_solaris 69 #ifdef TARGET_OS_FAMILY_solaris
72 # include "hpi_solaris.hpp"
73 # include "jvm_solaris.h" 70 # include "jvm_solaris.h"
74 #endif 71 #endif
75 #ifdef TARGET_OS_FAMILY_windows 72 #ifdef TARGET_OS_FAMILY_windows
76 # include "hpi_windows.hpp"
77 # include "jvm_windows.h" 73 # include "jvm_windows.h"
78 #endif 74 #endif
79 75
80 #include <errno.h> 76 #include <errno.h>
81 77
651 647
652 // Error message support ////////////////////////////////////////////////////// 648 // Error message support //////////////////////////////////////////////////////
653 649
654 JVM_LEAF(jint, JVM_GetLastErrorString(char *buf, int len)) 650 JVM_LEAF(jint, JVM_GetLastErrorString(char *buf, int len))
655 JVMWrapper("JVM_GetLastErrorString"); 651 JVMWrapper("JVM_GetLastErrorString");
656 return hpi::lasterror(buf, len); 652 return (jint)os::lasterror(buf, len);
657 JVM_END 653 JVM_END
658 654
659 655
660 // java.io.File /////////////////////////////////////////////////////////////// 656 // java.io.File ///////////////////////////////////////////////////////////////
661 657
662 JVM_LEAF(char*, JVM_NativePath(char* path)) 658 JVM_LEAF(char*, JVM_NativePath(char* path))
663 JVMWrapper2("JVM_NativePath (%s)", path); 659 JVMWrapper2("JVM_NativePath (%s)", path);
664 return hpi::native_path(path); 660 return os::native_path(path);
665 JVM_END 661 JVM_END
666 662
667 663
668 // Misc. class handling /////////////////////////////////////////////////////////// 664 // Misc. class handling ///////////////////////////////////////////////////////////
669 665
2485 2481
2486 JVM_LEAF(jint, JVM_Open(const char *fname, jint flags, jint mode)) 2482 JVM_LEAF(jint, JVM_Open(const char *fname, jint flags, jint mode))
2487 JVMWrapper2("JVM_Open (%s)", fname); 2483 JVMWrapper2("JVM_Open (%s)", fname);
2488 2484
2489 //%note jvm_r6 2485 //%note jvm_r6
2490 int result = hpi::open(fname, flags, mode); 2486 int result = os::open(fname, flags, mode);
2491 if (result >= 0) { 2487 if (result >= 0) {
2492 return result; 2488 return result;
2493 } else { 2489 } else {
2494 switch(errno) { 2490 switch(errno) {
2495 case EEXIST: 2491 case EEXIST:
2502 2498
2503 2499
2504 JVM_LEAF(jint, JVM_Close(jint fd)) 2500 JVM_LEAF(jint, JVM_Close(jint fd))
2505 JVMWrapper2("JVM_Close (0x%x)", fd); 2501 JVMWrapper2("JVM_Close (0x%x)", fd);
2506 //%note jvm_r6 2502 //%note jvm_r6
2507 return hpi::close(fd); 2503 return os::close(fd);
2508 JVM_END 2504 JVM_END
2509 2505
2510 2506
2511 JVM_LEAF(jint, JVM_Read(jint fd, char *buf, jint nbytes)) 2507 JVM_LEAF(jint, JVM_Read(jint fd, char *buf, jint nbytes))
2512 JVMWrapper2("JVM_Read (0x%x)", fd); 2508 JVMWrapper2("JVM_Read (0x%x)", fd);
2513 2509
2514 //%note jvm_r6 2510 //%note jvm_r6
2515 return (jint)hpi::read(fd, buf, nbytes); 2511 return (jint)os::restartable_read(fd, buf, nbytes);
2516 JVM_END 2512 JVM_END
2517 2513
2518 2514
2519 JVM_LEAF(jint, JVM_Write(jint fd, char *buf, jint nbytes)) 2515 JVM_LEAF(jint, JVM_Write(jint fd, char *buf, jint nbytes))
2520 JVMWrapper2("JVM_Write (0x%x)", fd); 2516 JVMWrapper2("JVM_Write (0x%x)", fd);
2521 2517
2522 //%note jvm_r6 2518 //%note jvm_r6
2523 return (jint)hpi::write(fd, buf, nbytes); 2519 return (jint)os::write(fd, buf, nbytes);
2524 JVM_END 2520 JVM_END
2525 2521
2526 2522
2527 JVM_LEAF(jint, JVM_Available(jint fd, jlong *pbytes)) 2523 JVM_LEAF(jint, JVM_Available(jint fd, jlong *pbytes))
2528 JVMWrapper2("JVM_Available (0x%x)", fd); 2524 JVMWrapper2("JVM_Available (0x%x)", fd);
2529 //%note jvm_r6 2525 //%note jvm_r6
2530 return hpi::available(fd, pbytes); 2526 return os::available(fd, pbytes);
2531 JVM_END 2527 JVM_END
2532 2528
2533 2529
2534 JVM_LEAF(jlong, JVM_Lseek(jint fd, jlong offset, jint whence)) 2530 JVM_LEAF(jlong, JVM_Lseek(jint fd, jlong offset, jint whence))
2535 JVMWrapper4("JVM_Lseek (0x%x, %Ld, %d)", fd, offset, whence); 2531 JVMWrapper4("JVM_Lseek (0x%x, %Ld, %d)", fd, offset, whence);
2536 //%note jvm_r6 2532 //%note jvm_r6
2537 return hpi::lseek(fd, offset, whence); 2533 return os::lseek(fd, offset, whence);
2538 JVM_END 2534 JVM_END
2539 2535
2540 2536
2541 JVM_LEAF(jint, JVM_SetLength(jint fd, jlong length)) 2537 JVM_LEAF(jint, JVM_SetLength(jint fd, jlong length))
2542 JVMWrapper3("JVM_SetLength (0x%x, %Ld)", fd, length); 2538 JVMWrapper3("JVM_SetLength (0x%x, %Ld)", fd, length);
2543 return hpi::ftruncate(fd, length); 2539 return os::ftruncate(fd, length);
2544 JVM_END 2540 JVM_END
2545 2541
2546 2542
2547 JVM_LEAF(jint, JVM_Sync(jint fd)) 2543 JVM_LEAF(jint, JVM_Sync(jint fd))
2548 JVMWrapper2("JVM_Sync (0x%x)", fd); 2544 JVMWrapper2("JVM_Sync (0x%x)", fd);
2549 //%note jvm_r6 2545 //%note jvm_r6
2550 return hpi::fsync(fd); 2546 return os::fsync(fd);
2551 JVM_END 2547 JVM_END
2552 2548
2553 2549
2554 // Printing support ////////////////////////////////////////////////// 2550 // Printing support //////////////////////////////////////////////////
2555 extern "C" { 2551 extern "C" {
3455 3451
3456 // Networking library support //////////////////////////////////////////////////////////////////// 3452 // Networking library support ////////////////////////////////////////////////////////////////////
3457 3453
3458 JVM_LEAF(jint, JVM_InitializeSocketLibrary()) 3454 JVM_LEAF(jint, JVM_InitializeSocketLibrary())
3459 JVMWrapper("JVM_InitializeSocketLibrary"); 3455 JVMWrapper("JVM_InitializeSocketLibrary");
3460 return hpi::initialize_socket_library(); 3456 return 0;
3461 JVM_END 3457 JVM_END
3462 3458
3463 3459
3464 JVM_LEAF(jint, JVM_Socket(jint domain, jint type, jint protocol)) 3460 JVM_LEAF(jint, JVM_Socket(jint domain, jint type, jint protocol))
3465 JVMWrapper("JVM_Socket"); 3461 JVMWrapper("JVM_Socket");
3466 return hpi::socket(domain, type, protocol); 3462 return os::socket(domain, type, protocol);
3467 JVM_END 3463 JVM_END
3468 3464
3469 3465
3470 JVM_LEAF(jint, JVM_SocketClose(jint fd)) 3466 JVM_LEAF(jint, JVM_SocketClose(jint fd))
3471 JVMWrapper2("JVM_SocketClose (0x%x)", fd); 3467 JVMWrapper2("JVM_SocketClose (0x%x)", fd);
3472 //%note jvm_r6 3468 //%note jvm_r6
3473 return hpi::socket_close(fd); 3469 return os::socket_close(fd);
3474 JVM_END 3470 JVM_END
3475 3471
3476 3472
3477 JVM_LEAF(jint, JVM_SocketShutdown(jint fd, jint howto)) 3473 JVM_LEAF(jint, JVM_SocketShutdown(jint fd, jint howto))
3478 JVMWrapper2("JVM_SocketShutdown (0x%x)", fd); 3474 JVMWrapper2("JVM_SocketShutdown (0x%x)", fd);
3479 //%note jvm_r6 3475 //%note jvm_r6
3480 return hpi::socket_shutdown(fd, howto); 3476 return os::socket_shutdown(fd, howto);
3481 JVM_END 3477 JVM_END
3482 3478
3483 3479
3484 JVM_LEAF(jint, JVM_Recv(jint fd, char *buf, jint nBytes, jint flags)) 3480 JVM_LEAF(jint, JVM_Recv(jint fd, char *buf, jint nBytes, jint flags))
3485 JVMWrapper2("JVM_Recv (0x%x)", fd); 3481 JVMWrapper2("JVM_Recv (0x%x)", fd);
3486 //%note jvm_r6 3482 //%note jvm_r6
3487 return hpi::recv(fd, buf, nBytes, flags); 3483 return os::recv(fd, buf, nBytes, flags);
3488 JVM_END 3484 JVM_END
3489 3485
3490 3486
3491 JVM_LEAF(jint, JVM_Send(jint fd, char *buf, jint nBytes, jint flags)) 3487 JVM_LEAF(jint, JVM_Send(jint fd, char *buf, jint nBytes, jint flags))
3492 JVMWrapper2("JVM_Send (0x%x)", fd); 3488 JVMWrapper2("JVM_Send (0x%x)", fd);
3493 //%note jvm_r6 3489 //%note jvm_r6
3494 return hpi::send(fd, buf, nBytes, flags); 3490 return os::send(fd, buf, nBytes, flags);
3495 JVM_END 3491 JVM_END
3496 3492
3497 3493
3498 JVM_LEAF(jint, JVM_Timeout(int fd, long timeout)) 3494 JVM_LEAF(jint, JVM_Timeout(int fd, long timeout))
3499 JVMWrapper2("JVM_Timeout (0x%x)", fd); 3495 JVMWrapper2("JVM_Timeout (0x%x)", fd);
3500 //%note jvm_r6 3496 //%note jvm_r6
3501 return hpi::timeout(fd, timeout); 3497 return os::timeout(fd, timeout);
3502 JVM_END 3498 JVM_END
3503 3499
3504 3500
3505 JVM_LEAF(jint, JVM_Listen(jint fd, jint count)) 3501 JVM_LEAF(jint, JVM_Listen(jint fd, jint count))
3506 JVMWrapper2("JVM_Listen (0x%x)", fd); 3502 JVMWrapper2("JVM_Listen (0x%x)", fd);
3507 //%note jvm_r6 3503 //%note jvm_r6
3508 return hpi::listen(fd, count); 3504 return os::listen(fd, count);
3509 JVM_END 3505 JVM_END
3510 3506
3511 3507
3512 JVM_LEAF(jint, JVM_Connect(jint fd, struct sockaddr *him, jint len)) 3508 JVM_LEAF(jint, JVM_Connect(jint fd, struct sockaddr *him, jint len))
3513 JVMWrapper2("JVM_Connect (0x%x)", fd); 3509 JVMWrapper2("JVM_Connect (0x%x)", fd);
3514 //%note jvm_r6 3510 //%note jvm_r6
3515 return hpi::connect(fd, him, len); 3511 return os::connect(fd, him, len);
3516 JVM_END 3512 JVM_END
3517 3513
3518 3514
3519 JVM_LEAF(jint, JVM_Bind(jint fd, struct sockaddr *him, jint len)) 3515 JVM_LEAF(jint, JVM_Bind(jint fd, struct sockaddr *him, jint len))
3520 JVMWrapper2("JVM_Bind (0x%x)", fd); 3516 JVMWrapper2("JVM_Bind (0x%x)", fd);
3521 //%note jvm_r6 3517 //%note jvm_r6
3522 return hpi::bind(fd, him, len); 3518 return os::bind(fd, him, len);
3523 JVM_END 3519 JVM_END
3524 3520
3525 3521
3526 JVM_LEAF(jint, JVM_Accept(jint fd, struct sockaddr *him, jint *len)) 3522 JVM_LEAF(jint, JVM_Accept(jint fd, struct sockaddr *him, jint *len))
3527 JVMWrapper2("JVM_Accept (0x%x)", fd); 3523 JVMWrapper2("JVM_Accept (0x%x)", fd);
3528 //%note jvm_r6 3524 //%note jvm_r6
3529 return hpi::accept(fd, him, (int *)len); 3525 return os::accept(fd, him, (int *)len);
3530 JVM_END 3526 JVM_END
3531 3527
3532 3528
3533 JVM_LEAF(jint, JVM_RecvFrom(jint fd, char *buf, int nBytes, int flags, struct sockaddr *from, int *fromlen)) 3529 JVM_LEAF(jint, JVM_RecvFrom(jint fd, char *buf, int nBytes, int flags, struct sockaddr *from, int *fromlen))
3534 JVMWrapper2("JVM_RecvFrom (0x%x)", fd); 3530 JVMWrapper2("JVM_RecvFrom (0x%x)", fd);
3535 //%note jvm_r6 3531 //%note jvm_r6
3536 return hpi::recvfrom(fd, buf, nBytes, flags, from, fromlen); 3532 return os::recvfrom(fd, buf, nBytes, flags, from, fromlen);
3537 JVM_END 3533 JVM_END
3538 3534
3539 3535
3540 JVM_LEAF(jint, JVM_GetSockName(jint fd, struct sockaddr *him, int *len)) 3536 JVM_LEAF(jint, JVM_GetSockName(jint fd, struct sockaddr *him, int *len))
3541 JVMWrapper2("JVM_GetSockName (0x%x)", fd); 3537 JVMWrapper2("JVM_GetSockName (0x%x)", fd);
3542 //%note jvm_r6 3538 //%note jvm_r6
3543 return hpi::get_sock_name(fd, him, len); 3539 return os::get_sock_name(fd, him, len);
3544 JVM_END 3540 JVM_END
3545 3541
3546 3542
3547 JVM_LEAF(jint, JVM_SendTo(jint fd, char *buf, int len, int flags, struct sockaddr *to, int tolen)) 3543 JVM_LEAF(jint, JVM_SendTo(jint fd, char *buf, int len, int flags, struct sockaddr *to, int tolen))
3548 JVMWrapper2("JVM_SendTo (0x%x)", fd); 3544 JVMWrapper2("JVM_SendTo (0x%x)", fd);
3549 //%note jvm_r6 3545 //%note jvm_r6
3550 return hpi::sendto(fd, buf, len, flags, to, tolen); 3546 return os::sendto(fd, buf, len, flags, to, tolen);
3551 JVM_END 3547 JVM_END
3552 3548
3553 3549
3554 JVM_LEAF(jint, JVM_SocketAvailable(jint fd, jint *pbytes)) 3550 JVM_LEAF(jint, JVM_SocketAvailable(jint fd, jint *pbytes))
3555 JVMWrapper2("JVM_SocketAvailable (0x%x)", fd); 3551 JVMWrapper2("JVM_SocketAvailable (0x%x)", fd);
3556 //%note jvm_r6 3552 //%note jvm_r6
3557 return hpi::socket_available(fd, pbytes); 3553 return os::socket_available(fd, pbytes);
3558 JVM_END 3554 JVM_END
3559 3555
3560 3556
3561 JVM_LEAF(jint, JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen)) 3557 JVM_LEAF(jint, JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen))
3562 JVMWrapper2("JVM_GetSockOpt (0x%x)", fd); 3558 JVMWrapper2("JVM_GetSockOpt (0x%x)", fd);
3563 //%note jvm_r6 3559 //%note jvm_r6
3564 return hpi::get_sock_opt(fd, level, optname, optval, optlen); 3560 return os::get_sock_opt(fd, level, optname, optval, optlen);
3565 JVM_END 3561 JVM_END
3566 3562
3567 3563
3568 JVM_LEAF(jint, JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen)) 3564 JVM_LEAF(jint, JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen))
3569 JVMWrapper2("JVM_GetSockOpt (0x%x)", fd); 3565 JVMWrapper2("JVM_GetSockOpt (0x%x)", fd);
3570 //%note jvm_r6 3566 //%note jvm_r6
3571 return hpi::set_sock_opt(fd, level, optname, optval, optlen); 3567 return os::set_sock_opt(fd, level, optname, optval, optlen);
3572 JVM_END 3568 JVM_END
3573 3569
3574 JVM_LEAF(int, JVM_GetHostName(char* name, int namelen)) 3570 JVM_LEAF(int, JVM_GetHostName(char* name, int namelen))
3575 JVMWrapper("JVM_GetHostName"); 3571 JVMWrapper("JVM_GetHostName");
3576 return hpi::get_host_name(name, namelen); 3572 return os::get_host_name(name, namelen);
3577 JVM_END 3573 JVM_END
3578
3579 #ifdef _WINDOWS
3580
3581 JVM_LEAF(struct hostent*, JVM_GetHostByAddr(const char* name, int len, int type))
3582 JVMWrapper("JVM_GetHostByAddr");
3583 return hpi::get_host_by_addr(name, len, type);
3584 JVM_END
3585
3586
3587 JVM_LEAF(struct hostent*, JVM_GetHostByName(char* name))
3588 JVMWrapper("JVM_GetHostByName");
3589 return hpi::get_host_by_name(name);
3590 JVM_END
3591
3592
3593 JVM_LEAF(struct protoent*, JVM_GetProtoByName(char* name))
3594 JVMWrapper("JVM_GetProtoByName");
3595 return hpi::get_proto_by_name(name);
3596 JVM_END
3597
3598 #endif
3599 3574
3600 // Library support /////////////////////////////////////////////////////////////////////////// 3575 // Library support ///////////////////////////////////////////////////////////////////////////
3601 3576
3602 JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* name)) 3577 JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* name))
3603 //%note jvm_ct 3578 //%note jvm_ct
3604 JVMWrapper2("JVM_LoadLibrary (%s)", name); 3579 JVMWrapper2("JVM_LoadLibrary (%s)", name);
3605 char ebuf[1024]; 3580 char ebuf[1024];
3606 void *load_result; 3581 void *load_result;
3607 { 3582 {
3608 ThreadToNativeFromVM ttnfvm(thread); 3583 ThreadToNativeFromVM ttnfvm(thread);
3609 load_result = hpi::dll_load(name, ebuf, sizeof ebuf); 3584 load_result = os::dll_load(name, ebuf, sizeof ebuf);
3610 } 3585 }
3611 if (load_result == NULL) { 3586 if (load_result == NULL) {
3612 char msg[1024]; 3587 char msg[1024];
3613 jio_snprintf(msg, sizeof msg, "%s: %s", name, ebuf); 3588 jio_snprintf(msg, sizeof msg, "%s: %s", name, ebuf);
3614 // Since 'ebuf' may contain a string encoded using 3589 // Since 'ebuf' may contain a string encoded using
3626 JVM_END 3601 JVM_END
3627 3602
3628 3603
3629 JVM_LEAF(void, JVM_UnloadLibrary(void* handle)) 3604 JVM_LEAF(void, JVM_UnloadLibrary(void* handle))
3630 JVMWrapper("JVM_UnloadLibrary"); 3605 JVMWrapper("JVM_UnloadLibrary");
3631 hpi::dll_unload(handle); 3606 os::dll_unload(handle);
3632 JVM_END 3607 JVM_END
3633 3608
3634 3609
3635 JVM_LEAF(void*, JVM_FindLibraryEntry(void* handle, const char* name)) 3610 JVM_LEAF(void*, JVM_FindLibraryEntry(void* handle, const char* name))
3636 JVMWrapper2("JVM_FindLibraryEntry (%s)", name); 3611 JVMWrapper2("JVM_FindLibraryEntry (%s)", name);
3637 return hpi::dll_lookup(handle, name); 3612 return os::dll_lookup(handle, name);
3638 JVM_END 3613 JVM_END
3639 3614
3640 // Floating point support //////////////////////////////////////////////////////////////////// 3615 // Floating point support ////////////////////////////////////////////////////////////////////
3641 3616
3642 JVM_LEAF(jboolean, JVM_IsNaN(jdouble a)) 3617 JVM_LEAF(jboolean, JVM_IsNaN(jdouble a))