summaryrefslogtreecommitdiff
path: root/erts/emulator/beam/jit/x86/beam_asm_module.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'erts/emulator/beam/jit/x86/beam_asm_module.cpp')
-rw-r--r--erts/emulator/beam/jit/x86/beam_asm_module.cpp75
1 files changed, 2 insertions, 73 deletions
diff --git a/erts/emulator/beam/jit/x86/beam_asm_module.cpp b/erts/emulator/beam/jit/x86/beam_asm_module.cpp
index be01db5ac3..bc8a11e15e 100644
--- a/erts/emulator/beam/jit/x86/beam_asm_module.cpp
+++ b/erts/emulator/beam/jit/x86/beam_asm_module.cpp
@@ -332,6 +332,8 @@ void BeamModuleAssembler::emit_label(const ArgLabel &Label) {
current_label = rawLabels[Label.get()];
a.bind(current_label);
+
+ last_movarg_offset = ~0;
}
void BeamModuleAssembler::emit_aligned_label(const ArgLabel &Label,
@@ -401,79 +403,6 @@ void BeamModuleAssembler::emit_call_error_handler() {
emit_nyi("call_error_handler should never be called");
}
-unsigned BeamModuleAssembler::patchCatches(char *rw_base) {
- unsigned catch_no = BEAM_CATCHES_NIL;
-
- for (const auto &c : catches) {
- const auto &patch = c.patch;
- ErtsCodePtr handler;
-
- handler = (ErtsCodePtr)getCode(c.handler);
- catch_no = beam_catches_cons(handler, catch_no, nullptr);
-
- /* Patch the `mov` instruction with the catch tag */
- auto offset = code.labelOffsetFromBase(patch.where);
- auto where = (unsigned *)&rw_base[offset + patch.ptr_offs];
-
- ASSERT(0x7fffffff == *where);
- Eterm catch_term = make_catch(catch_no);
-
- /* With the current tag scheme, more than 33 million
- * catches can exist at once. */
- ERTS_ASSERT(catch_term >> 31 == 0);
- *where = (unsigned)catch_term;
- }
-
- return catch_no;
-}
-
-void BeamModuleAssembler::patchImport(char *rw_base,
- unsigned index,
- BeamInstr I) {
- for (const auto &patch : imports[index].patches) {
- auto offset = code.labelOffsetFromBase(patch.where);
- auto where = (Eterm *)&rw_base[offset + patch.ptr_offs];
-
- ASSERT(LLONG_MAX == *where);
- *where = I + patch.val_offs;
- }
-}
-
-void BeamModuleAssembler::patchLambda(char *rw_base,
- unsigned index,
- BeamInstr I) {
- for (const auto &patch : lambdas[index].patches) {
- auto offset = code.labelOffsetFromBase(patch.where);
- auto where = (Eterm *)&rw_base[offset + patch.ptr_offs];
-
- ASSERT(LLONG_MAX == *where);
- *where = I + patch.val_offs;
- }
-}
-
-void BeamModuleAssembler::patchLiteral(char *rw_base,
- unsigned index,
- Eterm lit) {
- for (const auto &patch : literals[index].patches) {
- auto offset = code.labelOffsetFromBase(patch.where);
- auto where = (Eterm *)&rw_base[offset + patch.ptr_offs];
-
- ASSERT(LLONG_MAX == *where);
- *where = lit + patch.val_offs;
- }
-}
-
-void BeamModuleAssembler::patchStrings(char *rw_base,
- const byte *string_table) {
- for (const auto &patch : strings) {
- auto offset = code.labelOffsetFromBase(patch.where);
- auto where = (const byte **)&rw_base[offset + 2];
-
- ASSERT(LLONG_MAX == (Eterm)*where);
- *where = string_table + patch.val_offs;
- }
-}
-
const Label &BeamModuleAssembler::resolve_fragment(void (*fragment)()) {
auto it = _dispatchTable.find(fragment);