Skip to content

Commit

Permalink
Changes to make Terra compatible with PowerPC.
Browse files Browse the repository at this point in the history
  • Loading branch information
elliottslaughter committed Oct 11, 2019
1 parent cd8c2c1 commit 6cbe76f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 68 deletions.
2 changes: 1 addition & 1 deletion src/tdebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "terrastate.h"
#include "tcompilerstate.h"

#if !defined(__arm__) && !defined(__aarch64__)
#if !defined(__arm__) && !defined(__aarch64__) && !defined(__PPC__)

#ifndef _WIN32
#include <execinfo.h>
Expand Down
38 changes: 0 additions & 38 deletions src/tffi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2883,32 +2883,6 @@ static int setup_upvals(lua_State* L) {
/* setup ABI params table */
push_upval(L, &abi_key);

#if defined ARCH_X86 || defined ARCH_ARM
lua_pushboolean(L, 1);
lua_setfield(L, -2, "32bit");
#elif defined ARCH_X64
lua_pushboolean(L, 1);
lua_setfield(L, -2, "64bit");
#else
#error
#endif

#if defined ARCH_X86 || defined ARCH_X64 || defined ARCH_ARM
lua_pushboolean(L, 1);
lua_setfield(L, -2, "le");
#else
#error
#endif

#if defined ARCH_X86 || defined ARCH_X64
lua_pushboolean(L, 1);
lua_setfield(L, -2, "fpu");
#elif defined ARCH_ARM
lua_pushboolean(L, 1);
lua_setfield(L, -2, "softfp");
#else
#error
#endif
lua_pop(L, 1); /* abi tbl */

/* GC table - shouldn't pin cdata values */
Expand Down Expand Up @@ -2937,18 +2911,6 @@ static int setup_upvals(lua_State* L) {
#endif
lua_setfield(L, 1, "os");

/* ffi.arch */
#if defined ARCH_X86
lua_pushliteral(L, "x86");
#elif defined ARCH_X64
lua_pushliteral(L, "x64");
#elif defined ARCH_ARM
lua_pushliteral(L, "arm");
#else
#error
#endif
lua_setfield(L, 1, "arch");

assert(lua_gettop(L) == 1);

return 0;
Expand Down
13 changes: 0 additions & 13 deletions src/tffi.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,6 @@ static char* luaL_prepbuffsize(luaL_Buffer* B, size_t sz) {
#define OS_POSIX
#endif

/* architecture */
#if defined __i386__ || defined _M_IX86
#define ARCH_X86
#elif defined __amd64__ || defined _M_X64
#define ARCH_X64
#elif defined __arm__ || defined __ARM__ || defined ARM || defined __ARM || defined __arm
#define ARCH_ARM
#else
#error
#endif

#ifdef _WIN32

#ifdef UNDER_CE
Expand Down Expand Up @@ -165,9 +154,7 @@ static void* DoLoadLibraryA(const char* name) {
#define EnableWrite(data, size) mprotect(data, size, PROT_READ | PROT_WRITE)
#endif

#if defined ARCH_X86 || defined ARCH_X64
#define ALLOW_MISALIGNED_ACCESS
#endif

struct token;

Expand Down
18 changes: 2 additions & 16 deletions src/tffi_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1173,26 +1173,12 @@ static int parse_attribute(lua_State* L, struct parser* P, struct token* tok,
ct->base_size = sizeof(uint16_t);
ct->align_mask = ALIGNOF(a16);

} else if (IS_LITERAL(*tok, "SI") || IS_LITERAL(*tok, "__SI__")
#if defined ARCH_X86 || defined ARCH_ARM
|| IS_LITERAL(*tok, "word") ||
IS_LITERAL(*tok, "__word__") ||
IS_LITERAL(*tok, "pointer") ||
IS_LITERAL(*tok, "__pointer__")
#endif
) {
} else if (IS_LITERAL(*tok, "SI") || IS_LITERAL(*tok, "__SI__")) {
ct->type = INT32_TYPE;
ct->base_size = sizeof(uint32_t);
ct->align_mask = ALIGNOF(a32);

} else if (IS_LITERAL(*tok, "DI") || IS_LITERAL(*tok, "__DI__")
#if defined ARCH_X64
|| IS_LITERAL(*tok, "word") ||
IS_LITERAL(*tok, "__word__") ||
IS_LITERAL(*tok, "pointer") ||
IS_LITERAL(*tok, "__pointer__")
#endif
) {
} else if (IS_LITERAL(*tok, "DI") || IS_LITERAL(*tok, "__DI__")) {
ct->type = INT64_TYPE;
ct->base_size = sizeof(uint64_t);
ct->align_mask = ALIGNOF(a64);
Expand Down

0 comments on commit 6cbe76f

Please sign in to comment.