Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement emit_apply_fun_shared #12

Draft
wants to merge 18 commits into
base: arm32-jit
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion erts/emulator/beam/jit/arm/32/instr_fun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void BeamGlobalAssembler::emit_apply_fun_shared() {
emit_ptr_val(ARG1, ARG1);
a.sub(ARG1, ARG1, imm(TAG_PRIMARY_LIST));
a.ldmia(arm::Mem(ARG1), a32::GpList({TMP, ARG1}));
//a.str(TMP3, arm::Mem(TMP2).post(sizeof(Eterm)));
a.str(TMP, x_register);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fails emission....

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing a Mem object is fine and emission succeeds wiht getXRef(0) but it fails if the operand has been setup with setIndex and setShift.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to ChatGPT we need another register to use STR:

    ; Load the address of 'var' into r1 (or any free register).
    LDR   r1, =var      ; r1 now has the address of var

    ; Store r0 (32 bits) into [r1].
    STR   r0, [r1]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this code the register used as base register is inside x_register memory object operator. It is defined at creation using one of the available constructors of class arm::Mem

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get the steps anyway. The return of getCARRef is type arm:mem and x_register is type arm:mem. Can we just directly put the return of getCARRef in x_register?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails because getXReg adds an offset and we want to use a scale and an index register. We cannot use everything.
A correct initialization would be auto x_register = arm::Mem(scheduler_registers);


/* We bail at MAX_REG-1 rather than MAX_REG as the highest register
* is reserved for the loader. */
Expand Down