Store num args instead of offset in prologue and func entry SrcKeys
[hiphop-php.git] / hphp / runtime / vm / jit / service-requests.h
blobc95dcab5266cb6b6a1ae70494c8966feff5d6f8a
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #pragma once
19 #include "hphp/runtime/vm/srckey.h"
21 #include "hphp/runtime/vm/jit/types.h"
22 #include "hphp/runtime/vm/jit/containers.h"
23 #include "hphp/runtime/vm/jit/stack-offsets.h"
25 #include "hphp/util/asm-x64.h"
26 #include "hphp/util/data-block.h"
28 namespace HPHP {
30 struct ActRec;
32 namespace jit {
34 struct CGMeta;
36 ///////////////////////////////////////////////////////////////////////////////
38 namespace svcreq {
40 ///////////////////////////////////////////////////////////////////////////////
43 * A service request stub is a tiny routine used to invoke JIT translation
44 * services, used in place of the actual translation. Incoming branches to
45 * service request stubs are smashable and tracked by SrcDB.
47 * Stubs, first, set up enough context to reconstruct the SrcKey and stack
48 * positions, then, jump to the corresponding unique stub to perform the
49 * requested operation.
51 enum class StubType : uint8_t {
52 // A request to translate the code at the given current location.
53 // See svcreq::handleTranslate() for more details.
54 Translate,
56 // A request to retranslate the code at the given current location.
57 // See svcreq::handleRetranslate() for more details.
58 Retranslate,
62 * Get an existing stub or emit a new one to perform request of the given type
63 * at the given code and stack position. The same stub may be compatible with
64 * multiple different positions.
66 * Returns nullptr on failure, e.g. when there is no more TC space available.
68 TCA getOrEmitStub(StubType type, SrcKey sk, SBInvOffset spOff);
70 ///////////////////////////////////////////////////////////////////////////////
71 // Emitters.
74 * Emit a stub which syncs vmsp and vmpc and then calls
75 * interpHelperNoTranslateFromTC. Call are smashed to this when we know we
76 * can no longer create new translations. The address of the stub is
77 * returned if successful, nullptr otherwise (the creation can fail if
78 * there's no space in the TC for it).
80 TCA emit_interp_no_translate_stub(SBInvOffset spOff, SrcKey sk);
82 ///////////////////////////////////////////////////////////////////////////////
84 }}}