/*******************************************************************************1* Copyright (c) 1991, 2019 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* 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-exception20*******************************************************************************/2122#include "ctest.h"23#include "basesize.h"24#include "exelib_api.h"25#include "vatest.h"26#include "cassume_internal.h"2728J9PortLibrary *cTestPortLib = NULL;29UDATA passCount = 0, failCount = 0;3031UDATA signalProtectedMain(struct J9PortLibrary *portLibrary, void *arg)32{33struct j9cmdlineOptions * args = arg;34int argc = args->argc;35char **argv = args->argv;36PORT_ACCESS_FROM_PORT(args->portLibrary);37cTestPortLib = args->portLibrary;3839#ifdef J9VM_OPT_MEMORY_CHECK_SUPPORT40/* This should happen before anybody allocates memory! Otherwise, shutdown will not work properly. */41memoryCheck_parseCmdLine( cTestPortLib, argc-1, argv );42#endif /* J9VM_OPT_MEMORY_CHECK_SUPPORT */4344j9tty_printf(PORTLIB, "C Assumptions Test Start\n");4546verifyJNISizes();47verifyVAList();48verifyUDATASizes();4950/* Ensure floatTemp1 is 8-aligned */51j9_assume(offsetof(J9VMThread, floatTemp1) % 8, 0);52#if defined(J9VM_JIT_TRANSACTION_DIAGNOSTIC_THREAD_BLOCK)53/* Ensure transactionDiagBlock is 8-aligned */54j9_assume(offsetof(J9VMThread, transactionDiagBlock) % 8, 0);55#endif /* J9VM_JIT_TRANSACTION_DIAGNOSTIC_THREAD_BLOCK */5657/* Ensure J9ROMClass, J9ROMArrayClass, and J9ROMReflectClass are 64-bit aligned. 64 bits = 8 bytes */58j9_assume(sizeof(J9ROMClass) % 8, 0);59j9_assume(sizeof(J9ROMArrayClass) % 8, 0);60j9_assume(sizeof(J9ROMReflectClass) % 8, 0);6162j9tty_printf(PORTLIB, "C Assumptions Test Finished\n");63j9tty_printf(PORTLIB, "total tests: %d\n", passCount + failCount);64j9tty_printf(PORTLIB, "total passes: %d\n", passCount);65j9tty_printf(PORTLIB, "total failures: %d\n", failCount);6667return 0;68}697071