Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Dec 13, 2014
1 parent 54affdb commit c37f371
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 23 deletions.
7 changes: 2 additions & 5 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,8 @@ function _start()
println()
exit(1)
end
if is_interactive
if have_color
print(color_normal)
end
println()
if is_interactive && have_color
print(color_normal)
end
end

Expand Down
2 changes: 1 addition & 1 deletion src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ extern "C" {

#include "builtin_proto.h"

void *__stack_chk_guard = NULL;
DLLEXPORT void *__stack_chk_guard = NULL;

#if defined(_OS_WINDOWS_) && !defined(_COMPILER_MINGW_)
void __stack_chk_fail()
Expand Down
2 changes: 1 addition & 1 deletion src/disasm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ void jl_dump_function_asm(const char *Fptr, size_t Fsize,
#ifdef LLVM35
if (MCIA->evaluateBranch(Inst, Index, insSize, addr))
#else
if ((addr = MCIA->evaluateBranch(Inst, Index, insSize)) != -1)
if ((addr = MCIA->evaluateBranch(Inst, Index, insSize)) != (uint64_t)-1)
#endif
DisInfo.insertAddress(addr);
}
Expand Down
6 changes: 2 additions & 4 deletions src/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1330,10 +1330,8 @@ DLLEXPORT void jl_save_system_image(const char *fname)
// save module initialization order
if (jl_module_init_order != NULL) {
for(i=0; i < jl_array_len(jl_module_init_order); i++) {
// NULL out any modules that weren't saved
jl_value_t *mod = jl_cellref(jl_module_init_order, i);
(void)mod;
assert(ptrhash_get(&backref_table, mod) != HT_NOTFOUND);
// verify that all these modules were saved
assert(ptrhash_get(&backref_table, jl_cellref(jl_module_init_order, i)) != HT_NOTFOUND);
}
}
jl_serialize_value(&f, jl_module_init_order);
Expand Down
6 changes: 3 additions & 3 deletions src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,13 +765,13 @@ static char *abspath(const char *in)
}
}
#else
DWORD n = GetFullPathName(in, 0, NULL, C_NULL);
DWORD n = GetFullPathName(in, 0, NULL, NULL);
if (n <= 0) {
ios_printf(ios_stderr, "fatal error: jl_compileropts.image_file path too long or GetFullPathName failed\n");
exit(1);
}
char *out = (char*)malloc(n);
DWORD m = GetFullPathName(in, n, out, C_NULL);
DWORD m = GetFullPathName(in, n, out, NULL);
if (n != m + 1) {
ios_printf(ios_stderr, "fatal error: jl_compileropts.image_file path too long or GetFullPathName failed\n");
exit(1);
Expand Down Expand Up @@ -1096,7 +1096,7 @@ extern void *__stack_chk_guard;

void jl_compile_all(void);

DLLEXPORT int julia_save()
DLLEXPORT void julia_save()
{
const char *build_path = jl_compileropts.build_path;
if (build_path) {
Expand Down
1 change: 1 addition & 0 deletions src/julia.expmap
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
global:
__asan*;
__stack_chk_guard;
alloc_*w;
allocobj;
asprintf;
Expand Down
2 changes: 1 addition & 1 deletion src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ extern DLLEXPORT jl_compileropts_t jl_compileropts;
#define JL_COMPILEROPT_DUMPBITCODE_ON 1
#define JL_COMPILEROPT_DUMPBITCODE_OFF 2

extern void *__stack_chk_guard;
DLLEXPORT extern void *__stack_chk_guard;
#define SET_STACK_CHK_GUARD(a,b,c) do { \
unsigned char *p = (unsigned char *)&__stack_chk_guard; \
a = p[sizeof(__stack_chk_guard)-1]; \
Expand Down
2 changes: 2 additions & 0 deletions src/support/dirpath.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
#else
#define PATHSEPSTRING "/"
#define PATHLISTSEPSTRING ":"
#ifndef PATH_MAX // many platforms don't have a max path, we define one anyways
#define PATH_MAX 1024
#endif
#endif

#endif
16 changes: 9 additions & 7 deletions src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ static void NORETURN finish_task(jl_task_t *t, jl_value_t *resultval)
}

#if defined(_OS_WINDOWS_) && !defined(_COMPILER_MINGW_)
void __declspec(noinline)
static void __declspec(noinline)
#else
void __attribute__((noinline))
static void __attribute__((noinline))
#endif
NORETURN start_task()
{
Expand Down Expand Up @@ -348,16 +348,18 @@ static void ctx_switch(jl_task_t *t, jl_jmp_buf *where)
asm(" movq %0, %%rsp;\n"
" xorq %%rbp, %%rbp;\n"
" push %%rbp;\n" // instead of RSP
" jmp _start_task" // call stack_task with fake stack frame
: : "r"(jl_stackbase-0x10) : );
" jmp %P1;\n" // call stack_task with fake stack frame
" ud2"
: : "r"(jl_stackbase-0x10), "i"(start_task) : "memory" );
#elif defined(_CPU_X86_)
asm(" movl %0, %%esp;\n"
" xorl %%ebp, %%ebp;\n"
" push %%ebp;\n" // instead of ESP
" jmp _start_task" // call stack_task with fake stack frame
: : "r"(jl_stackbase-0x10) : );
" jmp %P1;\n" // call stack_task with fake stack frame
" ud2"
: : "r"(jl_stackbase-0x10), "i"(start_task) : "memory" );
#else
#error ASM_COPY_STACKS not supported on this platform
#error ASM_COPY_STACKS not supported on this cpu architecture
#endif
#else // ASM_COPY_STACKS
jl_longjmp(jl_base_ctx, 1);
Expand Down
2 changes: 1 addition & 1 deletion ui/repl.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ static int true_main(int argc, char *argv[])
return iserr;
}

DLLEXPORT extern int julia_save();
DLLEXPORT extern void julia_save();

#ifndef _OS_WINDOWS_
int main(int argc, char *argv[])
Expand Down

0 comments on commit c37f371

Please sign in to comment.