Esempio n. 1
0
File: gvmtas.py Progetto: Melab/gvmt
def to_asm(section, base_name):
    c_file = os.path.join(sys_compiler.TEMPDIR, '%s.c' % base_name)
    out = Out(c_file)
    out << '#include <inttypes.h>\n'
    to_c(section, out)
    out.close()
    code = sys_compiler.c_to_asm(base_name)
    if code:
        raise GVMTException("GVMT Internal Error -- %s failed with exit code %d" % (CC_PATH, code))
Esempio n. 2
0
File: gvmtas.py Progetto: Melab/gvmt
def to_object(src_file, base_name, library, optimise, sys_headers, gc_name):
    code = src_file.code
    bytecodes = src_file.bytecodes
    info = src_file.info
    c_file = os.path.join(sys_compiler.TEMPDIR, '%s.c' % base_name)
    out = Out(c_file)
    out << '#include <alloca.h>\n'
    out << '#include "gvmt/internal/core.h"\n'
    out << 'extern void* malloc(uintptr_t size);\n'
    out << 'extern int strcmp(void* s1, void* s2);\n'
    out << 'extern GVMT_Object gvmt_%s_malloc(GVMT_StackItem* sp, GVMT_Frame fp, uintptr_t size);\n' % gc_name
    out << 'extern void __gvmt_fatal(const char* fmt, ...);\n'
    out << '#define GVMT_COMPILED\n'
    out << '\n'
    out << '\n'
    write_info(info, out)
    if bytecodes:
        write_interpreter(bytecodes, out, gc_name)
    write_code(code, out, gc_name)
    out.close()
    code = sys_compiler.c_to_object(base_name, optimise, library, True, sys_headers)
    if code:
        raise GVMTException("GVMT Internal Error -- %s failed with exit code %d" % (CC_PATH, code))