Loading include/acc/acc.h +6 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,12 @@ void accGetScriptLabel(ACCscript* script, const ACCchar * name, void accGetPragmas(ACCscript* script, ACCsizei* actualStringCount, ACCsizei maxStringCount, ACCchar** strings); /* Used to implement disassembly */ void accGetProgramBinary(ACCscript* script, ACCvoid** base, ACCsizei* length); #ifdef __cplusplus }; #endif Loading libacc/Android.mk +0 −8 Original line number Diff line number Diff line Loading @@ -7,10 +7,6 @@ include $(CLEAR_VARS) LOCAL_MODULE:= libacc LOCAL_SRC_FILES := acc.cpp ifeq ($(TARGET_ARCH),arm) LOCAL_SRC_FILES += disassem.cpp endif LOCAL_SHARED_LIBRARIES := libdl libcutils include $(BUILD_SHARED_LIBRARY) Loading @@ -24,10 +20,6 @@ LOCAL_SRC_FILES := acc.cpp LOCAL_CFLAGS := -O0 -g ifeq ($(TARGET_ARCH),arm) LOCAL_SRC_FILES += disassem.cpp endif LOCAL_STATIC_LIBRARIES := libcutils LOCAL_LDLIBS := -ldl Loading libacc/acc.cpp +10 −75 Original line number Diff line number Diff line Loading @@ -39,10 +39,6 @@ #define PROVIDE_X64_CODEGEN #endif #ifdef PROVIDE_ARM_CODEGEN #include "disassem.h" #endif #if (defined(__VFP_FP__) && !defined(__SOFTFP__)) #define ARM_USE_VFP #endif Loading @@ -55,7 +51,6 @@ #define LOG_STACK(...) do {} while(0) // #define LOG_STACK(...) fprintf (stderr, __VA_ARGS__) #define ENABLE_ARM_DISASSEMBLY // #define PROVIDE_TRACE_CODEGEN // Uncomment to save input to a text file in DEBUG_DUMP_PATTERN Loading Loading @@ -484,11 +479,6 @@ class Compiler : public ErrorSink { */ virtual void adjustStackAfterCall(Type* pDecl, int l, bool isIndirect) = 0; /* Print a disassembly of the assembled code to out. Return * non-zero if there is an error. */ virtual int disassemble(FILE* out) = 0; /* Generate a symbol at the current PC. t is the head of a * linked list of addresses to patch. */ Loading Loading @@ -695,9 +685,9 @@ class Compiler : public ErrorSink { public: ARMCodeGenerator() { #ifdef ARM_USE_VFP LOGD("Using ARM VFP hardware floating point."); // LOGD("Using ARM VFP hardware floating point."); #else LOGD("Using ARM soft floating point."); // LOGD("Using ARM soft floating point."); #endif } Loading Loading @@ -1764,24 +1754,6 @@ class Compiler : public ErrorSink { #endif } virtual int disassemble(FILE* out) { #ifdef ENABLE_ARM_DISASSEMBLY disasmOut = out; disasm_interface_t di; di.di_readword = disassemble_readword; di.di_printaddr = disassemble_printaddr; di.di_printf = disassemble_printf; int base = getBase(); int pc = getPC(); for(int i = base; i < pc; i += 4) { fprintf(out, "%08x: %08x ", i, *(int*) i); ::disasm(&di, i, 0); } #endif return 0; } /** * alignment (in bytes) for this type of data */ Loading Loading @@ -1833,27 +1805,6 @@ class Compiler : public ErrorSink { } private: static FILE* disasmOut; static u_int disassemble_readword(u_int address) { return(*((u_int *)address)); } static void disassemble_printaddr(u_int address) { fprintf(disasmOut, "0x%08x", address); } static void disassemble_printf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); vfprintf(disasmOut, fmt, ap); va_end(ap); } static const int BRANCH_REL_ADDRESS_MASK = 0x00ffffff; Loading Loading @@ -2783,10 +2734,6 @@ class Compiler : public ErrorSink { return 5; } virtual int disassemble(FILE* out) { return 0; } /* output a symbol and patch all calls to it */ virtual void gsym(int t) { int n; Loading Loading @@ -3114,10 +3061,6 @@ class Compiler : public ErrorSink { return mpBase->jumpOffset(); } virtual int disassemble(FILE* out) { return mpBase->disassemble(out); } /* output a symbol and patch all calls to it */ virtual void gsym(int t) { fprintf(stderr, "gsym(%d)\n", t); Loading Loading @@ -5755,15 +5698,6 @@ public: return true; } int dump(FILE* out) { fwrite(codeBuf.getBase(), 1, codeBuf.getSize(), out); return 0; } int disassemble(FILE* out) { return pGen->disassemble(out); } /* Look through the symbol table to find a symbol. * If found, return its value. */ Loading Loading @@ -5796,10 +5730,14 @@ public: } } void getProgramBinary(ACCvoid** base, ACCsizei* length) { *base = codeBuf.getBase(); *length = (ACCsizei) codeBuf.getSize(); } char* getErrorMessage() { return mErrorBuf.getUnwrapped(); } }; const char* Compiler::operatorChars = Loading @@ -5813,10 +5751,6 @@ const char Compiler::operatorLevel[] = 2, 2 /* ~ ! */ }; #ifdef PROVIDE_ARM_CODEGEN FILE* Compiler::ARMCodeGenerator::disasmOut; #endif #ifdef PROVIDE_X86_CODEGEN const int Compiler::X86CodeGenerator::operatorHelper[] = { 0x1, // ++ Loading Loading @@ -6014,8 +5948,9 @@ void accGetPragmas(ACCscript* script, ACCsizei* actualStringCount, } extern "C" void accDisassemble(ACCscript* script) { script->compiler.disassemble(stderr); void accGetProgramBinary(ACCscript* script, ACCvoid** base, ACCsizei* length) { script->compiler.getProgramBinary(base, length); } Loading libacc/tests/Android.mk +2 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ include $(CLEAR_VARS) LOCAL_MODULE:= acc LOCAL_SRC_FILES:= \ main.cpp main.cpp \ disassem.cpp LOCAL_SHARED_LIBRARIES := \ libacc Loading libacc/armreg.h→libacc/tests/armreg.h +0 −0 File moved. View file Loading
include/acc/acc.h +6 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,12 @@ void accGetScriptLabel(ACCscript* script, const ACCchar * name, void accGetPragmas(ACCscript* script, ACCsizei* actualStringCount, ACCsizei maxStringCount, ACCchar** strings); /* Used to implement disassembly */ void accGetProgramBinary(ACCscript* script, ACCvoid** base, ACCsizei* length); #ifdef __cplusplus }; #endif Loading
libacc/Android.mk +0 −8 Original line number Diff line number Diff line Loading @@ -7,10 +7,6 @@ include $(CLEAR_VARS) LOCAL_MODULE:= libacc LOCAL_SRC_FILES := acc.cpp ifeq ($(TARGET_ARCH),arm) LOCAL_SRC_FILES += disassem.cpp endif LOCAL_SHARED_LIBRARIES := libdl libcutils include $(BUILD_SHARED_LIBRARY) Loading @@ -24,10 +20,6 @@ LOCAL_SRC_FILES := acc.cpp LOCAL_CFLAGS := -O0 -g ifeq ($(TARGET_ARCH),arm) LOCAL_SRC_FILES += disassem.cpp endif LOCAL_STATIC_LIBRARIES := libcutils LOCAL_LDLIBS := -ldl Loading
libacc/acc.cpp +10 −75 Original line number Diff line number Diff line Loading @@ -39,10 +39,6 @@ #define PROVIDE_X64_CODEGEN #endif #ifdef PROVIDE_ARM_CODEGEN #include "disassem.h" #endif #if (defined(__VFP_FP__) && !defined(__SOFTFP__)) #define ARM_USE_VFP #endif Loading @@ -55,7 +51,6 @@ #define LOG_STACK(...) do {} while(0) // #define LOG_STACK(...) fprintf (stderr, __VA_ARGS__) #define ENABLE_ARM_DISASSEMBLY // #define PROVIDE_TRACE_CODEGEN // Uncomment to save input to a text file in DEBUG_DUMP_PATTERN Loading Loading @@ -484,11 +479,6 @@ class Compiler : public ErrorSink { */ virtual void adjustStackAfterCall(Type* pDecl, int l, bool isIndirect) = 0; /* Print a disassembly of the assembled code to out. Return * non-zero if there is an error. */ virtual int disassemble(FILE* out) = 0; /* Generate a symbol at the current PC. t is the head of a * linked list of addresses to patch. */ Loading Loading @@ -695,9 +685,9 @@ class Compiler : public ErrorSink { public: ARMCodeGenerator() { #ifdef ARM_USE_VFP LOGD("Using ARM VFP hardware floating point."); // LOGD("Using ARM VFP hardware floating point."); #else LOGD("Using ARM soft floating point."); // LOGD("Using ARM soft floating point."); #endif } Loading Loading @@ -1764,24 +1754,6 @@ class Compiler : public ErrorSink { #endif } virtual int disassemble(FILE* out) { #ifdef ENABLE_ARM_DISASSEMBLY disasmOut = out; disasm_interface_t di; di.di_readword = disassemble_readword; di.di_printaddr = disassemble_printaddr; di.di_printf = disassemble_printf; int base = getBase(); int pc = getPC(); for(int i = base; i < pc; i += 4) { fprintf(out, "%08x: %08x ", i, *(int*) i); ::disasm(&di, i, 0); } #endif return 0; } /** * alignment (in bytes) for this type of data */ Loading Loading @@ -1833,27 +1805,6 @@ class Compiler : public ErrorSink { } private: static FILE* disasmOut; static u_int disassemble_readword(u_int address) { return(*((u_int *)address)); } static void disassemble_printaddr(u_int address) { fprintf(disasmOut, "0x%08x", address); } static void disassemble_printf(const char *fmt, ...) { va_list ap; va_start(ap, fmt); vfprintf(disasmOut, fmt, ap); va_end(ap); } static const int BRANCH_REL_ADDRESS_MASK = 0x00ffffff; Loading Loading @@ -2783,10 +2734,6 @@ class Compiler : public ErrorSink { return 5; } virtual int disassemble(FILE* out) { return 0; } /* output a symbol and patch all calls to it */ virtual void gsym(int t) { int n; Loading Loading @@ -3114,10 +3061,6 @@ class Compiler : public ErrorSink { return mpBase->jumpOffset(); } virtual int disassemble(FILE* out) { return mpBase->disassemble(out); } /* output a symbol and patch all calls to it */ virtual void gsym(int t) { fprintf(stderr, "gsym(%d)\n", t); Loading Loading @@ -5755,15 +5698,6 @@ public: return true; } int dump(FILE* out) { fwrite(codeBuf.getBase(), 1, codeBuf.getSize(), out); return 0; } int disassemble(FILE* out) { return pGen->disassemble(out); } /* Look through the symbol table to find a symbol. * If found, return its value. */ Loading Loading @@ -5796,10 +5730,14 @@ public: } } void getProgramBinary(ACCvoid** base, ACCsizei* length) { *base = codeBuf.getBase(); *length = (ACCsizei) codeBuf.getSize(); } char* getErrorMessage() { return mErrorBuf.getUnwrapped(); } }; const char* Compiler::operatorChars = Loading @@ -5813,10 +5751,6 @@ const char Compiler::operatorLevel[] = 2, 2 /* ~ ! */ }; #ifdef PROVIDE_ARM_CODEGEN FILE* Compiler::ARMCodeGenerator::disasmOut; #endif #ifdef PROVIDE_X86_CODEGEN const int Compiler::X86CodeGenerator::operatorHelper[] = { 0x1, // ++ Loading Loading @@ -6014,8 +5948,9 @@ void accGetPragmas(ACCscript* script, ACCsizei* actualStringCount, } extern "C" void accDisassemble(ACCscript* script) { script->compiler.disassemble(stderr); void accGetProgramBinary(ACCscript* script, ACCvoid** base, ACCsizei* length) { script->compiler.getProgramBinary(base, length); } Loading
libacc/tests/Android.mk +2 −1 Original line number Diff line number Diff line Loading @@ -21,7 +21,8 @@ include $(CLEAR_VARS) LOCAL_MODULE:= acc LOCAL_SRC_FILES:= \ main.cpp main.cpp \ disassem.cpp LOCAL_SHARED_LIBRARIES := \ libacc Loading