Skip to content

Commit d265940

Browse files
author
Pascal Beyer
committed
I cannot spell prologue.
1 parent cd9ba42 commit d265940

File tree

4 files changed

+34
-34
lines changed

4 files changed

+34
-34
lines changed

src/ast.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,12 +783,12 @@ struct ast_function{
783783
u8 *end_in_ir_arena;
784784

785785

786-
u8 *base_of_prolog;
787-
smm size_of_prolog; // these could be smaller
786+
u8 *base_of_prologue;
787+
smm size_of_prologue; // these could be smaller
788788

789789
// right now _just_ the function without the prolog
790790
u8 *base_of_main_function;
791-
smm byte_size_without_prolog;
791+
smm byte_size_without_prologue;
792792

793793
smm rsp_subtract_offset;
794794
smm byte_size;

src/coff_writer.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,17 +1290,17 @@ func void print_coff(struct string output_file_path, struct memory_arena *arena,
12901290
for_ast_list(defined_functions){
12911291
struct ast_function *function = cast(struct ast_function *)it->value;
12921292

1293-
smm function_size = function->size_of_prolog + function->byte_size_without_prolog;
1293+
smm function_size = function->size_of_prologue + function->byte_size_without_prologue;
12941294

12951295
u8 *memory_for_function = push_uninitialized_data(arena, u8, function_size);
12961296

12971297
u8 *at = memory_for_function;
1298-
memcpy(at, function->base_of_prolog, function->size_of_prolog);
1299-
at += function->size_of_prolog;
1298+
memcpy(at, function->base_of_prologue, function->size_of_prologue);
1299+
at += function->size_of_prologue;
13001300

1301-
memcpy(at, function->base_of_main_function, function->byte_size_without_prolog);
1301+
memcpy(at, function->base_of_main_function, function->byte_size_without_prologue);
13021302
function->base_of_main_function = at;
1303-
at += function->byte_size_without_prolog;
1303+
at += function->byte_size_without_prologue;
13041304

13051305
push_align_initialized_to_specific_value(arena, 16, 0xcc);
13061306

@@ -1888,8 +1888,8 @@ func void print_coff(struct string output_file_path, struct memory_arena *arena,
18881888
if(patch->dest_declaration->kind == IR_function){
18891889
struct ast_function *function = cast(struct ast_function *)patch->dest_declaration;
18901890

1891-
memory_location += function->size_of_prolog;
1892-
patch->rip_at += function->size_of_prolog;
1891+
memory_location += function->size_of_prologue;
1892+
patch->rip_at += function->size_of_prologue;
18931893
}
18941894

18951895
if(patch->kind == PATCH_rip_relative){
@@ -2972,7 +2972,7 @@ func void print_coff(struct string output_file_path, struct memory_arena *arena,
29722972
proc_symbol->pointer_to_end = 0;
29732973
proc_symbol->pointer_to_next = 0;
29742974
proc_symbol->procedure_length = (u32)function->byte_size;
2975-
proc_symbol->debug_start_offset = (u32)function->size_of_prolog;
2975+
proc_symbol->debug_start_offset = (u32)function->size_of_prologue;
29762976
proc_symbol->debug_end_offset = (u32)function->byte_size;
29772977
proc_symbol->type_index = function->type->base.pdb_type_index;
29782978
proc_symbol->offset_in_section = (u32)function->offset_in_text_section;

src/emit_x64.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,7 +1139,7 @@ func void emit_location_prevent_spilling(struct context *context, struct emit_lo
11391139

11401140
func void emit_location_allow_spilling(struct context *context, struct emit_location *loc){
11411141
(void)context;
1142-
1142+
11431143
assert(loc->prevent_spilling > 0);
11441144
loc->prevent_spilling -= 1;
11451145
if(loc->state == EMIT_LOCATION_register_relative){
@@ -2079,7 +2079,7 @@ func struct emit_location *emit_load_bitfield(struct context *context, struct em
20792079
emit_reg_extended_op(context, no_prefix(), one_byte_opcode(SHIFT_OR_ROTATE_REGM_IMMEDIATE8), REG_OPCODE_SHIFT_LEFT, loc);
20802080
emit(bit_size - (bitfield->bit_index + bitfield->width));
20812081
}
2082-
2082+
20832083
if(bitfield->width != bit_size){
20842084
u8 shift_type = type_is_signed(bitfield->base_type) ? REG_OPCODE_SHIFT_ARITHMETIC_RIGHT : REG_OPCODE_SHIFT_RIGHT;
20852085
emit_reg_extended_op(context, no_prefix(), one_byte_opcode(SHIFT_OR_ROTATE_REGM_IMMEDIATE8), shift_type, loc);
@@ -2381,7 +2381,7 @@ func struct emit_location *emit_intrinsic(struct context *context, struct ast_fu
23812381
// Because `context->max_amount_of_function_call_arguments * 8` is not yet known, we need to emit a "patch".
23822382
//
23832383
struct emit_location *size = emit_load_gpr(context, argument_locations[0]);
2384-
2384+
23852385
// Align-up the size to a 16-byte boundary.
23862386
// add size, 15
23872387
// and size, ~15
@@ -2480,7 +2480,7 @@ func struct emit_location *emit_call_to_inline_asm_function(struct context *cont
24802480
// @note: we use the 'patch_call_source_declaration' here, as the other one might not be defined.
24812481
struct ast_scope *scope = function->scope;
24822482
assert(scope->asm_block);
2483-
2483+
24842484
struct ir_asm_block *asm_block = scope->asm_block;
24852485
context->in_inline_asm_function = asm_block->token;
24862486
context->current_inline_asm_function = function;
@@ -2536,7 +2536,7 @@ func struct emit_location *emit_code_for_pointer_subscript(struct context *conte
25362536
// as 'index' has either a premultiplied 'index' or uses a 'scale'
25372537
//
25382538

2539-
#if 0
2539+
#if 0
25402540
int log_scale = -1;
25412541
switch(deref_type->size){
25422542
case 1: log_scale = 0; break;
@@ -2550,7 +2550,7 @@ func struct emit_location *emit_code_for_pointer_subscript(struct context *conte
25502550
loc->log_index_scale = log_scale;
25512551
return loc;
25522552
}
2553-
#endif
2553+
#endif
25542554
index = emit_load_gpr(context, index);
25552555

25562556
// @incomplete:
@@ -4799,7 +4799,7 @@ func void emit_code_for_function(struct context *context, struct ast_function *f
47994799
// set the current code section to the prolog
48004800
u8 *prolog_start = context->emit_pool.current;
48014801
context->current_emit_base = prolog_start;
4802-
function->base_of_prolog = prolog_start;
4802+
function->base_of_prologue = prolog_start;
48034803

48044804
// @cleanup: only do this if we have a memcpy, this value is also needed to be known when returning a large struct
48054805
// maybe the large struct code should live in the epilog?
@@ -4901,7 +4901,7 @@ func void emit_code_for_function(struct context *context, struct ast_function *f
49014901
// rsp ------------------------------------------------------------^
49024902
// -25.07.2021
49034903

4904-
function->size_of_prolog = get_bytes_emitted(context);
4904+
function->size_of_prologue = get_bytes_emitted(context);
49054905

49064906
// main code section
49074907
u8 *main_function_start = context->emit_pool.current;
@@ -5002,9 +5002,9 @@ func void emit_code_for_function(struct context *context, struct ast_function *f
50025002
context->alloca_patch_nodes.first = context->alloca_patch_nodes.last = null;
50035003
}
50045004

5005-
function->byte_size_without_prolog = get_bytes_emitted(context);
5005+
function->byte_size_without_prologue = get_bytes_emitted(context);
50065006

5007-
function->byte_size = function->size_of_prolog + function->byte_size_without_prolog;
5007+
function->byte_size = function->size_of_prologue + function->byte_size_without_prologue;
50085008

50095009
end_counter(context, emit_code_for_function);
50105010
}

src/obj_writer.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ func void *push_unwind_information_for_function(struct memory_arena *arena, stru
876876

877877
unwind_info->version = 1;
878878
unwind_info->flags = function->seh_exception_handler ? /*UNW_FLAG_EHANDLER*/1 : 0;
879-
unwind_info->size_of_prolog = (u8)(function->size_of_prolog);
879+
unwind_info->size_of_prolog = (u8)(function->size_of_prologue);
880880
unwind_info->count_of_codes = 0;
881881
unwind_info->frame_register = REGISTER_BP;
882882

@@ -948,10 +948,10 @@ func void *push_unwind_information_for_function(struct memory_arena *arena, stru
948948

949949
u32 count = 0;
950950
for(struct seh_exception_handler *handler = function->seh_exception_handler; handler; handler = handler->next, count++){
951-
*push_struct(arena, u32) = (u32)(handler->start_offset_in_function + function->relative_virtual_address + function->size_of_prolog); // BeginAddress
952-
*push_struct(arena, u32) = (u32)(handler->end_offset_in_function + function->relative_virtual_address + function->size_of_prolog); // EndAddress
951+
*push_struct(arena, u32) = (u32)(handler->start_offset_in_function + function->relative_virtual_address + function->size_of_prologue); // BeginAddress
952+
*push_struct(arena, u32) = (u32)(handler->end_offset_in_function + function->relative_virtual_address + function->size_of_prologue); // EndAddress
953953
*push_struct(arena, u32) = (u32)handler->filter_function->relative_virtual_address; // HandlerAddress
954-
*push_struct(arena, u32) = (u32)(handler->end_offset_in_function + function->relative_virtual_address + function->size_of_prolog); // JumpTarget (assumed to be the same as EndAddress for now)
954+
*push_struct(arena, u32) = (u32)(handler->end_offset_in_function + function->relative_virtual_address + function->size_of_prologue); // JumpTarget (assumed to be the same as EndAddress for now)
955955
}
956956

957957
*count_dest = count;
@@ -1069,7 +1069,7 @@ void codeview_push_debug_s_lines(struct ast_function *function, struct memory_ar
10691069
for(smm index = 0; index < function->line_information.size; index++){
10701070
struct function_line_information line = function->line_information.data[index];
10711071

1072-
u32 offset = (u32)(line.offset + function->size_of_prolog);
1072+
u32 offset = (u32)(line.offset + function->size_of_prologue);
10731073

10741074
*push_struct(arena, u32) = (u32)offset;
10751075
*push_struct(arena, u32) = (u32)(line.line | /*is_statement*/0x80000000);
@@ -1447,17 +1447,17 @@ void print_obj(struct string output_file_path, struct memory_arena *arena, struc
14471447
for_ast_list(defined_functions){
14481448
struct ast_function *function = (struct ast_function *)it->value;
14491449

1450-
smm function_size = function->size_of_prolog + function->byte_size_without_prolog;
1450+
smm function_size = function->size_of_prologue + function->byte_size_without_prologue;
14511451

14521452
u8 *memory_for_function = push_uninitialized_data(arena, u8, function_size);
14531453

14541454
u8 *at = memory_for_function;
1455-
memcpy(at, function->base_of_prolog, function->size_of_prolog);
1456-
at += function->size_of_prolog;
1455+
memcpy(at, function->base_of_prologue, function->size_of_prologue);
1456+
at += function->size_of_prologue;
14571457

1458-
memcpy(at, function->base_of_main_function, function->byte_size_without_prolog);
1458+
memcpy(at, function->base_of_main_function, function->byte_size_without_prologue);
14591459
function->base_of_main_function = at;
1460-
at += function->byte_size_without_prolog;
1460+
at += function->byte_size_without_prologue;
14611461

14621462
push_align_initialized_to_specific_value(arena, 16, 0xcc);
14631463

@@ -2144,7 +2144,7 @@ void print_obj(struct string output_file_path, struct memory_arena *arena, struc
21442144
proc_symbol->pointer_to_end = 0;
21452145
proc_symbol->pointer_to_next = 0;
21462146
proc_symbol->procedure_length = (u32)function->byte_size;
2147-
proc_symbol->debug_start_offset = (u32)function->size_of_prolog;
2147+
proc_symbol->debug_start_offset = (u32)function->size_of_prologue;
21482148
proc_symbol->debug_end_offset = (u32)function->byte_size;
21492149
proc_symbol->type_index = function_id_at++; // @note: as this is an S_LPROC32_ID not an S_LPROC32 this is the LF_FUNC_ID not the type.
21502150
proc_symbol->offset_in_section = 0; // Filled in by a relocation
@@ -2855,7 +2855,7 @@ void print_obj(struct string output_file_path, struct memory_arena *arena, struc
28552855

28562856
struct ast_function *function = (struct ast_function *)patch->dest_declaration;
28572857

2858-
smm destination_offset = (function->offset_in_text_section + function->size_of_prolog + patch->location_offset_in_dest_declaration);
2858+
smm destination_offset = (function->offset_in_text_section + function->size_of_prologue + patch->location_offset_in_dest_declaration);
28592859

28602860
struct coff_relocation *relocation = (void *)(text_relocations_data + 10 * index++);
28612861

@@ -2872,7 +2872,7 @@ void print_obj(struct string output_file_path, struct memory_arena *arena, struc
28722872
//
28732873
s32 value_to_write = (s32)((patch->location_offset_in_dest_declaration + 4) - patch->rip_at + patch->location_offset_in_source_declaration);
28742874
if(value_to_write){
2875-
u8 *memory_location = function->memory_location + patch->location_offset_in_dest_declaration + function->size_of_prolog;
2875+
u8 *memory_location = function->memory_location + patch->location_offset_in_dest_declaration + function->size_of_prologue;
28762876
*(s32 *)memory_location = value_to_write;
28772877
}
28782878
}else{

0 commit comments

Comments
 (0)