hotspot/test/runtime/jni/CalleeSavedRegisters/exeFPRegs.c
author kvn
Fri, 28 Oct 2016 12:28:46 -0700
changeset 42076 d6c3ecec1d34
permissions -rw-r--r--
8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows) Summary: save/restore registers in generate_get_cpu_info() code which checks interrupts. Reviewed-by: kvn, mcberg Contributed-by: dmitry.chuyko@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
42076
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
     1
/*
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
     4
 *
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
     7
 * published by the Free Software Foundation.
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
     8
 *
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    13
 * accompanied this code).
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    14
 *
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    18
 *
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    21
 * questions.
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    22
 *
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    23
 */
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    24
#include <jni.h>
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    25
#include <stdlib.h>
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    26
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    27
#ifdef WINDOWS
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    28
#include <windows.h>
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    29
#else
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    30
#include <dlfcn.h>
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    31
#endif // WINDOWS
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    32
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    33
#ifdef WINDOWS
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    34
  HMODULE handle;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    35
#else
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    36
  void* handle;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    37
#endif // WINDOWS
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    38
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    39
jint(JNICALL *jni_create_java_vm)(JavaVM **, JNIEnv **, void *) = NULL;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    40
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    41
// method to perform dlclose on an open dynamic library handle
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    42
void closeHandle() {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    43
#ifdef WINDOWS
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    44
  if (!FreeLibrary(handle)) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    45
   fprintf(stderr, "Error occurred while closing handle: 0x%02X\n", GetLastError());
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    46
  }
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    47
#else
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    48
  if (dlclose(handle) != 0) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    49
    fprintf(stderr, "Error occurred while closing handle: %s\n", dlerror());
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    50
  }
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    51
#endif // WINDOWS
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    52
}
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    53
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    54
void fail(int code) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    55
  if (handle) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    56
    closeHandle();
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    57
  }
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    58
  exit(code);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    59
}
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    60
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    61
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    62
// method to load the dynamic library libjvm
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    63
int loadJVM(const char* path) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    64
#ifdef WINDOWS
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    65
  UINT errorMode = GetErrorMode();
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    66
  SetErrorMode(errorMode | SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    67
  handle = LoadLibraryA(path);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    68
#else
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    69
  handle = dlopen(path, RTLD_LAZY);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    70
#endif // WINDOWS
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    71
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    72
  if (handle) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    73
    // find the address of function
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    74
#ifdef WINDOWS
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    75
    *(void **) (&jni_create_java_vm) = GetProcAddress(handle, "JNI_CreateJavaVM");
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    76
#else
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    77
    *(void **) (&jni_create_java_vm) = dlsym(handle, "JNI_CreateJavaVM");
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    78
#endif // WINDOWS
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    79
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    80
    if (jni_create_java_vm == NULL) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    81
      fprintf(stderr, "ERROR: No JNI_CreateJavaVM found: '%s'\n", path);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    82
      return -1;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    83
    }
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    84
  } else {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    85
#ifdef WINDOWS
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    86
    fprintf(stderr, "ERROR: Can't load JVM library: 0x%02X\n", GetLastError());
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    87
#else
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    88
    fprintf(stderr, "ERROR: Can't load JVM library: %s\n", dlerror());
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    89
#endif // WINDOWS
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    90
    return -1;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    91
  }
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    92
  return 0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    93
}
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    94
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    95
long long unsigned int d2l(double d) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    96
  union {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    97
    double d;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    98
    long long unsigned int llu;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
    99
  } dl;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   100
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   101
  dl.d = d;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   102
  return dl.llu;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   103
}
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   104
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   105
#define print_reg(r) printf("%s = %f (0x%llX)\n", #r, r, d2l(r));
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   106
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   107
int main(int argc, const char** argv) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   108
  JavaVM* jvm;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   109
  JNIEnv* env;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   110
  JavaVMInitArgs vm_args;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   111
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   112
  // values to trick constant folding
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   113
  long long unsigned int vd[32];
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   114
  int i;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   115
  int bad_cnt = 0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   116
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   117
  // values occupy fp registers
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   118
  // note: suitable code shape is produced only on Windows,
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   119
  // and even then registers are corrupted not on every machine
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   120
  register double d00;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   121
  register double d01;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   122
  register double d02;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   123
  register double d03;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   124
  register double d04;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   125
  register double d05;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   126
  register double d06;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   127
  register double d07;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   128
  register double d08;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   129
  register double d09;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   130
  register double d10;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   131
  register double d11;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   132
  register double d12;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   133
  register double d13;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   134
  register double d14;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   135
  register double d15;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   136
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   137
  if (argc != 2) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   138
    printf("Usage: FPRegs <jvm_path>");
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   139
    fail(2);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   140
  }
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   141
  printf("jvm_path = %s\n", argv[1]);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   142
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   143
  if (loadJVM(argv[1]) < 0) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   144
    fail(3);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   145
  }
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   146
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   147
  vm_args.version = JNI_VERSION_1_8;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   148
  vm_args.ignoreUnrecognized = JNI_FALSE;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   149
  vm_args.options = NULL;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   150
  vm_args.nOptions = 0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   151
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   152
  for(i = 0; i < 16; i++) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   153
    vd[i] = d2l(100 + i);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   154
  }
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   155
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   156
  d00 = 100.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   157
  d01 = 101.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   158
  d02 = 102.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   159
  d03 = 103.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   160
  d04 = 104.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   161
  d05 = 105.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   162
  d06 = 106.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   163
  d07 = 107.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   164
  d08 = 108.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   165
  d09 = 109.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   166
  d10 = 110.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   167
  d11 = 111.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   168
  d12 = 112.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   169
  d13 = 113.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   170
  d14 = 114.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   171
  d15 = 115.0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   172
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   173
  printf("BEFORE:\n");
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   174
  print_reg(d00);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   175
  print_reg(d01);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   176
  print_reg(d02);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   177
  print_reg(d03);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   178
  print_reg(d04);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   179
  print_reg(d05);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   180
  print_reg(d06);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   181
  print_reg(d07);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   182
  print_reg(d08);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   183
  print_reg(d09);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   184
  print_reg(d10);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   185
  print_reg(d11);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   186
  print_reg(d12);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   187
  print_reg(d13);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   188
  print_reg(d14);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   189
  print_reg(d15);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   190
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   191
  if (jni_create_java_vm(&jvm, &env, &vm_args) < 0 ) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   192
    fprintf(stderr, "ERROR: Can't create JavaVM\n");
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   193
    fail(4);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   194
  }
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   195
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   196
  if (d2l(d00) != vd[0]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   197
  if (d2l(d01) != vd[1]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   198
  if (d2l(d02) != vd[2]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   199
  if (d2l(d03) != vd[3]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   200
  if (d2l(d04) != vd[4]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   201
  if (d2l(d05) != vd[5]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   202
  if (d2l(d06) != vd[6]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   203
  if (d2l(d07) != vd[7]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   204
  if (d2l(d08) != vd[8]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   205
  if (d2l(d09) != vd[9]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   206
  if (d2l(d10) != vd[10]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   207
  if (d2l(d11) != vd[11]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   208
  if (d2l(d12) != vd[12]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   209
  if (d2l(d13) != vd[13]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   210
  if (d2l(d14) != vd[14]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   211
  if (d2l(d15) != vd[15]) bad_cnt++;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   212
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   213
  printf("AFTER:\n");
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   214
  print_reg(d00);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   215
  print_reg(d01);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   216
  print_reg(d02);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   217
  print_reg(d03);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   218
  print_reg(d04);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   219
  print_reg(d05);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   220
  print_reg(d06);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   221
  print_reg(d07);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   222
  print_reg(d08);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   223
  print_reg(d09);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   224
  print_reg(d10);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   225
  print_reg(d11);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   226
  print_reg(d12);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   227
  print_reg(d13);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   228
  print_reg(d14);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   229
  print_reg(d15);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   230
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   231
  printf("%d registers corrupted\n", bad_cnt);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   232
  if (bad_cnt > 0) {
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   233
      printf("TEST FAILED");
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   234
      fail(1);
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   235
  }
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   236
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   237
  printf("TEST PASSED");
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   238
  closeHandle();
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   239
  return 0;
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   240
}
d6c3ecec1d34 8067744: XMM/SSE float register values corrupted by JNI_CreateVM call in JRE 8 (Windows)
kvn
parents:
diff changeset
   241