text stringlengths 1 93.6k |
|---|
['swpa', 'ldadda', 'ldeora', 'ldseta', 'ldsmina', 'ldsmaxa', 'ldumina', 'ldumaxa'] +\
|
['swpl', 'ldaddl', 'ldeorl', 'ldsetl', 'ldsminl', 'ldsmaxl', 'lduminl', 'ldumaxl'] +\
|
['swpal', 'ldaddal', 'ldeoral', 'ldsetal', 'ldsminal', 'ldsmaxal', 'lduminal', 'ldumaxal']
|
opmap = {
|
'swp': 'amoswap',
|
'ldadd': 'amoadd',
|
'ldeor': 'amoxor',
|
'ldset': 'amoor',
|
'ldsmax': 'amomax',
|
'ldsmin': 'amomin',
|
'ldumax': 'amomaxu',
|
'ldumin': 'amominu',
|
}
|
def __init__(self, opcode, operands):
|
super().__init__(opcode, operands)
|
# key thing here: translate the acquire/release semantics
|
if opcode.endswith('al'): # acq + release
|
self.suffix = '.aqrl'
|
elif opcode.endswith('a'):
|
self.suffix = '.aq'
|
elif opcode.endswith('l'):
|
self.suffix = '.rl'
|
else:
|
self.suffix = ''
|
self.tr_opcode = self.opmap[opcode.rstrip('al')]
|
def emit_riscv(self):
|
size = 'w' if self.wflag else 'd'
|
dst, desired, addr = self.specific_regs
|
self.riscv_instructions = [
|
f'{self.tr_opcode}.{size}{self.suffix} {desired}, {dst}, ({addr})'
|
]
|
class AtomicLoadAndClear(Arm64Instruction):
|
opcodes = ['ldclr', 'ldclra', 'ldclrl', 'ldclral']
|
def __init__(self, opcode, operands):
|
super().__init__(opcode, operands)
|
self.required_temp_regs = ['temp'] # we will invert before the atomic
|
# key thing here: translate the acquire/release semantics
|
if opcode.endswith('al'): # acq + release
|
self.suffix = '.aqrl'
|
elif opcode.endswith('a'):
|
self.suffix = '.aq'
|
elif opcode.endswith('l'):
|
self.suffix = '.rl'
|
else:
|
self.suffix = ''
|
def emit_riscv(self):
|
size = 'w' if self.wflag else 'd'
|
dst, desired, addr = self.specific_regs
|
tmp = self.required_temp_regs[0]
|
self.riscv_instructions = [
|
f'not {tmp}, {dst}',
|
f'amoand.{size}{self.suffix} {desired}, {tmp}, ({addr})'
|
]
|
# <FILESEP>
|
import httpx
|
import json
|
import os
|
import re
|
import sentry_sdk
|
import random
|
import time
|
import yaml
|
import logging
|
if os.environ.get("MHYY_LOGLEVEL", "").upper() == "DEBUG":
|
loglevel = logging.DEBUG
|
elif os.environ.get("MHYY_LOGLEVEL", "").upper() == "WARNING":
|
loglevel = logging.WARNING
|
elif os.environ.get("MHYY_LOGLEVEL", "").upper() == "ERROR":
|
loglevel = logging.ERROR
|
else:
|
loglevel = logging.INFO
|
# 设置日志配置
|
logging.basicConfig(
|
level=loglevel,
|
format="%(asctime)s [%(levelname)s]: %(message)s",
|
datefmt="%Y-%m-%d %H:%M:%S",
|
)
|
logger = logging.getLogger()
|
def ReadConf(variable_name, default_value=None):
|
# Try to get the variable from the environment
|
env_value = os.environ.get(variable_name)
|
if env_value:
|
config_data = yaml.load(env_value, Loader=yaml.FullLoader)
|
return config_data
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.