Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/cassume/ctest.c
5986 views
1
/*******************************************************************************
2
* Copyright (c) 1991, 2019 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception
21
*******************************************************************************/
22
23
#include "ctest.h"
24
#include "basesize.h"
25
#include "exelib_api.h"
26
#include "vatest.h"
27
#include "cassume_internal.h"
28
29
J9PortLibrary *cTestPortLib = NULL;
30
UDATA passCount = 0, failCount = 0;
31
32
UDATA signalProtectedMain(struct J9PortLibrary *portLibrary, void *arg)
33
{
34
struct j9cmdlineOptions * args = arg;
35
int argc = args->argc;
36
char **argv = args->argv;
37
PORT_ACCESS_FROM_PORT(args->portLibrary);
38
cTestPortLib = args->portLibrary;
39
40
#ifdef J9VM_OPT_MEMORY_CHECK_SUPPORT
41
/* This should happen before anybody allocates memory! Otherwise, shutdown will not work properly. */
42
memoryCheck_parseCmdLine( cTestPortLib, argc-1, argv );
43
#endif /* J9VM_OPT_MEMORY_CHECK_SUPPORT */
44
45
j9tty_printf(PORTLIB, "C Assumptions Test Start\n");
46
47
verifyJNISizes();
48
verifyVAList();
49
verifyUDATASizes();
50
51
/* Ensure floatTemp1 is 8-aligned */
52
j9_assume(offsetof(J9VMThread, floatTemp1) % 8, 0);
53
#if defined(J9VM_JIT_TRANSACTION_DIAGNOSTIC_THREAD_BLOCK)
54
/* Ensure transactionDiagBlock is 8-aligned */
55
j9_assume(offsetof(J9VMThread, transactionDiagBlock) % 8, 0);
56
#endif /* J9VM_JIT_TRANSACTION_DIAGNOSTIC_THREAD_BLOCK */
57
58
/* Ensure J9ROMClass, J9ROMArrayClass, and J9ROMReflectClass are 64-bit aligned. 64 bits = 8 bytes */
59
j9_assume(sizeof(J9ROMClass) % 8, 0);
60
j9_assume(sizeof(J9ROMArrayClass) % 8, 0);
61
j9_assume(sizeof(J9ROMReflectClass) % 8, 0);
62
63
j9tty_printf(PORTLIB, "C Assumptions Test Finished\n");
64
j9tty_printf(PORTLIB, "total tests: %d\n", passCount + failCount);
65
j9tty_printf(PORTLIB, "total passes: %d\n", passCount);
66
j9tty_printf(PORTLIB, "total failures: %d\n", failCount);
67
68
return 0;
69
}
70
71