/* +----------------------------------------------------------------------+ | HipHop for PHP | +----------------------------------------------------------------------+ | Copyright (c) 2010- Facebook, Inc. (http://www.facebook.com) | | Copyright (c) 1997-2010 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ */ #include #include #include #include #include #include #include namespace HPHP { /* bool HPHP::f_hphp_is_service_thread() _ZN4HPHP24f_hphp_is_service_threadEv (return value) => rax */ bool fh_hphp_is_service_thread() asm("_ZN4HPHP24f_hphp_is_service_threadEv"); TypedValue* fg_hphp_is_service_thread(HPHP::VM::ActRec *ar) { TypedValue rv; int64_t count = ar->numArgs(); TypedValue* args UNUSED = ((TypedValue*)ar) - 1; if (count == 0LL) { rv.m_type = KindOfBoolean; rv.m_data.num = (fh_hphp_is_service_thread()) ? 1LL : 0LL; frame_free_locals_no_this_inl(ar, 0); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; } else { throw_toomany_arguments_nr("hphp_is_service_thread", 0, 1); } rv.m_data.num = 0LL; rv.m_type = KindOfNull; frame_free_locals_no_this_inl(ar, 0); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; return &ar->m_r; } /* void HPHP::f_hphp_service_thread_started() _ZN4HPHP29f_hphp_service_thread_startedEv */ void fh_hphp_service_thread_started() asm("_ZN4HPHP29f_hphp_service_thread_startedEv"); TypedValue* fg_hphp_service_thread_started(HPHP::VM::ActRec *ar) { TypedValue rv; int64_t count = ar->numArgs(); TypedValue* args UNUSED = ((TypedValue*)ar) - 1; if (count == 0LL) { rv.m_data.num = 0LL; rv.m_type = KindOfNull; fh_hphp_service_thread_started(); frame_free_locals_no_this_inl(ar, 0); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; } else { throw_toomany_arguments_nr("hphp_service_thread_started", 0, 1); } rv.m_data.num = 0LL; rv.m_type = KindOfNull; frame_free_locals_no_this_inl(ar, 0); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; return &ar->m_r; } /* bool HPHP::f_hphp_service_thread_stopped(int) _ZN4HPHP29f_hphp_service_thread_stoppedEi (return value) => rax timeout => rdi */ bool fh_hphp_service_thread_stopped(int timeout) asm("_ZN4HPHP29f_hphp_service_thread_stoppedEi"); TypedValue * fg1_hphp_service_thread_stopped(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) __attribute__((noinline,cold)); TypedValue * fg1_hphp_service_thread_stopped(TypedValue* rv, HPHP::VM::ActRec* ar, int64_t count) { TypedValue* args UNUSED = ((TypedValue*)ar) - 1; rv->m_type = KindOfBoolean; tvCastToInt64InPlace(args-0); rv->m_data.num = (fh_hphp_service_thread_stopped((int)(args[-0].m_data.num))) ? 1LL : 0LL; return rv; } TypedValue* fg_hphp_service_thread_stopped(HPHP::VM::ActRec *ar) { TypedValue rv; int64_t count = ar->numArgs(); TypedValue* args UNUSED = ((TypedValue*)ar) - 1; if (count == 1LL) { if ((args-0)->m_type == KindOfInt64) { rv.m_type = KindOfBoolean; rv.m_data.num = (fh_hphp_service_thread_stopped((int)(args[-0].m_data.num))) ? 1LL : 0LL; frame_free_locals_no_this_inl(ar, 1); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; } else { fg1_hphp_service_thread_stopped(&rv, ar, count); frame_free_locals_no_this_inl(ar, 1); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; } } else { throw_wrong_arguments_nr("hphp_service_thread_stopped", count, 1, 1, 1); } rv.m_data.num = 0LL; rv.m_type = KindOfNull; frame_free_locals_no_this_inl(ar, 1); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; return &ar->m_r; } /* bool HPHP::f_hphp_thread_is_warmup_enabled() _ZN4HPHP31f_hphp_thread_is_warmup_enabledEv (return value) => rax */ bool fh_hphp_thread_is_warmup_enabled() asm("_ZN4HPHP31f_hphp_thread_is_warmup_enabledEv"); TypedValue* fg_hphp_thread_is_warmup_enabled(HPHP::VM::ActRec *ar) { TypedValue rv; int64_t count = ar->numArgs(); TypedValue* args UNUSED = ((TypedValue*)ar) - 1; if (count == 0LL) { rv.m_type = KindOfBoolean; rv.m_data.num = (fh_hphp_thread_is_warmup_enabled()) ? 1LL : 0LL; frame_free_locals_no_this_inl(ar, 0); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; } else { throw_toomany_arguments_nr("hphp_thread_is_warmup_enabled", 0, 1); } rv.m_data.num = 0LL; rv.m_type = KindOfNull; frame_free_locals_no_this_inl(ar, 0); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; return &ar->m_r; } /* void HPHP::f_hphp_thread_set_warmup_enabled() _ZN4HPHP32f_hphp_thread_set_warmup_enabledEv */ void fh_hphp_thread_set_warmup_enabled() asm("_ZN4HPHP32f_hphp_thread_set_warmup_enabledEv"); TypedValue* fg_hphp_thread_set_warmup_enabled(HPHP::VM::ActRec *ar) { TypedValue rv; int64_t count = ar->numArgs(); TypedValue* args UNUSED = ((TypedValue*)ar) - 1; if (count == 0LL) { rv.m_data.num = 0LL; rv.m_type = KindOfNull; fh_hphp_thread_set_warmup_enabled(); frame_free_locals_no_this_inl(ar, 0); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; } else { throw_toomany_arguments_nr("hphp_thread_set_warmup_enabled", 0, 1); } rv.m_data.num = 0LL; rv.m_type = KindOfNull; frame_free_locals_no_this_inl(ar, 0); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; return &ar->m_r; } /* long HPHP::f_hphp_get_thread_id() _ZN4HPHP20f_hphp_get_thread_idEv (return value) => rax */ long fh_hphp_get_thread_id() asm("_ZN4HPHP20f_hphp_get_thread_idEv"); TypedValue* fg_hphp_get_thread_id(HPHP::VM::ActRec *ar) { TypedValue rv; int64_t count = ar->numArgs(); TypedValue* args UNUSED = ((TypedValue*)ar) - 1; if (count == 0LL) { rv.m_type = KindOfInt64; rv.m_data.num = (int64_t)fh_hphp_get_thread_id(); frame_free_locals_no_this_inl(ar, 0); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; } else { throw_toomany_arguments_nr("hphp_get_thread_id", 0, 1); } rv.m_data.num = 0LL; rv.m_type = KindOfNull; frame_free_locals_no_this_inl(ar, 0); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; return &ar->m_r; } /* int HPHP::f_hphp_gettid() _ZN4HPHP13f_hphp_gettidEv (return value) => rax */ int fh_hphp_gettid() asm("_ZN4HPHP13f_hphp_gettidEv"); TypedValue* fg_hphp_gettid(HPHP::VM::ActRec *ar) { TypedValue rv; int64_t count = ar->numArgs(); TypedValue* args UNUSED = ((TypedValue*)ar) - 1; if (count == 0LL) { rv.m_type = KindOfInt64; rv.m_data.num = (int64_t)fh_hphp_gettid(); frame_free_locals_no_this_inl(ar, 0); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; } else { throw_toomany_arguments_nr("hphp_gettid", 0, 1); } rv.m_data.num = 0LL; rv.m_type = KindOfNull; frame_free_locals_no_this_inl(ar, 0); memcpy(&ar->m_r, &rv, sizeof(TypedValue)); return &ar->m_r; return &ar->m_r; } } // !HPHP