Skip to content

Commit

Permalink
Minor compile errors fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Y-Less committed Jan 6, 2018
1 parent fdf3a88 commit 11bc15d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 23 deletions.
4 changes: 2 additions & 2 deletions amx_header.inc
Expand Up @@ -703,12 +703,12 @@ stock bool:IsTagNameEmpty(tag[]) {

stock bool:IsTagIndexStrong(tag) {
new info[AMX_FUNCSTUBNT];
return (GetTagInfo(index, info) && IsTagIDStrong(info[AMX_FUNCSTUBNT_ID]);
return (GetTagInfo(tag, info) && IsTagIDStrong(info[AMX_FUNCSTUBNT_ID]));
}

stock bool:IsTagIndexWeak(tag) {
new info[AMX_FUNCSTUBNT];
return (GetTagInfo(index, info) && IsTagIDWeak(info[AMX_FUNCSTUBNT_ID]);
return (GetTagInfo(tag, info) && IsTagIDWeak(info[AMX_FUNCSTUBNT_ID]));
}

stock bool:IsTagIndexEmpty(tag) {
Expand Down
8 changes: 4 additions & 4 deletions asm.inc
Expand Up @@ -390,7 +390,7 @@ stock AsmError:AsmEmitAnd(ctx[AsmContext]) {
}

stock AsmError:AsmEmitBounds(ctx[AsmContext], bound) {
return AsmEmitInstruction(ctx, OP_BOUDNS, bound);
return AsmEmitInstruction(ctx, OP_BOUNDS, bound);
}

stock AsmError:AsmEmitBreak(ctx[AsmContext]) {
Expand Down Expand Up @@ -572,11 +572,11 @@ stock AsmError:AsmEmitJsgeqRel(ctx[AsmContext], offset) {
}

stock AsmError:AsmEmitJsgrtr(ctx[AsmContext], address) {
return AsmEmitInstruction(ctx, OP_JSTRTR, address);
return AsmEmitInstruction(ctx, OP_JSGRTR, address);
}

stock AsmError:AsmEmitJsgrtrRel(ctx[AsmContext], offset) {
return AsmEmitJumpInstruction(ctx, OP_JSTRTR, offset);
return AsmEmitJumpInstruction(ctx, OP_JSGRTR, offset);
}

stock AsmError:AsmEmitJsleq(ctx[AsmContext], address) {
Expand Down Expand Up @@ -648,7 +648,7 @@ stock AsmError:AsmEmitJsgeqLabelStringize(ctx[AsmContext], const label[]) {
}

stock AsmError:AsmEmitJsgrtrLabelStringize(ctx[AsmContext], const label[]) {
return AsmEmitJumpLabelInstruction(ctx, OP_JSTRTR, label);
return AsmEmitJumpLabelInstruction(ctx, OP_JSGRTR, label);
}

stock AsmError:AsmEmitJsleqLabelStringize(ctx[AsmContext], const label[]) {
Expand Down
2 changes: 1 addition & 1 deletion frame_info.inc
Expand Up @@ -94,7 +94,7 @@ stock SetFrameParameterSize(frm_addr, size) {
}

stock SetFrameParameterCount(frm_addr, count) {
return SetFrameParameterSize(frm_add, count << 2);
SetFrameParameterSize(frm_addr, count << 2);
}

stock GetFrameTotalSize(frm_addr) {
Expand Down
19 changes: 16 additions & 3 deletions opcode.inc
Expand Up @@ -843,11 +843,24 @@ stock GetOpcodeInstructionInformation(Opcode:opcode) {
}

stock GetOpcodeInstructionName(Opcode:opcode) {
static none[OPCODE_MAX_INSN_NAME] = "none";
static const ret[OPCODE_MAX_INSN_NAME] = "none";
if (OP_NONE < opcode < Opcode:NUM_OPCODES) {
return insn_table[_:opcode][OpcodeInsnInfo_name];
// This doesn't work.
//return insn_table[_:opcode][OpcodeInsnInfo_name];
// Fake it without requiring `strcpy`.
#emit CONST.alt insn_table
#emit LOAD.S.pri opcode
#emit IDXADDR
#emit MOVE.alt
#emit LOAD.I
#emit ADD
#emit LOAD.S.alt 16
#emit MOVS 60 // 15 * 4
#emit RETN
// Check that the code is correct for the size of "OPCODE_MAX_INSN_NAME".
#assert OPCODE_MAX_INSN_NAME == 15
}
return none;
return ret;
}

stock GetOpcodeInstructionParameters(Opcode:opcode) {
Expand Down
30 changes: 17 additions & 13 deletions profiler.inc
Expand Up @@ -43,10 +43,14 @@
#endif

enum ProfEntryCode {
pec_push_address[2],
pec_push_index[2],
pec_push_8[2],
pec_call_enter[2]
Opcode:pec_push_c0,
pec_push_address,
Opcode:pec_push_c1,
pec_push_index,
Opcode:pec_push_c2,
pec_push_8,
Opcode:pec_call,
pec_call_enter
}

static stock g_pecs[PROF_MAX_PUBLICS][ProfEntryCode];
Expand Down Expand Up @@ -145,20 +149,20 @@ static stock new_pec(index, address, code_start) {
if (g_num_pecs < sizeof(g_pecs)) {
new pec[ProfEntryCode];

pec[pec_push_address][0] = RelocateOpcode(OP_PUSH_C);
pec[pec_push_address][1] = address;
pec[pec_push_c0] = RelocateOpcode(OP_PUSH_C);
pec[pec_push_address] = address;

pec[pec_push_index][0] = RelocateOpcode(OP_PUSH_C);
pec[pec_push_index][1] = index;
pec[pec_push_c1] = RelocateOpcode(OP_PUSH_C);
pec[pec_push_index] = index;

pec[pec_push_8][0] = RelocateOpcode(OP_PUSH_C);
pec[pec_push_8][1] = 8;
pec[pec_push_c2] = RelocateOpcode(OP_PUSH_C);
pec[pec_push_8] = 8;

new enter_proc;
#emit const.pri enter_public
#emit stor.s.pri enter_proc
pec[pec_call_enter][0] = RelocateOpcode(OP_CALL);
pec[pec_call_enter][1] = code_start + enter_proc;
pec[pec_call] = RelocateOpcode(OP_CALL);
pec[pec_call_enter] = code_start + enter_proc;

g_pecs[g_num_pecs] = pec;
return g_num_pecs++;
Expand All @@ -175,7 +179,7 @@ stock ProfilerInit() {
new defsize = hdr[AMX_HDR_DEFSIZE];
new num_publics = (hdr[AMX_HDR_NATIVES] - hdr[AMX_HDR_PUBLICS]) / defsize;

new amx_base = GetAmxBase();
new amx_base = GetAmxBaseAddress();

// Redirect all public calls to ProfileHook().
for (new i = 0, cur = publics; i < num_publics; cur += defsize, i++) {
Expand Down

0 comments on commit 11bc15d

Please sign in to comment.