< prev index next >

src/hotspot/share/prims/downcallLinker.cpp

Print this page

15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 #include "downcallLinker.hpp"
25 #include "runtime/interfaceSupport.inline.hpp"
26 
27 #include <cerrno>
28 #ifdef _WIN64
29 #include <Windows.h>
30 #include <Winsock2.h>
31 #endif
32 
33 // keep in synch with jdk.internal.foreign.abi.CapturableState
34 enum PreservableValues {
35   NONE = 0,
36   GET_LAST_ERROR = 1,
37   WSA_GET_LAST_ERROR = 1 << 1,
38   ERRNO = 1 << 2
39 };
40 
41 // We call this from _thread_in_native, right before a downcall
42 JVM_LEAF(void, DowncallLinker::capture_state_pre(int32_t* value_ptr, int captured_state_mask))
43 #ifdef _WIN64
44   if (captured_state_mask & GET_LAST_ERROR) {
45     SetLastError(*value_ptr);
46   }
47   value_ptr++;
48   if (captured_state_mask & WSA_GET_LAST_ERROR) {
49     WSASetLastError(*value_ptr);
50     *value_ptr = WSAGetLastError();
51   }
52   value_ptr++;
53 #endif
54   if (captured_state_mask & ERRNO) {
55     errno = *value_ptr;
56   }
57 JVM_END
58 

15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 #include "downcallLinker.hpp"
25 #include "runtime/interfaceSupport.inline.hpp"
26 
27 #include <cerrno>
28 #ifdef _WIN64
29 #include <Windows.h>
30 #include <Winsock2.h>
31 #endif
32 
33 // keep in synch with jdk.internal.foreign.abi.CapturableState
34 enum PreservableValues {
35   GET_LAST_ERROR      = 1 << 0,
36   WSA_GET_LAST_ERROR  = 1 << 1,
37   ERRNO               = 1 << 2

38 };
39 
40 // We call this from _thread_in_native, right before a downcall
41 JVM_LEAF(void, DowncallLinker::capture_state_pre(int32_t* value_ptr, int captured_state_mask))
42 #ifdef _WIN64
43   if (captured_state_mask & GET_LAST_ERROR) {
44     SetLastError(*value_ptr);
45   }
46   value_ptr++;
47   if (captured_state_mask & WSA_GET_LAST_ERROR) {
48     WSASetLastError(*value_ptr);
49     *value_ptr = WSAGetLastError();
50   }
51   value_ptr++;
52 #endif
53   if (captured_state_mask & ERRNO) {
54     errno = *value_ptr;
55   }
56 JVM_END
57 
< prev index next >