Skip to content

Commit

Permalink
Jit: Threads: Add Load and Store
Browse files Browse the repository at this point in the history
  • Loading branch information
matetokodi committed Jul 19, 2024
1 parent 6de3fbf commit a0cfd72
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 8 deletions.
56 changes: 56 additions & 0 deletions src/jit/ByteCodeParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,62 @@ static void compileFunction(JITCompiler* compiler)
#endif /* SLJIT_CONFIG_X86 */
break;
}
#if defined(ENABLE_EXTENDED_FEATURES)
case ByteCode::I32AtomicLoadOpcode:
case ByteCode::I32AtomicLoad8UOpcode:
case ByteCode::I32AtomicLoad16UOpcode: {
info = Instruction::kIs32Bit;
requiredInit = OTLoadI32;
FALLTHROUGH;
}
case ByteCode::I64AtomicLoadOpcode:
case ByteCode::I64AtomicLoad8UOpcode:
case ByteCode::I64AtomicLoad16UOpcode:
case ByteCode::I64AtomicLoad32UOpcode: {
Instruction* instr = compiler->append(byteCode, Instruction::Load, opcode, 1, 1);
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
if (opcode == ByteCode::I64AtomicLoadOpcode) {
info = Instruction::kIsCallback;
}
#endif /* SLJIT_32BIT_ARCHITECTURE */
instr->addInfo(info);
instr->setRequiredRegsDescriptor(requiredInit != OTNone ? requiredInit : OTLoadI64);

MemoryLoad* loadOperation = reinterpret_cast<MemoryLoad*>(byteCode);
Operand* operands = instr->operands();

operands[0] = STACK_OFFSET(loadOperation->srcOffset());
operands[1] = STACK_OFFSET(loadOperation->dstOffset());
break;
}
case ByteCode::I32AtomicStoreOpcode:
case ByteCode::I32AtomicStore8Opcode:
case ByteCode::I32AtomicStore16Opcode: {
info = Instruction::kIs32Bit;
requiredInit = OTStoreI32;
FALLTHROUGH;
}
case ByteCode::I64AtomicStoreOpcode:
case ByteCode::I64AtomicStore8Opcode:
case ByteCode::I64AtomicStore16Opcode:
case ByteCode::I64AtomicStore32Opcode: {
Instruction* instr = compiler->append(byteCode, Instruction::Store, opcode, 2, 0);
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
if (opcode == ByteCode::I64AtomicStoreOpcode) {
info = Instruction::kIsCallback;
}
#endif /* SLJIT_32BIT_ARCHITECTURE */
instr->addInfo(info);
instr->setRequiredRegsDescriptor(requiredInit != OTNone ? requiredInit : OTStoreI64);

MemoryStore* atomicStore = reinterpret_cast<MemoryStore*>(byteCode);
Operand* operands = instr->operands();

operands[0] = STACK_OFFSET(atomicStore->src0Offset());
operands[1] = STACK_OFFSET(atomicStore->src1Offset());
break;
}
#endif /* ENABLE_EXTENDED_FEATURES */
default: {
ASSERT_NOT_REACHED();
break;
Expand Down
Loading

0 comments on commit a0cfd72

Please sign in to comment.