Commit 2f40d89e authored by Kevin Modzelewski's avatar Kevin Modzelewski

Functions that look at the return address should be noinline

Otherwise they can end up seeing the return address of their caller
parent 1da14a3c
...@@ -41,7 +41,7 @@ extern "C" void rawReraise(Box*, Box*, Box*) __attribute__((__noreturn__)); ...@@ -41,7 +41,7 @@ extern "C" void rawReraise(Box*, Box*, Box*) __attribute__((__noreturn__));
void raiseExc(STOLEN(Box*) exc_obj) __attribute__((__noreturn__)); void raiseExc(STOLEN(Box*) exc_obj) __attribute__((__noreturn__));
void _printStacktrace(); void _printStacktrace();
extern "C" Box* deopt(AST_expr* expr, Box* value); extern "C" Box* deopt(AST_expr* expr, Box* value) __attribute__((noinline));
// helper function for raising from the runtime: // helper function for raising from the runtime:
void raiseExcHelper(BoxedClass*, const char* fmt, ...) __attribute__((__noreturn__)) void raiseExcHelper(BoxedClass*, const char* fmt, ...) __attribute__((__noreturn__))
...@@ -51,45 +51,46 @@ void raiseExcHelper(BoxedClass*, Box* arg) __attribute__((__noreturn__)); ...@@ -51,45 +51,46 @@ void raiseExcHelper(BoxedClass*, Box* arg) __attribute__((__noreturn__));
// TODO sort this // TODO sort this
extern "C" void printHelper(Box* dest, Box* var, bool nl); extern "C" void printHelper(Box* dest, Box* var, bool nl);
extern "C" void my_assert(bool b); extern "C" void my_assert(bool b);
extern "C" Box* getattr(Box* obj, BoxedString* attr); extern "C" Box* getattr(Box* obj, BoxedString* attr) __attribute__((noinline));
extern "C" Box* getattr_capi(Box* obj, BoxedString* attr) noexcept; extern "C" Box* getattr_capi(Box* obj, BoxedString* attr) noexcept __attribute__((noinline));
extern "C" Box* getattrMaybeNonstring(Box* obj, Box* attr); extern "C" Box* getattrMaybeNonstring(Box* obj, Box* attr);
// XXX: testing. this tail-calls in optimized builds so force it to inline for unoptimized as well to get the same // XXX: testing. this tail-calls in optimized builds so force it to inline for unoptimized as well to get the same
// behavior. // behavior.
extern "C" void setattr(Box* obj, BoxedString* attr, STOLEN(Box*) attr_val) __attribute__((always_inline)); extern "C" void setattr(Box* obj, BoxedString* attr, STOLEN(Box*) attr_val) __attribute__((always_inline));
extern "C" void setattrMaybeNonstring(Box* obj, Box* attr, Box* attr_val); extern "C" void delattr(Box* obj, BoxedString* attr) __attribute__((noinline));
extern "C" void delattr(Box* obj, BoxedString* attr);
extern "C" void delattrMaybeNonstring(Box* obj, Box* attr);
extern "C" void delattrGeneric(Box* obj, BoxedString* attr, DelattrRewriteArgs* rewrite_args); extern "C" void delattrGeneric(Box* obj, BoxedString* attr, DelattrRewriteArgs* rewrite_args);
extern "C" bool nonzero(Box* obj); extern "C" bool nonzero(Box* obj) __attribute__((noinline));
extern "C" Box* runtimeCall(Box*, ArgPassSpec, Box*, Box*, Box*, Box**, const std::vector<BoxedString*>*); extern "C" Box* runtimeCall(Box*, ArgPassSpec, Box*, Box*, Box*, Box**, const std::vector<BoxedString*>*)
extern "C" Box* runtimeCallCapi(Box*, ArgPassSpec, Box*, Box*, Box*, Box**, const std::vector<BoxedString*>*) noexcept; __attribute__((noinline));
extern "C" Box* callattr(Box*, BoxedString*, CallattrFlags, Box*, Box*, Box*, Box**, const std::vector<BoxedString*>*); extern "C" Box* runtimeCallCapi(Box*, ArgPassSpec, Box*, Box*, Box*, Box**, const std::vector<BoxedString*>*) noexcept
__attribute__((noinline));
extern "C" Box* callattr(Box*, BoxedString*, CallattrFlags, Box*, Box*, Box*, Box**, const std::vector<BoxedString*>*)
__attribute__((noinline));
extern "C" Box* callattrCapi(Box*, BoxedString*, CallattrFlags, Box*, Box*, Box*, Box**, extern "C" Box* callattrCapi(Box*, BoxedString*, CallattrFlags, Box*, Box*, Box*, Box**,
const std::vector<BoxedString*>*) noexcept; const std::vector<BoxedString*>*) noexcept __attribute__((noinline));
extern "C" BoxedString* str(Box* obj); extern "C" BoxedString* str(Box* obj) __attribute__((noinline));
extern "C" BoxedString* repr(Box* obj); extern "C" BoxedString* repr(Box* obj) __attribute__((noinline));
extern "C" bool exceptionMatches(Box* obj, Box* cls); extern "C" bool exceptionMatches(Box* obj, Box* cls) __attribute__((noinline));
extern "C" BoxedInt* hash(Box* obj); extern "C" BoxedInt* hash(Box* obj) __attribute__((noinline));
extern "C" int64_t hashUnboxed(Box* obj); extern "C" int64_t hashUnboxed(Box* obj) __attribute__((noinline));
extern "C" Box* abs_(Box* obj); extern "C" Box* abs_(Box* obj);
// extern "C" Box* chr(Box* arg); // extern "C" Box* chr(Box* arg);
extern "C" Box* compare(Box*, Box*, int); extern "C" Box* compare(Box*, Box*, int) __attribute__((noinline));
extern "C" BoxedInt* len(Box* obj); extern "C" BoxedInt* len(Box* obj) __attribute__((noinline));
// extern "C" Box* trap(); // extern "C" Box* trap();
extern "C" i64 unboxedLen(Box* obj); extern "C" i64 unboxedLen(Box* obj) __attribute__((noinline));
extern "C" Box* binop(Box* lhs, Box* rhs, int op_type); extern "C" Box* binop(Box* lhs, Box* rhs, int op_type) __attribute__((noinline));
extern "C" Box* augbinop(Box* lhs, Box* rhs, int op_type); extern "C" Box* augbinop(Box* lhs, Box* rhs, int op_type) __attribute__((noinline));
extern "C" Box* getitem(Box* value, Box* slice); extern "C" Box* getitem(Box* value, Box* slice) __attribute__((noinline));
extern "C" Box* getitem_capi(Box* value, Box* slice) noexcept; extern "C" Box* getitem_capi(Box* value, Box* slice) noexcept __attribute__((noinline));
extern "C" void setitem(Box* target, Box* slice, Box* value); extern "C" void setitem(Box* target, Box* slice, Box* value) __attribute__((noinline));
extern "C" void delitem(Box* target, Box* slice); extern "C" void delitem(Box* target, Box* slice) __attribute__((noinline));
extern "C" PyObject* apply_slice(PyObject* u, PyObject* v, PyObject* w) noexcept; extern "C" PyObject* apply_slice(PyObject* u, PyObject* v, PyObject* w) noexcept;
extern "C" Box* getclsattr(Box* obj, BoxedString* attr); extern "C" Box* getclsattr(Box* obj, BoxedString* attr) __attribute__((noinline));
extern "C" Box* getclsattrMaybeNonstring(Box* obj, Box* attr); extern "C" Box* getclsattrMaybeNonstring(Box* obj, Box* attr) __attribute__((noinline));
extern "C" Box* unaryop(Box* operand, int op_type); extern "C" Box* unaryop(Box* operand, int op_type) __attribute__((noinline));
extern "C" Box* importFrom(Box* obj, BoxedString* attr); extern "C" Box* importFrom(Box* obj, BoxedString* attr) __attribute__((noinline));
extern "C" Box* importStar(Box* from_module, Box* to_globals); extern "C" Box* importStar(Box* from_module, Box* to_globals) __attribute__((noinline));
extern "C" Box** unpackIntoArray(Box* obj, int64_t expected_size, Box** out_keep_alive); extern "C" Box** unpackIntoArray(Box* obj, int64_t expected_size, Box** out_keep_alive);
extern "C" void assertNameDefined(bool b, const char* name, BoxedClass* exc_cls, bool local_var_msg); extern "C" void assertNameDefined(bool b, const char* name, BoxedClass* exc_cls, bool local_var_msg);
extern "C" void assertFailDerefNameDefined(const char* name); extern "C" void assertFailDerefNameDefined(const char* name);
...@@ -105,7 +106,7 @@ extern "C" BoxedClosure* createClosure(BoxedClosure* parent_closure, size_t size ...@@ -105,7 +106,7 @@ extern "C" BoxedClosure* createClosure(BoxedClosure* parent_closure, size_t size
Box* getiter(Box* o); Box* getiter(Box* o);
extern "C" Box* getPystonIter(Box* o); extern "C" Box* getPystonIter(Box* o);
extern "C" Box* getiterHelper(Box* o); extern "C" Box* getiterHelper(Box* o);
extern "C" Box* createBoxedIterWrapperIfNeeded(Box* o); extern "C" Box* createBoxedIterWrapperIfNeeded(Box* o) __attribute__((noinline));
struct SetattrRewriteArgs; struct SetattrRewriteArgs;
template <Rewritable rewritable> template <Rewritable rewritable>
...@@ -220,9 +221,9 @@ inline std::tuple<Box*, Box*, Box*, Box**> getTupleFromArgsArray(Box** args, int ...@@ -220,9 +221,9 @@ inline std::tuple<Box*, Box*, Box*, Box**> getTupleFromArgsArray(Box** args, int
// Corresponds to a name lookup with GLOBAL scope. Checks the passed globals object, then the builtins, // Corresponds to a name lookup with GLOBAL scope. Checks the passed globals object, then the builtins,
// and if not found raises an exception. // and if not found raises an exception.
extern "C" Box* getGlobal(Box* globals, BoxedString* name); extern "C" Box* getGlobal(Box* globals, BoxedString* name) __attribute__((noinline));
extern "C" void setGlobal(Box* globals, BoxedString* name, STOLEN(Box*) value); extern "C" void setGlobal(Box* globals, BoxedString* name, STOLEN(Box*) value) __attribute__((noinline));
extern "C" void delGlobal(Box* globals, BoxedString* name); extern "C" void delGlobal(Box* globals, BoxedString* name) __attribute__((noinline));
extern "C" void boxedLocalsSet(Box* boxedLocals, BoxedString* attr, Box* val); extern "C" void boxedLocalsSet(Box* boxedLocals, BoxedString* attr, Box* val);
extern "C" Box* boxedLocalsGet(Box* boxedLocals, BoxedString* attr, Box* globals); extern "C" Box* boxedLocalsGet(Box* boxedLocals, BoxedString* attr, Box* globals);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment