@@ -446,7 +446,7 @@ void avltr_delete(const int key)
446446 pthread_mutex_unlock (& trees_mtx );
447447 leavedos_main (0x8130 );
448448 }
449- if (G -> mblock ) dlfree (G -> mblock );
449+ if (G -> addr ) dlfree (G -> addr );
450450 __atomic_store_n (& findtree_cache [G -> key & FINDTREE_CACHE_HASH_MASK ],
451451 NULL , __ATOMIC_RELAXED );
452452 free (G );
@@ -636,7 +636,7 @@ void avltr_destroy(void)
636636 B = B -> next ;
637637 free (B2 );
638638 }
639- if (p -> data -> mblock ) dlfree (p -> data -> mblock );
639+ if (p -> data -> addr ) dlfree (p -> data -> addr );
640640 free (p -> data );
641641 p -> data = NULL ;
642642 }
@@ -670,7 +670,7 @@ unsigned int FindPC(const unsigned char *addr)
670670 G = FindTree (LONG_CS + TheCPU .eip );
671671 if (!G )
672672 return 0 ;
673- AP = G -> pmeta ;
673+ AP = G -> meta ;
674674 for (i = 0 ; i < G -> seqnum + 1 ; i ++ ) {
675675 e_printf (" %08x:%p" ,(G -> key + AP -> dnpc ),G -> addr + AP -> daddr );
676676 if (addr < G -> addr + AP -> daddr ) break ;
@@ -1030,8 +1030,8 @@ static void DumpTree (FILE *fd)
10301030 nn ++ ;
10311031 continue ;
10321032 }
1033- fprintf (fd ,"%04d Node %p at %08x..%08x mblock =%p flags=%#x\n" ,
1034- nn ,G ,G -> key ,(G -> key + G -> seqlen - 1 ),G -> mblock ,G -> flags );
1033+ fprintf (fd ,"%04d Node %p at %08x..%08x addr =%p flags=%#x\n" ,
1034+ nn ,G ,G -> key ,(G -> key + G -> seqlen - 1 ),G -> addr ,G -> flags );
10351035 fprintf (fd ," AVL (%p:%p),%d,%d,%d,%d\n" ,G -> link [0 ],G -> link [1 ],
10361036 G -> bal ,G -> cache ,G -> pad ,G -> rtag );
10371037 fprintf (fd ," source: instr=%d, len=%#x\n" ,G -> seqnum ,G -> seqlen );
@@ -1054,10 +1054,10 @@ static void DumpTree (FILE *fd)
10541054 B = B -> next ;
10551055 }
10561056 }
1057- if (G -> addr && G -> pmeta ) {
1057+ if (G -> addr ) {
10581058 int i , j , k ;
10591059 unsigned char * p = G -> addr ;
1060- Addr2Pc * AP = G -> pmeta ;
1060+ Addr2Pc * AP = G -> meta ;
10611061 for (i = 0 ; i < G -> seqnum ; i ++ ) {
10621062 fprintf (fd ," %08x:%p" ,(G -> key + AP -> dnpc ),G -> addr + AP -> daddr );
10631063 k = 0 ;
@@ -1148,7 +1148,7 @@ static int TraverseAndClean(void)
11481148 * code addresses. At the end, we reset both CodeBuf and InstrMeta to prepare
11491149 * for a new sequence.
11501150 */
1151- TNode * Move2Tree (IMeta * I0 , CodeBuf * GenCodeBuf )
1151+ TNode * Move2Tree (IMeta * I0 , unsigned char * GenCodeBuf )
11521152{
11531153 TNode * nG = NULL ;
11541154#if PROFILE >= 2
@@ -1162,12 +1162,12 @@ TNode *Move2Tree(IMeta *I0, CodeBuf *GenCodeBuf)
11621162 IGen * IG ;
11631163 int i , apl = 0 ;
11641164 Addr2Pc * ap ;
1165- CodeBuf * mallmb ;
11661165 unsigned int op ;
11671166
11681167 key = I0 -> npc ;
11691168
1170- TNode * G = calloc (1 , sizeof (TNode ));
1169+ nap = I0 -> ncount + 1 ;
1170+ TNode * G = calloc (1 , sizeof (TNode ) + sizeof (Addr2Pc ) * nap );
11711171 if (G == NULL ) {
11721172 leavedos_main (0x8201 );
11731173 }
@@ -1184,7 +1184,7 @@ TNode *Move2Tree(IMeta *I0, CodeBuf *GenCodeBuf)
11841184 /* ->REPLACE the code of the node found with the latest
11851185 compiled version */
11861186 NodeUnlinker (nG );
1187- if (nG -> mblock ) dlfree (nG -> mblock );
1187+ if (nG -> addr ) dlfree (nG -> addr );
11881188 free (nG );
11891189 }
11901190 else {
@@ -1213,12 +1213,7 @@ TNode *Move2Tree(IMeta *I0, CodeBuf *GenCodeBuf)
12131213 __atomic_store_n (& findtree_cache [key & FINDTREE_CACHE_HASH_MASK ], nG ,
12141214 __ATOMIC_RELAXED );
12151215
1216- nap = nG -> seqnum + 1 ;
1217- mallmb = GenCodeBuf ;
1218- nG -> mblock = GenCodeBuf ;
1219- nG -> pmeta = mallmb -> meta ;
1220- if (nG -> pmeta == NULL ) leavedos_main (0x504d45 );
1221- nG -> addr = (unsigned char * )& mallmb -> meta [nap ];
1216+ nG -> addr = GenCodeBuf ;
12221217
12231218 /* setup structures for inter-node linking */
12241219 nG -> unlinked_jmp_targets = 0 ;
@@ -1242,7 +1237,7 @@ TNode *Move2Tree(IMeta *I0, CodeBuf *GenCodeBuf)
12421237 }
12431238
12441239 /* setup source/xlated instruction offsets */
1245- ap = nG -> pmeta ;
1240+ ap = nG -> meta ;
12461241 I = I0 ;
12471242 for (i = 0 ; i < nG -> seqnum ; i ++ ) {
12481243 ap -> daddr = I -> daddr ;
@@ -1435,7 +1430,7 @@ TNode *FindTree_unlocked(int key)
14351430
14361431static void BreakNode (TNode * G , unsigned char * eip )
14371432{
1438- Addr2Pc * A = G -> pmeta ;
1433+ Addr2Pc * A = G -> meta ;
14391434 int ebase ;
14401435 unsigned char * p ;
14411436 int i ;
@@ -1505,7 +1500,7 @@ int InvalidateNodeRange(int al, int len, unsigned char *eip)
15051500 */
15061501 /* Exclude last instruction, as there is no need to break
15071502 * node after last instruction (it ends there anyway). */
1508- ahE = G -> addr + G -> pmeta [G -> seqnum - 1 ].daddr ;
1503+ ahE = G -> addr + G -> meta [G -> seqnum - 1 ].daddr ;
15091504 if (eip && ADDR_IN_RANGE (eip ,G -> addr ,ahE )) {
15101505 if (debug_level ('e' )> 1 )
15111506 e_printf ("### Node self hit %p->%p..%p\n" ,
0 commit comments