Glbl -> Global. Removed comments about compression

This commit is contained in:
Void NV 2020-03-12 22:11:04 -05:00
parent cd5dc3800f
commit 138537ad5b
41 changed files with 173 additions and 170 deletions

View File

@ -4,7 +4,7 @@ Bool ParseAsmImm(CCompCtrl *cc,CAsmArg *arg)
LexExcept(cc,"Already one immediate at ");
arg->imm_or_off_present = TRUE;
arg->num.local_asm_undef_hash = NULL;
arg->num.glbl_asm_undef_hash = NULL;
arg->num.global_asm_undef_hash = NULL;
cc->asm_undef_hash = NULL;
cc->abs_counts = 0;
cc->flags &= ~(CCF_UNRESOLVED + CCF_LOCAL);
@ -19,14 +19,14 @@ Bool ParseAsmImm(CCompCtrl *cc,CAsmArg *arg)
if (cc->flags & CCF_LOCAL)
arg->num.local_asm_undef_hash = cc->asm_undef_hash;
else
arg->num.glbl_asm_undef_hash = cc->asm_undef_hash;
arg->num.global_asm_undef_hash = cc->asm_undef_hash;
cc->asm_undef_hash=NULL;
}
else
{
arg->num.i = Call(arg->num.machine_code);
arg->num.glbl_asm_undef_hash = cc->asm_undef_hash;
arg->num.global_asm_undef_hash = cc->asm_undef_hash;
cc->asm_undef_hash = NULL;
Free(arg->num.machine_code);
arg->num.machine_code = NULL;
@ -218,7 +218,7 @@ I64 AsmMakeArgMask(CCompCtrl *cc,CAsmArg *arg)
res&=0xFF0FFFFFFF;
if (arg->reg1!=REG_NONE && arg->imm_or_off_present && !arg->num.i &&
!arg->num.glbl_asm_undef_hash && !arg->num.local_asm_undef_hash)
!arg->num.global_asm_undef_hash && !arg->num.local_asm_undef_hash)
arg->imm_or_off_present=FALSE; //Zero displacement
if (arg->reg2!=REG_NONE || arg->scale!=1) {
@ -292,10 +292,10 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 count,Bool U8_avail)
num2->num.i-=num2->rel;
for (i=0;i<count;i++) {
if (num2->U8_count==1) {
if (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
if (num2->num.local_asm_undef_hash||num2->num.global_asm_undef_hash)
AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I8+num2->imm_flag,
aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
num2->num.glbl_asm_undef_hash,cc->lex_include_stack->line_num,
num2->num.global_asm_undef_hash,cc->lex_include_stack->line_num,
U8_avail);
else if (!num2->imm_flag && !(I8_MIN<=num2->num.i<=I8_MAX))
LexExcept(cc,"Branch out of range at ");
@ -319,10 +319,10 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 count,Bool U8_avail)
AOTStoreCodeU8(cc,num2->num.i);
} else {
if (num2->U8_count==2) {
if (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
if (num2->num.local_asm_undef_hash||num2->num.global_asm_undef_hash)
AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I16+num2->imm_flag,
aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
num2->num.glbl_asm_undef_hash,cc->lex_include_stack->line_num,
num2->num.global_asm_undef_hash,cc->lex_include_stack->line_num,
U8_avail);
else if (!num2->imm_flag && !(I16_MIN<=num2->num.i<=I16_MAX))
LexExcept(cc,"Branch out of range at ");
@ -346,10 +346,10 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 count,Bool U8_avail)
AOTStoreCodeU8(cc,num2->num.i.u8[0]);
AOTStoreCodeU8(cc,num2->num.i.u8[1]);
} else if (num2->U8_count==4) {
if (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
if (num2->num.local_asm_undef_hash||num2->num.global_asm_undef_hash)
AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I32+num2->imm_flag,
aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
num2->num.glbl_asm_undef_hash,cc->lex_include_stack->line_num,
num2->num.global_asm_undef_hash,cc->lex_include_stack->line_num,
U8_avail);
else if (!num2->imm_flag && !(I32_MIN<=num2->num.i<=I32_MAX))
LexExcept(cc,"Branch out of range at ");
@ -372,10 +372,10 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 count,Bool U8_avail)
}
AOTStoreCodeU32(cc,num2->num.i);
} else if (num2->U8_count==8) {
if (num2->num.local_asm_undef_hash||num2->num.glbl_asm_undef_hash)
if (num2->num.local_asm_undef_hash||num2->num.global_asm_undef_hash)
AsmUnresolvedAdd(cc,num2->num.machine_code,IET_REL_I64+num2->imm_flag,
aotc->rip,num2->rel,num2->num.local_asm_undef_hash,
num2->num.glbl_asm_undef_hash,cc->lex_include_stack->line_num,
num2->num.global_asm_undef_hash,cc->lex_include_stack->line_num,
U8_avail);
if (num2->imm_flag) {
if (num2->num.abs_counts.abs_addres&1) {
@ -397,7 +397,7 @@ Bool AsmStoreNum(CCompCtrl *cc,CAsmNum2 *num2,I64 count,Bool U8_avail)
AOTStoreCodeU64(cc,num2->num.i);
}
if (U8_avail && !num2->num.local_asm_undef_hash &&
!num2->num.glbl_asm_undef_hash &&
!num2->num.global_asm_undef_hash &&
!num2->imm_flag && -124<=num2->num.i<=123) {
LexWarn(cc,"could use I8 displacement at ");
return FALSE;
@ -838,7 +838,7 @@ U0 ParseAsmDefine(CCompCtrl *cc,I64 U8_count)
while (cc->token && cc->token!=';') {
num2.num.local_asm_undef_hash=NULL;
num2.num.glbl_asm_undef_hash=NULL;
num2.num.global_asm_undef_hash=NULL;
if (cc->token==TK_STR) {
ptr=cc->cur_str;
i=cc->cur_str_len-1;
@ -860,7 +860,7 @@ U0 ParseAsmDefine(CCompCtrl *cc,I64 U8_count)
num2.num.local_asm_undef_hash=cc->asm_undef_hash;
cc->asm_undef_hash=NULL;
} else {
num2.num.glbl_asm_undef_hash=cc->asm_undef_hash;
num2.num.global_asm_undef_hash=cc->asm_undef_hash;
cc->asm_undef_hash=NULL;
}
} else {
@ -885,7 +885,7 @@ U0 ParseAsmDefine(CCompCtrl *cc,I64 U8_count)
num2.imm_flag=TRUE;
num2.num.abs_counts=cc->abs_counts;
if (is_dup) {
if (num2.num.local_asm_undef_hash || num2.num.glbl_asm_undef_hash)
if (num2.num.local_asm_undef_hash || num2.num.global_asm_undef_hash)
LexExcept(cc,"Undefined DUP count at ");
num2.num.i=dup_val;
AsmStoreNum(cc,&num2,i,FALSE);
@ -952,7 +952,7 @@ U0 ParseAsmBlk(CCompCtrl *cc,I64 comp_flags)
tmpex->str=cc->cur_str;
cc->cur_str=0;
tmpex->type=HTT_EXPORT_SYS_SYM|HTF_UNRESOLVED;
HashAdd(tmpex,cc->htc.glbl_hash_table);
HashAdd(tmpex,cc->htc.global_hash_table);
tmpex->type|=HTF_IMPORT;
if (Lex(cc)==',')
Lex(cc); //skip ','
@ -1091,10 +1091,10 @@ U0 ParseAsmBlk(CCompCtrl *cc,I64 comp_flags)
else {
if (*tmpex->str=='@' && tmpex->str[1]=='@') {
if (cc->token==TK_DBL_COLON)
LexExcept(cc,"No local glbl exports at ");
LexExcept(cc,"No local global exports at ");
HashAdd(tmpex,cc->htc.local_hash_table);
} else
HashAdd(tmpex,cc->htc.glbl_hash_table);
HashAdd(tmpex,cc->htc.global_hash_table);
if (cc->htc.local_var_list) {//AsmBlk in fun? Also add goto-like label.
if (!(g_lb=COCGoToLabelFind(cc,tmpex->str))) {
g_lb=COCMiscNew(cc,CMT_ASM_LABEL);

View File

@ -70,7 +70,7 @@ U0 AOTLocalsResolve(CCompCtrl *cc)
}
HashTableDel(cc->htc.local_hash_table);
cc->htc.hash_table_list=cc->htc.local_hash_table=HashTableNew(16);
cc->htc.local_hash_table->next=cc->htc.glbl_hash_table;
cc->htc.local_hash_table->next=cc->htc.global_hash_table;
aotc->local_unresolved=NULL;
}
@ -78,7 +78,7 @@ U0 AOTGlobalsResolve(CCompCtrl *cc,CAOT *tmpaot)
{
CAOTCtrl *aotc=cc->aotc;
CHashFun *tmpf;
CAsmUnresolvedRef *tmpu=aotc->glbl_unresolved,*tmpu1;
CAsmUnresolvedRef *tmpu=aotc->global_unresolved,*tmpu1;
I64 i,j;
CAOTImportExport *tmpie,*tmpie1;
CAsmUndefHash *tmpauh;
@ -131,8 +131,8 @@ U0 AOTGlobalsResolve(CCompCtrl *cc,CAOT *tmpaot)
tmpu=tmpu1;
}
for (i=0;i<=cc->htc.glbl_hash_table->mask;i++) {
tmpex=cc->htc.glbl_hash_table->body[i];
for (i=0;i<=cc->htc.global_hash_table->mask;i++) {
tmpex=cc->htc.global_hash_table->body[i];
while (tmpex) {
if (tmpex->type & (HTF_IMPORT|HTF_GOTO_LABEL)) {
if (tmpex->use_count && (tmpie=tmpex->ie_list)) {
@ -169,7 +169,7 @@ U0 AOTGlobalsResolve(CCompCtrl *cc,CAOT *tmpaot)
tmpie->type=IET_REL32_EXPORT;
if (tmpex->type & HTT_FUN)
tmpie->rip=tmpf->exe_addr;
else if (tmpex->type & HTT_GLBL_VAR)
else if (tmpex->type & HTT_GLOBAL_VAR)
tmpie->rip=tmpex(CHashGlobalVar *)->data_addr_rip;
else
tmpie->rip=tmpex->val;
@ -187,7 +187,7 @@ U0 AOTGlobalsResolve(CCompCtrl *cc,CAOT *tmpaot)
}
U0 AsmUnresolvedAdd(CCompCtrl *cc,U8 *machine_code,I64 type,I64 rip,I64 rel_rip,
CAsmUndefHash *local_asm_undef_hash,CAsmUndefHash *glbl_asm_undef_hash,
CAsmUndefHash *local_asm_undef_hash,CAsmUndefHash *global_asm_undef_hash,
I64 line_num,Bool U8_avail)
{
CAsmUnresolvedRef *tmpu=MAlloc(sizeof(CAsmUnresolvedRef));
@ -205,12 +205,12 @@ U0 AsmUnresolvedAdd(CCompCtrl *cc,U8 *machine_code,I64 type,I64 rip,I64 rel_rip,
tmpu->next=cc->aotc->local_unresolved;
cc->aotc->local_unresolved=tmpu;
} else {
tmpu->asm_undef_hash=glbl_asm_undef_hash;
tmpu->next=cc->aotc->glbl_unresolved;
cc->aotc->glbl_unresolved=tmpu;
if (glbl_asm_undef_hash->hash->type & HTF_IMPORT) {
tmpu->str=StrNew(glbl_asm_undef_hash->hash->str);
if (glbl_asm_undef_hash->hash->type & HTF_IMM)
tmpu->asm_undef_hash=global_asm_undef_hash;
tmpu->next=cc->aotc->global_unresolved;
cc->aotc->global_unresolved=tmpu;
if (global_asm_undef_hash->hash->type & HTF_IMPORT) {
tmpu->str=StrNew(global_asm_undef_hash->hash->str);
if (global_asm_undef_hash->hash->type & HTF_IMM)
tmpu->imm_flag=TRUE;
}
}

View File

@ -279,7 +279,7 @@ U0 ICFPow(CCompCtrl *cc,CIntermediateCode *tmpi,U8 *buf,I64 rip)
tmpex=CAlloc(sizeof(CHashExport));
tmpex->str=StrNew("SYS_POW");
tmpex->type=HTT_EXPORT_SYS_SYM|HTF_UNRESOLVED|HTF_IMPORT;
HashAdd(tmpex,cc->htc.glbl_hash_table);
HashAdd(tmpex,cc->htc.global_hash_table);
}
if (tmpex->type&HTF_IMPORT) {
if (GetOption(OPTf_USE_IMM64)) {

View File

@ -5,7 +5,7 @@ I64 HashEntrySize(CHashSrcSym *tmph)
switch (HashTypeNum(tmph)) {
case HTt_DEFINE_STR:
return MSize(tmph(CHashDefineStr *)->data);
case HTt_GLBL_VAR:
case HTt_GLOBAL_VAR:
case HTt_CLASS:
case HTt_INTERNAL_TYPE:
return tmph(CHashClass *)->size;
@ -53,7 +53,7 @@ I64 HashEntrySize2(CHashSrcSym *tmph)
-debug_info->body[0];
} else if (tmph->type&HTT_DEFINE_STR)
res+=MSize2(tmph(CHashDefineStr *)->data);
else if (tmph->type & HTT_GLBL_VAR) {
else if (tmph->type & HTT_GLOBAL_VAR) {
res+=LinkedListSize(tmph(CHashGlobalVar *)->dim.next);
if (!(tmph(CHashGlobalVar *)->flags&GVF_ALIAS))
res+=MSize2(tmph(CHashGlobalVar *)->data_addr);

View File

@ -39,7 +39,7 @@ CIntermediateStruct intermediate_code_table[IC_ICS_NUM]={
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"STR_CONST"},
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"ABS_ADDR"},
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"ADDR_IMPORT"},
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"HEAP_GLBL"},
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"HEAP_GLOBAL"},
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"SIZEOF"},
{IS_0_ARG,1,IST_NULL,FALSE,FALSE,0,0,0,"TYPE"},
{IS_0_ARG,1,IST_NULL,FALSE,TRUE,0,0,0,"GET_LABEL"},

View File

@ -59,19 +59,19 @@ CAOT *CompJoin(CCompCtrl *cc,I64 comp_flags,U8 *map_name=NULL,U8 mapfile_drive_l
MemCopy(htc,&cc->htc,sizeof(CLexHashTableContext));
if (cc->htc.fun)
cc->htc.glbl_hash_table=HashTableNew(128);
cc->htc.global_hash_table=HashTableNew(128);
else
cc->htc.glbl_hash_table=HashTableNew(1024);
cc->htc.global_hash_table=HashTableNew(1024);
if (cc->flags&CCF_AOT_COMPILE) {
cc->htc.define_hash_table=cc->htc.glbl_hash_table;
cc->htc.define_hash_table=cc->htc.global_hash_table;
if (cc->aot_depth<=1)
cc->htc.glbl_hash_table->next=cmp.asm_hash;
cc->htc.global_hash_table->next=cmp.asm_hash;
else
cc->htc.glbl_hash_table->next=htc->glbl_hash_table;
cc->htc.global_hash_table->next=htc->global_hash_table;
} else
cc->htc.glbl_hash_table->next=Fs->hash_table;
cc->htc.global_hash_table->next=Fs->hash_table;
cc->htc.hash_table_list=cc->htc.local_hash_table=HashTableNew(16);
cc->htc.local_hash_table->next=cc->htc.glbl_hash_table;
cc->htc.local_hash_table->next=cc->htc.global_hash_table;
cc->htc.local_var_list=cc->htc.fun; //CosmiC local vars
cc->htc.fun=NULL;
try {
@ -110,9 +110,9 @@ CAOT *CompJoin(CCompCtrl *cc,I64 comp_flags,U8 *map_name=NULL,U8 mapfile_drive_l
res=NULL;
} else {
if (map_name)
MapFileWrite(cc->htc.glbl_hash_table,map_name,mapfile_drive_let);
MapFileWrite(cc->htc.global_hash_table,map_name,mapfile_drive_let);
HashTableDel(cc->htc.local_hash_table);
HashTableDel(cc->htc.glbl_hash_table);
HashTableDel(cc->htc.global_hash_table);
if (!aotc->num_bin_U8s)
res->buf=NULL;
@ -141,7 +141,7 @@ CAOT *CompJoin(CCompCtrl *cc,I64 comp_flags,U8 *map_name=NULL,U8 mapfile_drive_l
}
LinkedListDel(aotc->bin);
res->abss=aotc->abss;
res->heap_glbls=aotc->heap_glbls;
res->heap_globals=aotc->heap_globals;
res->max_align_bits=aotc->max_align_bits;
res->org=aotc->org;
}
@ -240,7 +240,7 @@ U0 CompFixUpJITAsm(CCompCtrl *cc,CAOT *tmpaot)
else {
if (tmpex->type & HTT_FUN)
i=tmpex(CHashFun *)->exe_addr;
else if (tmpex->type & HTT_GLBL_VAR)
else if (tmpex->type & HTT_GLOBAL_VAR)
i=tmpex(CHashGlobalVar *)->data_addr;
else
i=tmpex->val;
@ -457,7 +457,7 @@ I64 Comp(U8 *filename,U8 *map_name=NULL,U8 *out_name=NULL,U8 mapfile_drive_let=0
tmpa=tmpa1;
}
}
tmphg=tmpaot->heap_glbls;
tmphg=tmpaot->heap_globals;
while (tmphg) {
tmphg1=tmphg->next;
count=0;

View File

@ -32,7 +32,7 @@ class CIntermediateStruct
#define IC_STR_CONST 0x0C
#define IC_ABS_ADDR 0x0D
#define IC_ADDR_IMPORT 0x0E
#define IC_HEAP_GLBL 0x0F
#define IC_HEAP_GLOBAL 0x0F
#define IC_SIZEOF 0x10
#define IC_TYPE 0x11
#define IC_GET_LABEL 0x12

View File

@ -37,7 +37,7 @@ CCompCtrl *CompCtrlNew(U8 *buf=NULL,I64 flags=0,U8 *filename=NULL)
cc->opts=1<<OPTf_WARN_UNUSED_VAR|1<<OPTf_WARN_HEADER_MISMATCH;
cc->htc.hash_mask=HTG_TYPE_MASK-HTT_IMPORT_SYS_SYM;
cc->htc.define_hash_table=cc->htc.hash_table_list=
cc->htc.glbl_hash_table=cc->htc.local_hash_table=Fs->hash_table;
cc->htc.global_hash_table=cc->htc.local_hash_table=Fs->hash_table;
if (flags&CCF_KEEP_AT_SIGN)
cc->char_bmp_alpha_numeric=char_bmp_alpha_numeric_no_at;
else
@ -1046,7 +1046,7 @@ lex_ifjit:
Free(fbuf);
tmph->type=HTT_HELP_FILE|HTF_PUBLIC;
HashSrcFileSet(cc,tmph);
HashAdd(tmph,cc->htc.glbl_hash_table);
HashAdd(tmph,cc->htc.global_hash_table);
break;
}
break;

View File

@ -1220,7 +1220,7 @@ args.
case IC_RETURN_VAL:
case IC_RETURN_VAL2:
case IC_ABS_ADDR:
case IC_HEAP_GLBL:
case IC_HEAP_GLOBAL:
case IC_ADDR_IMPORT:
case IC_GET_LABEL:
case IC_TYPE:

View File

@ -427,7 +427,7 @@ here1:
case IC_SET_RSP:
case IC_SET_RAX:
case IC_ABS_ADDR:
case IC_HEAP_GLBL:
case IC_HEAP_GLOBAL:
case IC_ADDR_IMPORT:
case IC_TYPE:
case IC_BT:

View File

@ -615,7 +615,7 @@ p4_sib:
case IC_XOR_XOR:
case IC_GET_LABEL:
case IC_ABS_ADDR:
case IC_HEAP_GLBL:
case IC_HEAP_GLOBAL:
case IC_ADDR_IMPORT:
case IC_BSF:
case IC_BSR:

View File

@ -108,7 +108,7 @@ cc->pass==10 is final pass, code is placed into buf.
tmpa->rip=rip2+tmpi->ic_count-8;
}
break;
case IC_HEAP_GLBL:
case IC_HEAP_GLOBAL:
ICU16(tmpi,0xB848);
ICU64(tmpi,0);
tmphg=tmpi->ic_data;

View File

@ -315,7 +315,7 @@ U0 ParseSizeOf(CCompCtrl *cc)
goto pu_sizeof_member;
} else {
if (!(tmpc=cc->hash_entry) || !(tmpc->type &
(HTT_CLASS|HTT_INTERNAL_TYPE|HTT_GLBL_VAR|
(HTT_CLASS|HTT_INTERNAL_TYPE|HTT_GLOBAL_VAR|
HTT_FUN|HTT_EXPORT_SYS_SYM)))
LexExcept(cc,"Invalid class at ");
if (tmpc->type&(HTT_FUN|HTT_EXPORT_SYS_SYM)) {
@ -328,9 +328,9 @@ U0 ParseSizeOf(CCompCtrl *cc)
i=tmpc->size;
while (Lex(cc)=='.') {
pu_sizeof_member:
if (!(tmpc->type & (HTT_CLASS|HTT_GLBL_VAR)))
if (!(tmpc->type & (HTT_CLASS|HTT_GLOBAL_VAR)))
LexExcept(cc,"Invalid class at ");
else if (tmpc->type & HTT_GLBL_VAR)
else if (tmpc->type & HTT_GLOBAL_VAR)
tmpc=tmpc(CHashGlobalVar *)->var_class;
if (Lex(cc)!=TK_IDENT || !(tmpm=MemberFind(cc->cur_str,tmpc)))
LexExcept(cc,"Invalid member at ");
@ -361,9 +361,9 @@ U0 ParseOffsetOf(CCompCtrl *cc)
tmpc=tmpm->member_class;
else {
tmpc=cc->hash_entry;
if (!tmpc || !(tmpc->type & (HTT_CLASS|HTT_GLBL_VAR)))
if (!tmpc || !(tmpc->type & (HTT_CLASS|HTT_GLOBAL_VAR)))
LexExcept(cc,"Invalid class at ");
else if (tmpc->type & HTT_GLBL_VAR)
else if (tmpc->type & HTT_GLOBAL_VAR)
tmpc=tmpc(CHashGlobalVar *)->var_class;
}
if (Lex(cc)!='.')
@ -776,7 +776,7 @@ I64 ParseUnaryTerm(CCompCtrl *cc,CParseStack *ps,CMemberList **_local_var,
if (tmpm->flags&MLF_STATIC) {
if (cc->flags&CCF_AOT_COMPILE) {
// if (tmpg->flags&GVF_DATA_HEAP) //TODO
// ICAdd(cc,IC_HEAP_GLBL,tmpm->static_data,tmpc);
// ICAdd(cc,IC_HEAP_GLOBAL,tmpm->static_data,tmpc);
// else
ICAdd(cc,IC_ABS_ADDR,tmpm->static_data_rip,tmpc);
} else
@ -822,9 +822,9 @@ pu_new_sys_sym:
} else {
tmpex->type=HTT_EXPORT_SYS_SYM | HTF_UNRESOLVED;
if (tmpc)
HashAddAfter(tmpex,tmpc,cc->htc.glbl_hash_table);
HashAddAfter(tmpex,tmpc,cc->htc.global_hash_table);
else
HashAdd(tmpex,cc->htc.glbl_hash_table);
HashAdd(tmpex,cc->htc.global_hash_table);
}
}
switch (Bsf(tmpex->type)) {
@ -864,7 +864,7 @@ pu_export_sys_sym:
*max_prec=PREC_TERM;
Lex(cc); //skip fun name
return ParseFunCall(cc,ps,FALSE,tmpex);
case HTt_GLBL_VAR:
case HTt_GLOBAL_VAR:
if (PREC_TERM>*max_prec)
*max_prec=PREC_TERM;
tmpg=tmpex;
@ -882,7 +882,7 @@ pu_export_sys_sym:
ICAdd(cc,IC_ADDR_IMPORT,tmpg,tmpc);
else {
if (tmpg->flags&GVF_DATA_HEAP)
ICAdd(cc,IC_HEAP_GLBL,tmpg->heap_glbl,tmpc);
ICAdd(cc,IC_HEAP_GLOBAL,tmpg->heap_global,tmpc);
else
ICAdd(cc,IC_ABS_ADDR,tmpg->data_addr_rip,tmpc);
}

View File

@ -7,15 +7,15 @@ CHashClass *ParseClass(CCompCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern)
tmpc=ParseClassNew;
tmpc->str=cc->cur_str;
cc->cur_str=NULL;
HashAdd(tmpc,cc->htc.glbl_hash_table);
HashAdd(tmpc,cc->htc.global_hash_table);
LBts(&tmpc->flags,Cf_EXTERN);
HashSrcFileSet(cc,tmpc);
Lex(cc);
} else {
if (cc->flags&CCF_AOT_COMPILE)
tmpc=HashFind(cc->cur_str,cc->htc.glbl_hash_table,HTT_CLASS);
tmpc=HashFind(cc->cur_str,cc->htc.global_hash_table,HTT_CLASS);
else
tmpc=HashSingleTableFind(cc->cur_str,cc->htc.glbl_hash_table,HTT_CLASS);
tmpc=HashSingleTableFind(cc->cur_str,cc->htc.global_hash_table,HTT_CLASS);
if (tmpc) {
if (!Bt(&tmpc->flags,Cf_EXTERN))
tmpc=NULL;
@ -31,7 +31,7 @@ CHashClass *ParseClass(CCompCtrl *cc,I64 keyword,I64 fsp_flags,Bool is_extern)
tmpc=ParseClassNew;
tmpc->str=cc->cur_str;
cc->cur_str=NULL;
HashAdd(tmpc,cc->htc.glbl_hash_table);
HashAdd(tmpc,cc->htc.global_hash_table);
}
LBtr(&tmpc->flags,Cf_EXTERN);
if (fsp_flags&FSF_PUBLIC)
@ -69,11 +69,11 @@ CHashFun *ParseFunJoin(CCompCtrl *cc,CHashClass *tmp_return,
I64 header_arg_count;
if (name) {//if not fun_ptr
if (cc->flags&CCF_AOT_COMPILE) {
if ((tmpf=HashFind(name,cc->htc.glbl_hash_table,HTT_FUN)) &&
if ((tmpf=HashFind(name,cc->htc.global_hash_table,HTT_FUN)) &&
tmpf->type & HTF_IMPORT)
tmpf=NULL;
} else
if ((tmpf=HashSingleTableFind(name,cc->htc.glbl_hash_table,HTT_FUN)) &&
if ((tmpf=HashSingleTableFind(name,cc->htc.global_hash_table,HTT_FUN)) &&
!Bt(&tmpf->flags,Cf_EXTERN))
tmpf=NULL;
if (tmpf && tmpf->use_count<3)
@ -105,7 +105,7 @@ CHashFun *ParseFunJoin(CCompCtrl *cc,CHashClass *tmp_return,
LBts(&tmpf->flags,Cf_EXTERN);
tmpf->flags|=fsp_flags&FSG_FUN_FLAGS1;
if (name) //if not fun_ptr
HashAdd(tmpf,cc->htc.glbl_hash_table);
HashAdd(tmpf,cc->htc.global_hash_table);
}
BEqual(&tmpf->type,HTf_PUBLIC,fsp_flags&FSF_PUBLIC);
tmpf->return_class=tmp_return;
@ -301,11 +301,11 @@ U0 ParseGlobalVarList(CCompCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
if (cc->flags&CCF_AOT_COMPILE) {
tmpg=CAlloc(sizeof(CHashGlobalVar));
tmpg->data_addr_rip=val;
tmpg->type=HTT_GLBL_VAR | HTF_EXPORT;
tmpg->type=HTT_GLOBAL_VAR | HTF_EXPORT;
} else {
tmpg=CAlloc(sizeof(CHashGlobalVar),Fs->code_heap);
tmpg->data_addr=val;
tmpg->type=HTT_GLBL_VAR;
tmpg->type=HTT_GLOBAL_VAR;
}
tmpg->flags|=GVF_ALIAS;
break;
@ -315,7 +315,7 @@ U0 ParseGlobalVarList(CCompCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
LexExcept(cc,"import not needed at ");
else {
tmpg=CAlloc(sizeof(CHashGlobalVar));
tmpg->type=HTT_GLBL_VAR | HTF_IMPORT;
tmpg->type=HTT_GLOBAL_VAR | HTF_IMPORT;
if (mode&255==PRS0__IMPORT)
tmpg->import_name=StrNew(val);
else
@ -325,26 +325,26 @@ U0 ParseGlobalVarList(CCompCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
case PRS0_EXTERN:
if (cc->flags&CCF_AOT_COMPILE) {
tmpg=CAlloc(sizeof(CHashGlobalVar));
tmpg->type=HTT_GLBL_VAR;
tmpg->type=HTT_GLOBAL_VAR;
} else {
tmpg=CAlloc(sizeof(CHashGlobalVar),Fs->code_heap);
tmpg->type=HTT_GLBL_VAR|HTF_UNRESOLVED;
tmpg->type=HTT_GLOBAL_VAR|HTF_UNRESOLVED;
}
break;
default:
if (cc->flags&CCF_AOT_COMPILE) {
if (Bt(&cc->opts,OPTf_GLBLS_ON_DATA_HEAP)) {
if (Bt(&cc->opts,OPTf_GLOBALS_ON_DATA_HEAP)) {
if (cc->token=='=')
LexExcept(cc,"Can't init glbl var on data heap in AOT module ");
LexExcept(cc,"Can't init global var on data heap in AOT module ");
tmpg=CAlloc(sizeof(CHashGlobalVar));
tmphg=tmpg->heap_glbl=CAlloc(sizeof(CAOTHeapGlobal));
tmphg=tmpg->heap_global=CAlloc(sizeof(CAOTHeapGlobal));
tmphg->size=j;
tmphg->str=StrNew(st);
tmphg->next=aotc->heap_glbls;
aotc->heap_glbls=tmphg;
tmphg->next=aotc->heap_globals;
aotc->heap_globals=tmphg;
tmpg->flags=GVF_DATA_HEAP;
tmpg->type=HTT_GLBL_VAR; //TODO: HTF_EXPORT
if (tmpex && tmpex->type & HTT_GLBL_VAR) //TODO!! extern
tmpg->type=HTT_GLOBAL_VAR; //TODO: HTF_EXPORT
if (tmpex && tmpex->type & HTT_GLOBAL_VAR) //TODO!! extern
LexExcept(cc,"Feature not implemented ");
} else {
tmpg=CAlloc(sizeof(CHashGlobalVar));
@ -360,14 +360,14 @@ U0 ParseGlobalVarList(CCompCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
while (aotc->rip&1)
AOTStoreCodeU8(cc,0);
tmpg->data_addr_rip=aotc->rip;
tmpg->type=HTT_GLBL_VAR | HTF_EXPORT;
if (tmpex && tmpex->type & HTT_GLBL_VAR)
tmpg->type=HTT_GLOBAL_VAR | HTF_EXPORT;
if (tmpex && tmpex->type & HTT_GLOBAL_VAR)
has_alias=TRUE;
for (k=0;k<j;k++)
AOTStoreCodeU8(cc,0); //Init AOT glbl to zero.
AOTStoreCodeU8(cc,0); //Init AOT global to zero.
}
} else {
if (Bt(&cc->opts,OPTf_GLBLS_ON_DATA_HEAP)) {
if (Bt(&cc->opts,OPTf_GLOBALS_ON_DATA_HEAP)) {
tmpg=CAlloc(sizeof(CHashGlobalVar),Fs->code_heap);
tmpg->data_addr=MAlloc(j);
tmpg->flags=GVF_DATA_HEAP;
@ -375,8 +375,8 @@ U0 ParseGlobalVarList(CCompCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
tmpg=CAlloc(sizeof(CHashGlobalVar),Fs->code_heap);
tmpg->data_addr=MAlloc(j,Fs->code_heap);
}
tmpg->type=HTT_GLBL_VAR;
if (tmpex && tmpex->type&HTT_GLBL_VAR &&
tmpg->type=HTT_GLOBAL_VAR;
if (tmpex && tmpex->type&HTT_GLOBAL_VAR &&
tmpex->type&HTF_UNRESOLVED &&
MHeapCtrl(tmpex)==MHeapCtrl(tmpg))
has_alias=TRUE;
@ -406,7 +406,7 @@ U0 ParseGlobalVarList(CCompCtrl *cc,I64 saved_mode,CHashClass *saved_tmpc,
}
if (is_array)
tmpg->flags|=GVF_ARRAY;
HashAdd(tmpg,cc->htc.glbl_hash_table);
HashAdd(tmpg,cc->htc.global_hash_table);
if (!(cc->flags&CCF_AOT_COMPILE) && !(tmpg->flags&GVF_EXTERN))
SysSymImportsResolve(tmpg->str);
if (cc->token=='=') {
@ -816,7 +816,7 @@ U0 ParseStreamBlk(CCompCtrl *cc)
cc->htc.next=htc;
cc->htc.fun=cc->htc.local_var_list=NULL;
cc->htc.define_hash_table=cc->htc.hash_table_list=
cc->htc.glbl_hash_table=cc->htc.local_hash_table=Fs->hash_table;
cc->htc.global_hash_table=cc->htc.local_hash_table=Fs->hash_table;
cc->flags=cc->flags & ~(CCF_ASM_EXPRESSIONS|CCF_AOT_COMPILE) | CCF_EXE_BLK;
if (cc->token=='{')
Lex(cc);

View File

@ -56,7 +56,7 @@ U0 ParseVarInit(CCompCtrl *cc,U8 **_dst,CHashClass *tmpc,CArrayDim *tmpad,
machine_code=LexExpression2Bin(cc,&type);
if (old_flags&CCF_AOT_COMPILE &&
cc->flags&CCF_NOT_CONST &&
!Bt(&cc->opts,OPTf_GLBLS_ON_DATA_HEAP)) {
!Bt(&cc->opts,OPTf_GLOBALS_ON_DATA_HEAP)) {
cc->flags=cc->flags&~CCF_NO_ABSS|CCF_AOT_COMPILE;
Free(machine_code);
if (pass==2) {
@ -208,7 +208,7 @@ U0 ParseGlobalInit(CCompCtrl *cc,CHashGlobalVar *tmpg,I64 pass)
U8 *dst=tmpg->data_addr;
ParseVarInit2(cc,&dst,tmpg->var_class,&tmpg->dim,
tmpg->data_addr_rip,&tmpg->data_addr,
Bt(&cc->opts,OPTf_GLBLS_ON_DATA_HEAP)||
Bt(&cc->opts,OPTf_GLOBALS_ON_DATA_HEAP)||
Bt(&cc->flags,CCf_AOT_COMPILE),pass);
}

View File

@ -71,7 +71,7 @@ $WW,1$$FG,5$$TX+CX,"TODO"$$FG$
* Make function as a better word processor. Justify text. Page numbers. Header and footer templates?
* Compiler Optimization: heap_glbls with added offset. Might exist.
* Compiler Optimization: heap_globals with added offset. Might exist.
* Bug: Find-and-replace text on $$PT$$ line before it.
* 12/25/2015 Copy-Paste index.html glitch if source window 40 columns.
@ -251,7 +251,7 @@ $ID,-5$
$FG,5$$TX+CX,"Committee Needed"$$FG$
* Make binary tree look-up using FUN_SEG symbol addresses, so we can eliminate fun_seg cache and wall-paper kludge? All CosmiC functions and glbl vars would have left-right for address search.
* Make binary tree look-up using FUN_SEG symbol addresses, so we can eliminate fun_seg cache and wall-paper kludge? All CosmiC functions and global vars would have left-right for address search.
* Should we get rid of drive mapping. It's ugly.
@ -422,7 +422,7 @@ and blotted at the end.
* static var off of data heap.
* could add "const" to not set CCF_NOT_CONST flag for trig, etc.
* could make glblvar imports use MDF_RIP_DISP32.
* could make globalvar imports use MDF_RIP_DISP32.
* PUSH_CMP allocs reg R9 or whatever
* Might be problem with NOP in OPT pass1 for NO_PUSH in expressions besides
assignments. Is ShiftNoPush fully implemented?

View File

@ -5,9 +5,9 @@ error, like when repeatedly #including
it from the cmd line.
*/
//This is to demo glbl var access.
//This is to demo global var access.
//Glbs defined elsewhere can accessed too, like counts.jiffies.
I64 glbl_ona=Freq2Ona(400),glbl_ona_step=10,glbl_ona_base=Freq2Ona(100);
I64 global_ona=Freq2Ona(400),global_ona_step=10,global_ona_base=Freq2Ona(100);
asm {
//Opcodes are slightly different to make writing my x86_64 assembler easier.
@ -29,7 +29,7 @@ _BEEPS2::
@@05: PUSH RCX
//U0 $LK,"Beep",A="MN:Beep"$(I8 ona=62,Bool busy=FALSE)
PUSH FALSE //Do not busy (spin) wait
PUSH U64 [&glbl_ona] //evaluated at run time
PUSH U64 [&global_ona] //evaluated at run time
CALL &Beep
POP RCX
LOOP @@05
@ -69,8 +69,8 @@ U0 AsmAndC2()
//U0 $LK,"Sound",A="MN:Sound"$(I8 ona);
MOV RAX,RCX //ona=loop*10+100.0Hz
IMUL2 RAX,glbl_ona_step //Intentionally evaluated at compile time
ADD RAX,U64 [&glbl_ona_base] //Intentionally evaluated at run time
IMUL2 RAX,global_ona_step //Intentionally evaluated at compile time
ADD RAX,U64 [&global_ona_base] //Intentionally evaluated at run time
PUSH RAX
CALL &Sound //We can skip IMPORT with & if JIT compiling.
MOV RCX,counts.time_stamp_freq>>3 //JIT Const. Simple delay loop.

View File

@ -1,4 +1,4 @@
F64 glbl;
F64 global;
F64 CompileDemo(U8 *st)
{
@ -26,7 +26,7 @@ F64 CompileDemo(U8 *st)
CompileDemo("2+Cos(ã)");
CompileDemo("1;2+4");
CompileDemo("glbl=1;glbl*2;glbl/3;Sin(glbl)");
CompileDemo("global=1;global*2;global/3;Sin(global)");
//This is just like you typed-it on
//the cmd line.

View File

@ -29,7 +29,7 @@ U0 Main1()
Main1;
/*Now, we'll use the data heap glbl option
/*Now, we'll use the data heap global option
to force global vars onto the data heap.
You can turn the data heap flag
@ -37,16 +37,16 @@ on and off within your programs, leaving
ones which need initialization on the code heap.
You can't dynamically initialize data heap
glbls--they are consts. This might be a silly
globals--they are consts. This might be a silly
point, but might res in odd differences, perhaps
from the order things are evaluated.
Data heap glbls are good for AOT modules
Data heap globals are good for AOT modules
because they don't take-up room in the .BIN file.
*/
#ifjit
#exe {Option(OPTf_GLBLS_ON_DATA_HEAP,ON);};
#exe {Option(OPTf_GLOBALS_ON_DATA_HEAP,ON);};
Test g2[]={
{10,"name1"},
@ -70,7 +70,7 @@ U0 Main2()
Main2;
#exe {Option(OPTf_GLBLS_ON_DATA_HEAP,ON);};
#exe {Option(OPTf_GLOBALS_ON_DATA_HEAP,ON);};
#endif
'\n';

View File

@ -1,4 +1,4 @@
I64 glbl_r[4][4];
I64 global_r[4][4];
U0 DrawIt(CTask *,CDC *dc)
{
@ -8,7 +8,7 @@ U0 DrawIt(CTask *,CDC *dc)
dc->x=200;
dc->y=200;
dc->flags|=DCF_TRANSFORMATION;
DCMat4x4Set(dc,glbl_r); //This assigns to dc->r and sets r_norm.
DCMat4x4Set(dc,global_r); //This assigns to dc->r and sets r_norm.
GrLine3(dc,-100,-100,-100, -100, 100,-100);
GrLine3(dc,-100, 100,-100, 100, 100,-100);
GrLine3(dc, 100, 100,-100, 100,-100,-100);
@ -31,11 +31,11 @@ U0 Box()
DocClear;
Fs->draw_it=&DrawIt;
while (!ScanChar) {
Mat4x4IdentEqu(glbl_r);
Mat4x4RotZ(glbl_r,é);
Mat4x4RotX(glbl_r,è);
Mat4x4RotZ(glbl_r,ê);
Mat4x4Scale(glbl_r,s);
Mat4x4IdentEqu(global_r);
Mat4x4RotZ(global_r,é);
Mat4x4RotX(global_r,è);
Mat4x4RotZ(global_r,ê);
Mat4x4Scale(global_r,s);
Sleep(20);
é+=2*ã/70;

Binary file not shown.

View File

@ -15,7 +15,7 @@
#define IC_STR_CONST 0x0D
#define IC_ABS_ADDR 0x0E
#define IC_ADDR_IMPORT 0x0F
#define IC_HEAP_GLBL 0x10
#define IC_HEAP_GLOBAL 0x10
#define IC_SIZEOF 0x11
#define IC_TYPE 0x12
#define IC_GET_LABEL 0x13

View File

@ -9,24 +9,24 @@ $LK,"U",A="MN:U"$() to see what code was generated.
#define COUNT 0x1000000
I64 glbl;
I64 global;
U0 MPUnlockedInc(I64)
{
I64 i;
for (i=0;i<COUNT;i++)
glbl++;
global++;
}
U0 UnlockedInc()
{
CJob *tmpm0,*tmpm1;
glbl=0;
global=0;
tmpm0=JobQueue(&MPUnlockedInc,NULL,0,0);
tmpm1=JobQueue(&MPUnlockedInc,NULL,1,0);
JobResGet(tmpm0);
JobResGet(tmpm1);
"Correct Count:%X Actual Count:%X\n",COUNT*2,glbl;
"Correct Count:%X Actual Count:%X\n",COUNT*2,global;
}
U0 MPLockedInc(I64)
@ -34,18 +34,18 @@ U0 MPLockedInc(I64)
I64 i;
for (i=0;i<COUNT;i++)
lock //Can be used without {}
glbl++;
global++;
}
U0 LockedInc()
{
CJob *tmpm0,*tmpm1;
glbl=0;
global=0;
tmpm0=JobQueue(&MPLockedInc,NULL,0,0);
tmpm1=JobQueue(&MPLockedInc,NULL,1,0);
JobResGet(tmpm0);
JobResGet(tmpm1);
"Correct Count:%X Actual Count:%X\n",COUNT*2,glbl;
"Correct Count:%X Actual Count:%X\n",COUNT*2,global;
}
UnlockedInc;

View File

@ -1,4 +1,7 @@
$WW,1$$FG,5$$TX+CX,"ChangeLog"$$FG$
$IV,1$----03/12/20 22:00:36----$IV,0$
* Remove shift-space, as we use tab indentation now. $LK,"S2T",A="MN:S2T"$() is still present if needed.
$IV,1$----02/23/20 23:59:37----$IV,0$
* Added new $LK,"bitmap mouse",A="MN:DrawStdMouse"$.

View File

@ -47,7 +47,7 @@ $ID,2$ZenithOS runs in $FG,2$High-res 32-bit color VBE$FG$ graphics modes, not t
$ID,-2$$TR,"Where is the kernel memory?"$
$ID,2$ZenithOS identity-maps all memory, all the time. It is like paging is not used. There is no special kernel $FG,2$high half$FG$ memory space. ZenithOS is ring-0-only, so everything is kernel, even user programs. There is a special task called $FG,2$Zenith$FG$ and he doesn't die, so his heap never gets freed. That's as close to $FG,2$kernel memory$FG$ as it gets. All code goes in the lowest 2Gig of addresses, known as the $LK,"Code Heap",A="FF:::/Doc/Glossary.DD,Code and Data Heaps"$, so that the $FG,2$REL32$FG$ addressing mode can be used. See $LK,"MemoryOverview",A="FI:::/Doc/MemoryOverview.DD"$.
$ID,-2$$TR,"Why does it run code from stack addresses?"$
$ID,2$ZenithOS puts all code in the lowest 2Gig, known as the $LK,"Code Heap",A="FF:::/Doc/Glossary.DD,Code and Data Heaps"$, so that the $FG,2$REL32$FG$ addressing mode can be used. ZenithOS is 64-bit, but $FG,2$2Gig$FG$ is enough for code. It actually puts global variables there, too, but you can turn that off with $LK,"OPTf_GLBLS_ON_DATA_HEAP",A="MN:OPTf_GLBLS_ON_DATA_HEAP"$. $LK,"MAlloc",A="MN:MAlloc"$() allocs higher memory.
$ID,2$ZenithOS puts all code in the lowest 2Gig, known as the $LK,"Code Heap",A="FF:::/Doc/Glossary.DD,Code and Data Heaps"$, so that the $FG,2$REL32$FG$ addressing mode can be used. ZenithOS is 64-bit, but $FG,2$2Gig$FG$ is enough for code. It actually puts global variables there, too, but you can turn that off with $LK,"OPTf_GLOBALS_ON_DATA_HEAP",A="MN:OPTf_GLOBALS_ON_DATA_HEAP"$. $LK,"MAlloc",A="MN:MAlloc"$() allocs higher memory.
$ID,-2$$TR,"How does it SYSCALL?"$
$ID,2$ZenithOS doesn't use software interrupts or $FG,2$SYSCALL$FG$ insts because it never needs to change out of ring-0, even running user programs. Calls are always $FG,2$CALL REL32$FG$ insts.
$ID,-2$$TR,"How do you fault-in stack?"$

View File

@ -151,7 +151,7 @@ $ID,2$This is Zenith, as in the $MA-X+PU,"most important task",LM="ACDDefsPut(Do
$ID,-2$$TR,"Daemon Tasks"$
$ID,2$Each CPU core has an executive task called $FG,2$Daemon$FG$ that is immortal. The Zenith task on $FG,2$Core0$FG$ is also its $FG,2$Daemon$FG$ task.
$ID,-2$$TR,"Code and Data Heaps"$
$ID,2$ZenithOS uses the asm $FG,2$CALL$FG$ inst, exclusively, and that inst is limited to calling routines $FG,2$+/-2Gig$FG$ from the current code location. To prevent out-of-range issues, I decided to separate code and data, placing all code within the lowest $FG,2$2Gig$FG$ of memory, addresses $FG,2$00000000$FG$-$FG,2$7FFFFFFF$FG$. The compiler and $LK,"Load",A="MN:Load"$()er alloc memory from the code heap to store code and glbl vars, unless the compiler option $LK,"OPTf_GLBLS_ON_DATA_HEAP",A="MN:OPTf_GLBLS_ON_DATA_HEAP"$ is used. When programs call $LK,"MAlloc",A="MN:MAlloc"$() is from the data heap, which in not limited in size, except by physical RAM memory. You can alloc from any heap in any task at any time on any core, even making $LK,"independent",A="MN:MemPagAlloc"$ heaps.
$ID,2$ZenithOS uses the asm $FG,2$CALL$FG$ inst, exclusively, and that inst is limited to calling routines $FG,2$+/-2Gig$FG$ from the current code location. To prevent out-of-range issues, I decided to separate code and data, placing all code within the lowest $FG,2$2Gig$FG$ of memory, addresses $FG,2$00000000$FG$-$FG,2$7FFFFFFF$FG$. The compiler and $LK,"Load",A="MN:Load"$()er alloc memory from the code heap to store code and global vars, unless the compiler option $LK,"OPTf_GLOBALS_ON_DATA_HEAP",A="MN:OPTf_GLOBALS_ON_DATA_HEAP"$ is used. When programs call $LK,"MAlloc",A="MN:MAlloc"$() is from the data heap, which in not limited in size, except by physical RAM memory. You can alloc from any heap in any task at any time on any core, even making $LK,"independent",A="MN:MemPagAlloc"$ heaps.
$ID,-2$$TR,"Parent, Child and PopUp Tasks"$
$ID,2$Often a task will $LK,"Spawn",A="MN:Spawn"$() or $LK,"PopUp",A="MN:PopUp"$() a task as a helper. The helper is known as a child Task, though you can $LK,"Spawn",A="MN:Spawn"$ a task and assign it a different parent... like $FG,2$Zenith$FG$. Links are kept as to who's whose child, so when one task is $LK,"Kill",A="MN:Kill"$()ed the child helper tasks die, too. You can get a report of current system tasks with $LK,"TaskRep",A="MN:TaskRep"$(). There is just one window per task, so child tasks are needed for pop-ups.
$ID,-2$$TR,"CosmiC"$
@ -242,7 +242,7 @@ $FG,5$MixedCaps$FG$
$LK,"CosmiC",A="FI:::/Doc/CosmiC.DD"$ Functions and class names are MixedCaps.
$FG,5$lower_case$FG$
Local function vars and glbl vars are lower case. Class member names are also lower_case.
Local function vars and global vars are lower case. Class member names are also lower_case.
$FG,5$_lower_case$FG$
Function args which are outputs (passed as ptrs) have leading underscores. Also, args which have idently named local variable counterparts have leading underscores.

View File

@ -2,7 +2,7 @@ $WW,1$$FG,5$$TX+CX,"Compiler Options"$$FG$
Use $LK,"Option",A="MN:Option"$(). You might need to do $FG,2$#exe {Option();}$FG$.
$LK,"OPTf_GLBLS_ON_DATA_HEAP",A="MN:OPTf_GLBLS_ON_DATA_HEAP"$ without this option, global vars are placed in the code heap which is limited to 2Gig. In $FG,2$AOT$FG$ modules, global vars take-up room in the $FG,2$.BIN$FG$ file, so you might want to use this option, instead. You might wish to turn it on and off around specific vars. A disadvantage of data heap global vars in $FG,2$AOT$FG$ modules is they can't be initialized.
$LK,"OPTf_GLOBALS_ON_DATA_HEAP",A="MN:OPTf_GLOBALS_ON_DATA_HEAP"$ without this option, global vars are placed in the code heap which is limited to 2Gig. In $FG,2$AOT$FG$ modules, global vars take-up room in the $FG,2$.BIN$FG$ file, so you might want to use this option, instead. You might wish to turn it on and off around specific vars. A disadvantage of data heap global vars in $FG,2$AOT$FG$ modules is they can't be initialized.
$LK,"OPTf_EXTERNS_TO_IMPORTS",A="MN:OPTf_EXTERNS_TO_IMPORTS"$ and $LK,"OPTf_KEEP_PRIVATE",A="MN:OPTf_KEEP_PRIVATE"$ are strange options, you'll never need. They're to allow the same header file for $FG,2$Kernel$FG$ to act as $FG,2$extern$FG$s when compiling itself and $FG,2$import$FG$s when compiled by $FG,2$AOT$FG$ modules.

View File

@ -4,14 +4,14 @@ $LK,"JIT Compile Mode",A="FF:::/Doc/Glossary.DD,JIT Compile Mode"$ makes use of
When a sym is placed into a table, older syms with ident names will be overshadowed if they exist. Duplicates are not allowed in many cases, especially in asm blks. Dupicates are allowed, by design in other cases, so that you can repeatedly $FG,2$#include$FG$ the same file from the cmd line while developing it. Or, so you can repeatedly declare a function with a standard name, like $FG,2$DrawIt()$FG$. This case might occur when the $LK,"Zenith Task",A="FF:::/Doc/Glossary.DD,Zenith Task"$$FG$ is starting-up loading-in many little utilities.
$FG,2$extern$FG$ binds a new $LK,"HTT_FUN",A="MN:HTT_FUN"$ or $LK,"HTT_GLBL_VAR",A="MN:HTT_GLBL_VAR"$ sym to an existing sym of the same name if it exists in the sym table (just in just-in-time code). It also can be used to generate a forward reference.
$FG,2$extern$FG$ binds a new $LK,"HTT_FUN",A="MN:HTT_FUN"$ or $LK,"HTT_GLOBAL_VAR",A="MN:HTT_GLOBAL_VAR"$ sym to an existing sym of the same name if it exists in the sym table (just in just-in-time code). It also can be used to generate a forward reference.
$FG,2$import$FG$ binds a new $LK,"HTT_FUN",A="MN:HTT_FUN"$ or $LK,"HTT_GLBL_VAR",A="MN:HTT_GLBL_VAR"$ sym to a sym of the same name imported from the task's sym table at $LK,"Load",A="MN:Load"$() time. If no sym exists to bind to at $LK,"Load",A="MN:Load"$() time, the code using this sym will be left incomplete until the sym is defined.
$FG,2$import$FG$ binds a new $LK,"HTT_FUN",A="MN:HTT_FUN"$ or $LK,"HTT_GLOBAL_VAR",A="MN:HTT_GLOBAL_VAR"$ sym to a sym of the same name imported from the task's sym table at $LK,"Load",A="MN:Load"$() time. If no sym exists to bind to at $LK,"Load",A="MN:Load"$() time, the code using this sym will be left incomplete until the sym is defined.
$WW,1$
$FG,2$_extern$FG$ binds a new $LK,"HTT_FUN",A="MN:HTT_FUN"$ or $LK,"HTT_GLBL_VAR",A="MN:HTT_GLBL_VAR"$ sym to an existing sym, of a $BK,1$different$BK,0$ name. It must exists in the sym table. Basically, this binds C to asm.
$FG,2$_extern$FG$ binds a new $LK,"HTT_FUN",A="MN:HTT_FUN"$ or $LK,"HTT_GLOBAL_VAR",A="MN:HTT_GLOBAL_VAR"$ sym to an existing sym, of a $BK,1$different$BK,0$ name. It must exists in the sym table. Basically, this binds C to asm.
$FG,2$_import$FG$ binds a new $LK,"HTT_FUN",A="MN:HTT_FUN"$ or $LK,"HTT_GLBL_VAR",A="MN:HTT_GLBL_VAR"$ sym to a sym, of a $BK,1$different$BK,0$ name imported from the task's sym table at $LK,"Load",A="MN:Load"$() time. If no sym exists to bind to at $LK,"Load",A="MN:Load"$() time, the code using this sym will be left incomplete until the sym is defined. Basically, this binds C to asm from elsewhere.
$FG,2$_import$FG$ binds a new $LK,"HTT_FUN",A="MN:HTT_FUN"$ or $LK,"HTT_GLOBAL_VAR",A="MN:HTT_GLOBAL_VAR"$ sym to a sym, of a $BK,1$different$BK,0$ name imported from the task's sym table at $LK,"Load",A="MN:Load"$() time. If no sym exists to bind to at $LK,"Load",A="MN:Load"$() time, the code using this sym will be left incomplete until the sym is defined. Basically, this binds C to asm from elsewhere.
$WW,0$$FG,5$Ahead of Time Compilation$FG$
@ -99,7 +99,7 @@ $WW,1$
* Local non-reg function vars can be accessed in asm blks with $FG,2$&i[RBP]$FG$ for example.
* Global vars and functions can be accessed in asm with and $FG,2$&$FG$ as in
$FG,2$MOV RAX,I64 [&glbl_var]
$FG,2$MOV RAX,I64 [&global_var]
CALL I32 &Fun
CALL I32 &SYS_SYM$FG$
@ -115,6 +115,6 @@ $WW,1$
* An unused gap on the stack is left for $FG,2$reg$FG$ vars.
* Note: $FG,2$static$FG$ function vars do not go on the data heap, no matter the setting of the $LK,"OPTf_GLBLS_ON_DATA_HEAP",A="MN:OPTf_GLBLS_ON_DATA_HEAP"$$FG$. They may in the future.
* Note: $FG,2$static$FG$ function vars do not go on the data heap, no matter the setting of the $LK,"OPTf_GLOBALS_ON_DATA_HEAP",A="MN:OPTf_GLOBALS_ON_DATA_HEAP"$$FG$. They may in the future.
* $LK,"OPTf_EXTERNS_TO_IMPORTS",A="MN:OPTf_EXTERNS_TO_IMPORTS"$ will treat $FG,2$_extern$FG$ as $FG,2$_import$FG$ and $FG,2$extern$FG$ as $FG,2$import$FG$. This allows a header to be used either as a $FG,2$JIT compiled$FG$ or $FG,2$AOT compiled$FG$ header.

View File

@ -45,8 +45,6 @@ $FG,2$Merge(\"C:/*\",\"D:/*\",\"+r+d\");$FG$ to check my changes.
* If, for some strange reason, you wanted to reduce mem usage, make a smaller disk cache when you recompile the kernel; disabling $FG,2$AutoComplete$FG$; Specify smaller stack sizes when doing $LK,"Spawn",A="MN:Spawn"$(), change $LK,"MEM_DEFAULT_STACK",A="MN:MEM_DEFAULT_STACK"$, and using $LK,"DocMax",A="MN:DocMax"$() to reduce the cmd line buffer size.
* Filenames ending in "$FG,2$$FG$" will be automatically compressed and uncompressed when read or written. The compression method is not supported by other operating systems. You can store files uncompressed by $LK,"Move",A="MN:Move"$()ing them to a filename not ending in "$FG,2$$FG$". See $LK,"::/Doc/TOSZ.DD"$ if you want to uncompress while in $FG,2$Linux$FG$.
* $LK,"Merge",A="MN:Merge"$() can be used to see what's changed. The $FG,2$+d$FG$ flag will show differences of files which have changed and allow you to merge code. (The $FG,2$+r$FG$ flag will recurse.)
* There is a utility $LK,"LinkCheck",A="MN:LinkCheck"$() which will check for broken links in documentation.

View File

@ -77,9 +77,9 @@ Tasks have no priority and are never removed from the queue. Instead, they often
The $FG,2$FAT32$FG$ filesystem is supported to makes exchanging files with a dual booted other operating system easy and there is the simple, 64-bit ZenithOS $LK,"RedSea",A="FI:::/Doc/RedSea.DD"$ filesystem. The $LK,"RedSea",A="FI:::/Doc/RedSea.DD"$ has allocation bitmap for clus and all files are stored contiguously. You can't grow files.
ZenithOS is geared toward reading and writing whole files. Since whole files are processed, compression is possible. Filenames ending in "$FG,2$$FG$" are automatically compressed or uncompressed when stored and fetched. ZenithOS does support direct block random access into files, however -- $LK,"FBlkRead",A="MN:FBlkRead"$() and $LK,"FBlkWrite",A="MN:FBlkWrite"$().
ZenithOS is geared toward reading and writing whole files. There is support for direct block random access into files, however -- $LK,"FBlkRead",A="MN:FBlkRead"$() and $LK,"FBlkWrite",A="MN:FBlkWrite"$().
If a file is not found, "$FG,2$$FG$" is added or removed and a search is done, again. There is no $FG,2$PATH$FG$, but parent directories are searched when a file is not found. This feature is especially useful for default account files.
There is no $FG,2$PATH$FG$, but parent directories are searched when a file is not found. This feature is especially useful for default account files.
The graphic resolution is poor, $FG,2$640x480 16 color$FG$, but God said it was a covenant like circumcision. Also, that's all I feel comfortable with without GPU acceleration supported. A $FG,2$1600x1200x24$FG$ bit screen takes 37 times more memory, implying 37 times the CPU power. Also, a fixed size keeps it simple with everybody machine having the same appearance. Look on the bright-side -- you won't spend as much time twiddling pixels for your game art and you'll have tons of CPU power available, especially with multicore systems.

View File

@ -1,8 +1,10 @@
In("CC\n\n1\n\n5\n\n\n");
Ed("/Doc/ChangeLog.DD");
In("CC\n\n1\n\n6\n\n\n");
BootHDIns;
"\n\nSuccessful? ";
if(YorN)
{
Once("CursorRemove(\"/*\");;;#include \"DoDistro\";;if(DriveIsWritable){Del(\"~/Registry.CC\");OutU16(0x4004, 0x3400);}");
Reboot;
BootRAM;
}

View File

@ -61,7 +61,7 @@ U0 KConfigOptions(CKConfig *c)
"$$PURPLE$$MemInit$$FG$$ Initializes memory above 0x100000 "
"to a val at boot.\n"
"$$PURPLE$$HeapInit$$FG$$ Initializes MAlloc() memory to a val.\n"
"$$PURPLE$$VarInit$$FG$$ Initializes glbl var memory to a val.\n"
"$$PURPLE$$VarInit$$FG$$ Initializes global var memory to a val.\n"
"$$PURPLE$$HomeDir$$FG$$ Set home dir.\n"
"$$PURPLE$$NoMP$$FG$$ No multicore.\n"
"$$PURPLE$$DontProbe$$FG$$ Just prompt CD/DVD ports, don't probe.\n"

View File

@ -1,5 +1,5 @@
//Compiler initializes glbls in AOT bin modules to zero.
//$LK,"Globals Set to Zero Here",A="FF:::/Compiler/ParseStatement.CC,Init AOT glbl to zero"$.
//Compiler initializes globals in AOT bin modules to zero.
//$LK,"Globals Set to Zero Here",A="FF:::/Compiler/ParseStatement.CC,Init AOT global to zero"$.
CJob sys_macro_head;
CTask *sys_macro_task;

View File

@ -20,7 +20,7 @@ I64 HashVal(CHash *tmph)
case HTt_OPCODE:
case HTt_HELP_FILE:
return tmph;
case HTt_GLBL_VAR:
case HTt_GLOBAL_VAR:
if (tmph(CHashGlobalVar *)->flags&GVF_EXTERN)
return &tmph(CHashGlobalVar *)->data_addr;
else
@ -73,7 +73,7 @@ U0 HashDel(CHashSrcSym *tmph)
ClassMemberListDel(tmph);
else if (tmph->type&HTT_DEFINE_STR)
Free(tmph(CHashDefineStr *)->data);
else if (tmph->type & HTT_GLBL_VAR) {
else if (tmph->type & HTT_GLOBAL_VAR) {
if (!(tmph(CHashGlobalVar *)->flags&GVF_ALIAS))
Free(tmph(CHashGlobalVar *)->data_addr);
LinkedListDel(tmph(CHashGlobalVar *)->dim.next);
@ -114,7 +114,7 @@ I64 HashTablePurge(CHashTable *table)
tmph=table->body[i];
while (tmph) {
tmph1=tmph->next; //We delete only older ones
if (tmph->type&(HTT_FUN|HTT_GLBL_VAR)) {
if (tmph->type&(HTT_FUN|HTT_GLOBAL_VAR)) {
tmph2=tmph->next; //Older always later in chain
while (tmph2) {
if ((tmph2->type&HTT_EXPORT_SYS_SYM ||

View File

@ -33,7 +33,7 @@ U0 LoadOneImport(U8 **_src,U8 *module_base,I64 ld_flags)
ptr2=module_base+i;
if (tmpex->type & HTT_FUN)
i=tmpex(CHashFun *)->exe_addr;
else if (tmpex->type & HTT_GLBL_VAR)
else if (tmpex->type & HTT_GLOBAL_VAR)
i=tmpex(CHashGlobalVar *)->data_addr;
else
i=tmpex->val;

View File

@ -134,7 +134,7 @@ argpop I64 CallStackGrow(I64 stack_size_threshold,I64 stack_size,
_stack=&Fs->stack;
tmps->stack_ptr=rsp=GetRSP;
asm {
IMPORT _FREE; //We are in a function, not at glbl scope.
IMPORT _FREE; //We are in a function, not at global scope.
//The compiler treats these in isolation.
PUSHFD

View File

@ -778,7 +778,7 @@ public class CHashTable
#define HTt_EXPORT_SYS_SYM 0
#define HTt_IMPORT_SYS_SYM 1
#define HTt_DEFINE_STR 2
#define HTt_GLBL_VAR 3
#define HTt_GLOBAL_VAR 3
#define HTt_CLASS 4
#define HTt_INTERNAL_TYPE 5
#define HTt_FUN 6
@ -808,7 +808,7 @@ public class CHashTable
#define HTT_EXPORT_SYS_SYM 0x00001 //CHashExport
#define HTT_IMPORT_SYS_SYM 0x00002 //CHashImport
#define HTT_DEFINE_STR 0x00004 //CHashDefineStr
#define HTT_GLBL_VAR 0x00008 //CHashGlobalVar
#define HTT_GLOBAL_VAR 0x00008 //CHashGlobalVar
#define HTT_CLASS 0x00010 //CHashClass
#define HTT_INTERNAL_TYPE 0x00020 //CHashClass
#define HTT_FUN 0x00040 //CHashFun
@ -835,7 +835,7 @@ public class CHashTable
#define HTF_LOCAL 0x80000000
#define HTG_FLAGS_MASK 0xFF000000
#define HTG_SRC_SYM (HTT_DEFINE_STR|HTT_GLBL_VAR|HTT_FUN|HTT_CLASS|\
#define HTG_SRC_SYM (HTT_DEFINE_STR|HTT_GLOBAL_VAR|HTT_FUN|HTT_CLASS|\
HTT_EXPORT_SYS_SYM|HTT_HELP_FILE)
#define HTG_ALL -1
@ -1005,7 +1005,7 @@ public class CHashGlobalVar:CHashSrcSym
U8 *data_addr;
union {
I64 data_addr_rip;
CAOTHeapGlobal *heap_glbl;
CAOTHeapGlobal *heap_global;
}
};
#assert offset(CHashClass.size)==offset(CHashGlobalVar.size)
@ -1270,7 +1270,7 @@ public class CDocBin
#define DOC_COLOR_CHAR_CONST BROWN
#define DOC_COLOR_EXPORT_SYS_SYM LTPURPLE
#define DOC_COLOR_DEFINE_STR CYAN
#define DOC_COLOR_GLBL_VAR LTCYAN
#define DOC_COLOR_GLOBAL_VAR LTCYAN
#define DOC_COLOR_CLASS LTBLUE
#define DOC_COLOR_FUN PURPLE
#define DOC_COLOR_KEYWORD BLUE
@ -1676,7 +1676,7 @@ public class CAutoCompleteDictGlobals
#define OPTf_EXTERNS_TO_IMPORTS 0x20
#define OPTf_KEEP_PRIVATE 0x21
#define OPTf_NO_REG_VAR 0x22 //Applied to funs, not statements
#define OPTf_GLBLS_ON_DATA_HEAP 0x23
#define OPTf_GLOBALS_ON_DATA_HEAP 0x23
//Disable 10-byte float consts for ã,log2_10,log10_2,loge_2
#define OPTf_NO_BUILTIN_CONST 0x24 //Applied to funs, not statements
#define OPTf_USE_IMM64 0x25 //Not completely implemented
@ -1954,7 +1954,7 @@ class CAsmNum
{
I64 i;
U8 *machine_code;
CAsmUndefHash *local_asm_undef_hash,*glbl_asm_undef_hash;
CAsmUndefHash *local_asm_undef_hash,*global_asm_undef_hash;
CAbsCountsI64 abs_counts;
};
@ -1994,10 +1994,10 @@ class CAsmUnresolvedRef
U8 *machine_code;
I64 rip,rel_rip;
CAOT *aot;
U8 *str; //Only for import glbls
U8 *str; //Only for import globals
CAsmUndefHash *asm_undef_hash;
Bool U8_avail,
imm_flag;//Only for import glbls
imm_flag;//Only for import globals
};
//Opcode Modifier
@ -2139,7 +2139,7 @@ class CAOT
CAOT *parent_aot;
CAOTImportExport *next_ie,*last_ie;
CAOTAbsAddr *abss;
CAOTHeapGlobal *heap_glbls;
CAOTHeapGlobal *heap_globals;
};
class CStreamBlk
@ -2189,9 +2189,9 @@ class CAOTCtrl
CAOTBinBlk *bin;
I64 num_bin_U8s,
max_align_bits,org;
CAsmUnresolvedRef *local_unresolved,*glbl_unresolved;
CAsmUnresolvedRef *local_unresolved,*global_unresolved;
CAOTAbsAddr *abss;
CAOTHeapGlobal *heap_glbls;
CAOTHeapGlobal *heap_globals;
I64 list_col,list_last_rip;
U8 *last_label,*list_last_line;
CLexFile *list_last_lfn;
@ -2254,7 +2254,7 @@ class CLexHashTableContext
CHashTable *hash_table_list,
*define_hash_table,
*local_hash_table,
*glbl_hash_table;
*global_hash_table;
};
//CompCtrl flags

View File

@ -9,7 +9,7 @@ class CTemplateCS
{
CTemplateCSSlider *next_slider,*last_slider;
I64 num_sliders,range,spacing,border;
U8 *glbl_name;
U8 *global_name;
};
CTemplateCS *CtrlSliderGet()
@ -20,7 +20,7 @@ CTemplateCS *CtrlSliderGet()
"$$PURPLE$$Ctrl Slider$$FG$$\n\n";
res->glbl_name=GetStr("Global Struct Name (ENTER for No Global):");
res->global_name=GetStr("Global Struct Name (ENTER for No Global):");
res->range=GetI64 ("Range (%4d):",30);
res->spacing=GetI64("Spacing (%4d):",20);
res->border=GetI64 ("Border (%4d):",2);
@ -70,8 +70,8 @@ class CSliderState
DocPrint(doc," I64 %s;\n",tmps->name);
tmps=tmps->next;
}
if (*m->glbl_name)
DocPrint(doc,"} %s;\n",m->glbl_name);
if (*m->global_name)
DocPrint(doc,"} %s;\n",m->global_name);
else
DocPrint(doc,"};\n");
@ -179,9 +179,9 @@ CCtrl *SliderNew()
c->flags=CTRLF_SHOW|CTRLF_CAPTURE_LEFT_MS;
c->type=CTRLT_GENERIC;
");
if (*m->glbl_name)
if (*m->global_name)
DocPrint(doc," c->state=&%s;\n"
" MemSet(&%s,0,sizeof(CSliderState));\n",m->glbl_name,m->glbl_name);
" MemSet(&%s,0,sizeof(CSliderState));\n",m->global_name,m->global_name);
else
DocPrint(doc, " c->state=CAlloc(sizeof(CSliderState));\n");
DocPrint(doc,
@ -197,7 +197,7 @@ U0 SliderDel(CCtrl *c)
{
QueueRemove(c);
");
if (!*m->glbl_name)
if (!*m->global_name)
DocPrint(doc," Free(c->state);\n");
DocPrint(doc,
" Free(c);

View File

@ -1,7 +1,7 @@
#help_index "DolDoc/Misc"
CColorROPU32 highlight_hash_type_colors[HTt_TYPES_NUM]=
DOC_COLOR_EXPORT_SYS_SYM,0,DOC_COLOR_DEFINE_STR,DOC_COLOR_GLBL_VAR,
DOC_COLOR_EXPORT_SYS_SYM,0,DOC_COLOR_DEFINE_STR,DOC_COLOR_GLOBAL_VAR,
DOC_COLOR_CLASS,DOC_COLOR_KEYWORD,DOC_COLOR_FUN,0,0,DOC_COLOR_KEYWORD,
DOC_COLOR_KEYWORD,DOC_COLOR_KEYWORD,DOC_COLOR_REG,0,0,0,0};
@ -115,7 +115,7 @@ hl_normal:
ch=*src;
*src=0;
if (tmph=HashFind(ptr,zenith_task->hash_table,
HTT_EXPORT_SYS_SYM|HTT_DEFINE_STR|HTT_GLBL_VAR|HTT_CLASS|
HTT_EXPORT_SYS_SYM|HTT_DEFINE_STR|HTT_GLOBAL_VAR|HTT_CLASS|
HTT_INTERNAL_TYPE|HTT_FUN|HTT_KEYWORD|HTT_ASM_KEYWORD|
HTT_OPCODE|HTT_REG))
tmp_u32_attr=highlight_hash_type_colors[HashTypeNum(tmph)]<<8|

View File

@ -272,7 +272,7 @@ U8 *idx=NULL,CDoc *doc=NULL)
StrPrint(buf,"%-10t$$Q ",ptr(CHashDefineStr *)->data);
else
StrPrint(buf,"%-10t$$Q %02X",ptr(CHashDefineStr *)->data,j);
} else if (ptr->type & HTT_GLBL_VAR)
} else if (ptr->type & HTT_GLOBAL_VAR)
StrPrint(buf,"%010X ",ptr(CHashGlobalVar *)->data_addr);
else
StrPrint(buf,"%010X ",HashVal(ptr));