Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Unified Diff: crosstest/xdefs.h

Issue 1273153002: Subzero. Native 64-bit int arithmetic on x86-64. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Removes the x8664-specific xtest target. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: crosstest/xdefs.h
diff --git a/crosstest/xdefs.h b/crosstest/xdefs.h
new file mode 100644
index 0000000000000000000000000000000000000000..0194c9a32c8b875e8945160e6028155f97693a63
--- /dev/null
+++ b/crosstest/xdefs.h
@@ -0,0 +1,53 @@
+//===- subzero/crosstest/xdefs.h - Definitions for the crosstests. --------===//
+//
+// The Subzero Code Generator
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Defines the int64 and uint64 types to avoid link-time errors when compiling
+// the crosstests in LP64.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef XDEFS_H_
Jim Stichnoth 2015/08/10 16:08:04 Probably better to use SUBZERO_CROSSTEST_XDEFS_H.
John 2015/08/10 20:41:17 Done.
+#define XDEFS_H_
+
+typedef unsigned int int32;
+typedef unsigned int uint32;
+typedef long long int64;
+typedef unsigned long long uint64;
+typedef unsigned int SizeT;
+
+#ifdef X8664_STACK_HACK
+
+// the X86_STACK_HACK is an intrusive way of getting the crosstests to run in
+// x86_64_64 even with and ILP32 model. This hack allocates a new stack for
Jim Stichnoth 2015/08/10 16:08:04 x86_64 also, s/and/an/ BTW, I'm amazed that only
John 2015/08/10 20:41:17 X86_64_64 was a failed attempt to mean x86-64 LP64
+// running the tests in the low 4GB of the address space.
+
+#ifdef __cplusplus
+#define XTEST_EXTERN extern "C"
+#else // !defined(__cplusplus)
+#define XTEST_EXTERN extern
+#endif // __cplusplus
+
+/// xAllocStack allocates the memory chunk [StackEnd - Size - 1, StackEnd). It
+/// requires StackEnd to be less than 32-bits long. Conversely, xDeallocStack
+/// frees that memory chunk.
+/// {@
+XTEST_EXTERN unsigned char *xAllocStack(uint64 StackEnd, uint32 Size);
+XTEST_EXTERN void xDeallocStack(uint64 StackEnd, uint32 Size);
+/// @}
+
+// wrapped_main is invoked by the x86-64 stack hack main. We declare a prototype
+// so the compiler (and not the linker) can yell if a test's wrapped_main
+// prototype does not match what we want.
+XTEST_EXTERN int wrapped_main(int argc, char *argv[]);
+
+#undef XTEST_EXTERN
+
+#endif // X8664_STACK_HACK
+
+#endif // XDEFS_H_

Powered by Google App Engine
This is Rietveld 408576698