Skip to content

Instantly share code, notes, and snippets.

View georgemorgan's full-sized avatar

George Morgan georgemorgan

View GitHub Profile
@georgemorgan
georgemorgan / HVML_hotspots.txt
Created November 7, 2024 13:30
Annotated hotspots for the HVM3 optimization challenge
--------------------------------------------------------------------------------
-- Metadata
--------------------------------------------------------------------------------
Invocation: /usr/bin/cg_annotate --auto=yes cachegrind.out.1943
Command: ./hvm3
Events recorded: Ir
Events shown: Ir
Event sort order: Ir
Threshold: 0.1%
Annotation: on
/*
The purpose of the implementation is to drive an event subsystem that allows events that arise on any of the attached platforms to trigger
callbacks on other attached platforms, called observers.
*/
/* Message system block diagram.
ls_msg_send -> lf_endpoint_enqueue -> if the endpoint is not asynchronous (as is dma), then the message is sent out immediately
lf_msg_recieve -> wait until the message has been marked recieved
#define z(x) strlen(x)
#define d(x) *(char*)(x)
#define i(x) d(x++)
int t;int c(char*o,char*q){if(*o>9){if(o==q){memmove(q+1,q,++t);d(q)=0;o++;}*o-=10;d(o-1)+=1;c(o-1,q);}}void f(char*a,char*b,char*o){char*l,*s,*q=o;int la,lb,ls;((la=z(a))>(lb=z(b)))?(l=a,s=b):(l=b,s=a);ls=z(s);t=z(l);while((i(o)=i(l)-'0')+'0');o=q+t-1;while(ls--){d(o--)+=d(s+ls)-'0';c(o+1,q);}o=q;while(i(o)+='0');q[t]=0;}