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 Aug 23, 2019
1 parent 1261fee commit 642b312
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 60 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 @@ -2866,32 +2866,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 */


Expand Down Expand Up @@ -2923,18 +2897,6 @@ static int setup_upvals(lua_State* L)
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 @@ -110,17 +110,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

Expand Down Expand Up @@ -157,9 +146,7 @@ static char* luaL_prepbuffsize(luaL_Buffer* B, size_t sz) {
# 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
8 changes: 0 additions & 8 deletions src/tffi_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -1104,20 +1104,12 @@ static int parse_attribute(lua_State* L, struct parser* P, struct token* tok, st
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
) {
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
) {
ct->type = INT64_TYPE;
ct->base_size = sizeof(uint64_t);
Expand Down

0 comments on commit 642b312

Please sign in to comment.