Skip to content

Commit

Permalink
Some work to make libjulia compilable on windows using the Intel comp…
Browse files Browse the repository at this point in the history
…iler
  • Loading branch information
tknopp committed Dec 3, 2013
1 parent c3565dc commit e9be444
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int jl_array_store_unboxed(jl_value_t *el_type)
// at this size use malloc
#define MALLOC_THRESH 1048576

#ifdef _P64
#if defined(_P64) && defined(UINT128MAX)
typedef __uint128_t wideint_t;
#else
typedef uint64_t wideint_t;
Expand Down
2 changes: 1 addition & 1 deletion src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ static Value *emit_ccall(jl_value_t **args, size_t nargs, jl_codectx_t *ctx)
}

// emit arguments
Value *argvals[(nargs-3)/2 + sret];
std::vector<Value *> argvals((nargs-3)/2 + sret);
Value *result;
if (sret) {
assert(jl_is_structtype(rt));
Expand Down
7 changes: 4 additions & 3 deletions src/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* including <math.h> (or rather its content).
*/
#if defined(_OS_WINDOWS_)
#define NOMINMAX
#include <malloc.h>
#if defined(_COMPILER_INTEL_)
#include <mathimf.h>
Expand Down Expand Up @@ -903,7 +904,7 @@ static Value *emit_lambda_closure(jl_value_t *expr, jl_codectx_t *ctx)

int argStart = ctx->argDepth;
size_t clen = jl_array_dim0(capt);
Value *captured[1+clen];
std::vector<Value *> captured(1+clen);
captured[0] = ConstantInt::get(T_size, clen);
for(i=0; i < clen; i++) {
Value *val;
Expand Down Expand Up @@ -1691,7 +1692,7 @@ static Value *emit_call(jl_value_t **args, size_t arglen, jl_codectx_t *ctx,
Value *result;
if (f!=NULL && specialized && f->linfo!=NULL && f->linfo->cFunctionObject!=NULL) {
// emit specialized call site
Value *argvals[nargs];
std::vector<Value *> argvals(nargs);
Function *cf = (Function*)f->linfo->cFunctionObject;
FunctionType *cft = cf->getFunctionType();
for(size_t i=0; i < nargs; i++) {
Expand Down Expand Up @@ -2409,7 +2410,7 @@ static Function *gen_jlcall_wrapper(jl_lambda_info_t *lam, Function *f)
builder.SetCurrentDebugLocation(noDbg);

size_t nargs = jl_tuple_len(lam->specTypes);
Value *args[nargs];
std::vector<Value *> args(nargs);
for(size_t i=0; i < nargs; i++) {
Value *argPtr = builder.CreateGEP(argArray,
ConstantInt::get(T_size, i));
Expand Down
6 changes: 3 additions & 3 deletions src/flisp/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,19 +308,19 @@ static value_t fl_time_now(value_t *args, u_int32_t nargs)

static value_t fl_path_cwd(value_t *args, uint32_t nargs)
{
int err;
uv_err_t err;
if (nargs > 1)
argcount("path.cwd", nargs, 1);
if (nargs == 0) {
char buf[1024];
err = uv_cwd(buf, sizeof(buf));
if (err != 0)
if (err.code != 0)
lerrorf(IOError, "path.cwd: could not get cwd: %s", uv_strerror(err));
return string_from_cstr(buf);
}
char *ptr = tostring(args[0], "path.cwd");
err = uv_chdir(ptr);
if (err != 0)
if (err.code != 0)
lerrorf(IOError, "path.cwd: could not cd to %s: %s", ptr, uv_strerror(err));
return FL_T;
}
Expand Down
2 changes: 1 addition & 1 deletion src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void __cdecl fpreset (void);
#include <windows.h>
#include <dbghelp.h>
extern int needsSymRefreshModuleList;
extern WINBOOL WINAPI (*hSymRefreshModuleList)(HANDLE);
extern BOOL (*hSymRefreshModuleList)(HANDLE);
#endif
#if defined(__linux__)
//#define _GNU_SOURCE
Expand Down
8 changes: 4 additions & 4 deletions src/jl_uv.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ DLLEXPORT int jl_write_copy(uv_stream_t *stream, const char *str, size_t n, uv_w
memcpy(data,str,n);
uv_buf_t buf[] = {{.base = data,.len=n}};
uvw->data = NULL;
int err = uv_write(uvw,stream,buf,1,writecb);
int err = uv_write(uvw,stream,buf,1,(uv_write_cb)writecb);
JL_SIGATOMIC_END();
return err;
}
Expand Down Expand Up @@ -532,7 +532,7 @@ DLLEXPORT int jl_write_no_copy(uv_stream_t *stream, char *data, size_t n, uv_wri
{
uv_buf_t buf[] = {{.base = data,.len=n}};
JL_SIGATOMIC_BEGIN();
int err = uv_write(uvw,stream,buf,1,writecb);
int err = uv_write(uvw,stream,buf,1,(uv_write_cb)writecb);
uvw->data = NULL;
JL_SIGATOMIC_END();
return err;
Expand Down Expand Up @@ -645,7 +645,7 @@ DLLEXPORT void jl_exit(int exitcode)

DLLEXPORT int jl_cwd(char *buffer, size_t size)
{
return uv_cwd(buffer,size);
return uv_cwd(buffer,size).code;
}

DLLEXPORT int jl_getpid()
Expand Down Expand Up @@ -684,7 +684,7 @@ DLLEXPORT int jl_uv_sizeof_interface_address()

DLLEXPORT int jl_uv_interface_addresses(uv_interface_address_t **ifAddrStruct,int *count)
{
return uv_interface_addresses(ifAddrStruct,count);
return uv_interface_addresses(ifAddrStruct,count).code;
}

DLLEXPORT int jl_uv_interface_address_is_internal(uv_interface_address_t *addr)
Expand Down
6 changes: 3 additions & 3 deletions src/jltypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int jl_is_type(jl_value_t *v)
return jl_is_nontuple_type(v);
}

static inline int is_unspec(jl_datatype_t *dt)
STATIC_INLINE int is_unspec(jl_datatype_t *dt)
{
return (jl_datatype_t*)dt->name->primary == dt;
}
Expand Down Expand Up @@ -280,7 +280,7 @@ typedef struct {
jl_tuple_t *tvars;
} cenv_t;

static inline int is_bnd(jl_tvar_t *tv, cenv_t *env)
STATIC_INLINE int is_bnd(jl_tvar_t *tv, cenv_t *env)
{
if (jl_is_typevar(env->tvars))
return (jl_tvar_t*)env->tvars == tv;
Expand All @@ -291,7 +291,7 @@ static inline int is_bnd(jl_tvar_t *tv, cenv_t *env)
return 0;
}

static inline int is_btv(jl_value_t *v)
STATIC_INLINE int is_btv(jl_value_t *v)
{
return jl_is_typevar(v) && ((jl_tvar_t*)v)->bound;
}
Expand Down
4 changes: 2 additions & 2 deletions src/newobj_internal.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#ifndef NEWOBJ_INTERNAL_H
#define NEWOBJ_INTERNAL_H

static inline jl_value_t *newobj(jl_value_t *type, size_t nfields)
STATIC_INLINE jl_value_t *newobj(jl_value_t *type, size_t nfields)
{
jl_value_t *jv = (jl_value_t*)allocobj((1+nfields) * sizeof(void*));
jv->type = type;
return jv;
}

static inline jl_value_t *newstruct(jl_datatype_t *type)
STATIC_INLINE jl_value_t *newstruct(jl_datatype_t *type)
{
jl_value_t *jv = (jl_value_t*)allocobj(sizeof(void*) + type->size);
jv->type = (jl_value_t*)type;
Expand Down
4 changes: 2 additions & 2 deletions src/support/dtypes.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#ifndef DTYPES_H
#define DTYPES_H

#include "platform.h"

#if !defined(_OS_WINDOWS_)
#include <inttypes.h>
#endif
#include <stddef.h>
#include <stddef.h> // double include of stddef.h fixes #3421
#include <stdint.h>

#include "platform.h"

#if defined(_OS_WINDOWS_)

#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ static int frame_info_from_ip(const char **func_name, int *line_num, const char

#if defined(_OS_WINDOWS_)
int needsSymRefreshModuleList;
WINBOOL WINAPI (*hSymRefreshModuleList)(HANDLE);
BOOL (*hSymRefreshModuleList)(HANDLE);
DLLEXPORT size_t rec_backtrace(ptrint_t *data, size_t maxsize)
{
CONTEXT Context;
Expand Down

0 comments on commit e9be444

Please sign in to comment.