# HG changeset patch # User Max Brister # Date 1344369598 18000 # Node ID 0464e3ceb85b4f1117ffd81c327088d3e1807c1e # Parent 4e0ab3b2841899bcda5379763bf3ffd579cd5746 Skip functions when resolving end context in JIT * src/interp-core/jit-ir.cc (jit_magic_end::resolve_context): Skip functions. * src/interp-core/jit-typeinfo.cc (jit_type::jit_type): Add askip_paren parameter. (jit_typeinfo::addbuiltin): Skip end resolution for builtin functions. * src/interp-core/jit-typeinfo.h (jit_type::skip_paren): New function. (jit_typeinfo::new_type): Add skip_paren argument. diff -r 4e0ab3b28418 -r 0464e3ceb85b src/interp-core/jit-ir.cc --- a/src/interp-core/jit-ir.cc Tue Aug 07 09:01:02 2012 -0700 +++ b/src/interp-core/jit-ir.cc Tue Aug 07 14:59:58 2012 -0500 @@ -619,9 +619,19 @@ jit_magic_end::context jit_magic_end::resolve_context (void) const { - // FIXME: We need to have a way of marking functions so we can skip them here - context ret = contexts[0]; - ret.value = argument (0); + size_t idx; + for (idx = 0; idx < contexts.size (); ++idx) + { + jit_type *ctx_type = contexts[idx].value->type (); + if (! ctx_type || ctx_type->skip_paren ()) + break; + } + + if (idx >= contexts.size ()) + idx = 0; + + context ret = contexts[idx]; + ret.value = argument (idx); return ret; } diff -r 4e0ab3b28418 -r 0464e3ceb85b src/interp-core/jit-typeinfo.cc --- a/src/interp-core/jit-typeinfo.cc Tue Aug 07 09:01:02 2012 -0700 +++ b/src/interp-core/jit-typeinfo.cc Tue Aug 07 14:59:58 2012 -0500 @@ -500,9 +500,9 @@ // -------------------- jit_type -------------------- jit_type::jit_type (const std::string& aname, jit_type *aparent, - llvm::Type *allvm_type, int aid) : + llvm::Type *allvm_type, bool askip_paren, int aid) : mname (aname), mparent (aparent), llvm_type (allvm_type), mid (aid), - mdepth (aparent ? aparent->mdepth + 1 : 0) + mdepth (aparent ? aparent->mdepth + 1 : 0), mskip_paren (askip_paren) { std::memset (msret, 0, sizeof (msret)); std::memset (mpointer_arg, 0, sizeof (mpointer_arg)); @@ -1800,9 +1800,9 @@ jit_type* jit_typeinfo::new_type (const std::string& name, jit_type *parent, - llvm::Type *llvm_type) + llvm::Type *llvm_type, bool skip_paren) { - jit_type *ret = new jit_type (name, parent, llvm_type, next_id++); + jit_type *ret = new jit_type (name, parent, llvm_type, skip_paren, next_id++); id_to_type.push_back (ret); return ret; } @@ -1918,7 +1918,7 @@ void jit_typeinfo::add_builtin (const std::string& name) { - jit_type *btype = new_type (name, any, any->to_llvm ()); + jit_type *btype = new_type (name, any, any->to_llvm (), true); builtins[name] = btype; octave_builtin *ov_builtin = find_builtin (name); diff -r 4e0ab3b28418 -r 0464e3ceb85b src/interp-core/jit-typeinfo.h --- a/src/interp-core/jit-typeinfo.h Tue Aug 07 09:01:02 2012 -0700 +++ b/src/interp-core/jit-typeinfo.h Tue Aug 07 14:59:58 2012 -0500 @@ -132,7 +132,7 @@ typedef llvm::Value *(*convert_fn) (llvm::IRBuilderD&, llvm::Value *); jit_type (const std::string& aname, jit_type *aparent, llvm::Type *allvm_type, - int aid); + bool askip_paren, int aid); // a user readable type name const std::string& name (void) const { return mname; } @@ -151,6 +151,8 @@ size_t depth (void) const { return mdepth; } + bool skip_paren (void) const { return mskip_paren; } + // -------------------- Calling Convention information -------------------- // A function declared like: mytype foo (int arg0, int arg1); @@ -195,6 +197,7 @@ llvm::Type *llvm_type; int mid; size_t mdepth; + bool mskip_paren; bool msret[jit_convention::length]; bool mpointer_arg[jit_convention::length]; @@ -625,7 +628,7 @@ jit_value *count); jit_type *new_type (const std::string& name, jit_type *parent, - llvm::Type *llvm_type); + llvm::Type *llvm_type, bool skip_paren = false); void add_print (jit_type *ty, void *fptr);