Skip to content

Commit

Permalink
Implement part of mov_imm
Browse files Browse the repository at this point in the history
Only the else case is needed now
  • Loading branch information
maehjam authored and ziopio committed Jan 23, 2025
1 parent 6e4e386 commit b079779
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
20 changes: 13 additions & 7 deletions erts/emulator/beam/jit/arm/32/beam_asm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ struct BeamAssembler : public BeamAssemblerCommon {

const a32::Gp VAR = a32::r6;

#ifdef ERTS_MSACC_EXTENDED_STATES
const arm::Mem erts_msacc_cache = getSchedulerRegRef(
offsetof(ErtsSchedulerRegisters, aux_regs.d.erts_msacc_cache));
#endif

static const int num_register_backed_fregs = 8;
constexpr arm::Mem getSchedulerRegRef(int offset) const {
ASSERT((offset & (sizeof(Eterm) - 1)) == 0);
return arm::Mem(scheduler_registers, offset);
Expand Down Expand Up @@ -326,7 +320,19 @@ struct BeamAssembler : public BeamAssemblerCommon {
template<typename T>
void mov_imm(a32::Gp to, T value) {
// TODO
ASSERT(false);
// implement this for emit_apply_fun_shared
static_assert(std::is_integral<T>::value || std::is_pointer<T>::value);
if (value) {
ASSERT(false);
a.mov(to, imm(value));
} else {
// arm64 uses the xzr register (ZERO) here and
// x86 uses some x86 specific instruction sequence
// to set the register to zero.
// We need to understand how one sets a register to zero in
// arm32
a.mov(to, 0);
}
}

void mov_imm(a32::Gp to, std::nullptr_t value) {
Expand Down
10 changes: 9 additions & 1 deletion erts/emulator/beam/jit/arm/32/instr_fun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,15 @@ void BeamModuleAssembler::emit_i_make_fun3(const ArgLambda &Lambda,
}

void BeamGlobalAssembler::emit_apply_fun_shared() {
// TODO
// TODO this is the first called emitter
Label finished = a.newLabel();

/* Put the arity and fun into the right registers for `call_fun`, and stash
* the argument list in ARG5 for the error path. We'll bump the arity as
* we go through the argument list. */
mov_imm(ARG3, 0);
//a.mov(ARG4, getXRef(0));
//a.mov(ARG5, getXRef(1));
ASSERT(false);
}

Expand Down
2 changes: 2 additions & 0 deletions run_debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#qemu-arm -L /usr/arm-linux-gnueabihf -g 1234 ./RELEASE/erts-14.1/bin/erlexec
qemu-arm -L /usr/arm-linux-gnueabihf -g 1234 ./RELEASE/erts-15.0/bin/beam.smp -- -root ./RELEASE -bindir ./RELEASE/erts-15.0/bin -progname erl +JMsingle true -home /home/vagrant

0 comments on commit b079779

Please sign in to comment.