Skip to content

Commit

Permalink
Cog VM Source VMMaker.oscog-eem.2558
Browse files Browse the repository at this point in the history
Reimplement Spur JIT access to literals and literal variables in #==, #~~ and
push/pop/store literal variable.  Instead of having a run-time read barrier in
JITTED code, add a flag to CogMethod recordiong if a method references a movable
(becommable) literal, and scanning all so flagged methods post-become to follow
becommed literals.  Thank you Clément for a lovely day's programming!!

This reduces code size by about 2.2%.  Performance increase yet to be assessed,
but it should be better than 2.2% (less code, but more compact code means more
methods in the method zone and a more compact working set). Doing so means we
don't have to add all methods to young referrers if OldBecameNew.  Instead we
need add only those with movable literals which after scanning end up with a
new literal.  This scheme works well for 64-bits where sdelecftors are not
directly referenced; instead ithe inline cache (because it is only 32-bits)
contains the literal index of the selector.

Add control of mixed mode arithmetic primitives, controlled by a VM flag
(vmParameterAt: 48 [put:]; and perhaps by vmParameterAt: 75 [put:]).  If the
flag is set (unset by default), arithmetic primitives given both integral and
float primitives will fail instead of coercing and completing.
See Smallissimo blog post

Provide primitiveHighBit (number 575). In the JIT add a new RTL OpCode ClzRR
to allow very fast computation of high bit.

Slang:
Fix an initialization bug for classes referred to in option: pragmas but not
included.  Make sure that all such classes are included in
InitializationOptions as false before initializing.

Fix checkGenerateSurrogate:bytesPerWord: when checking for a new method.
The existing code assumed no new methods were being adeed and so errored
when the cmHasMovableLiteral accessors were generated and checked for.
  • Loading branch information
eliotmiranda committed Sep 10, 2019
1 parent d6238b2 commit f6d5541
Show file tree
Hide file tree
Showing 91 changed files with 256,031 additions and 237,376 deletions.
7 changes: 6 additions & 1 deletion nsspur64src/vm/cogit.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog-nice.2541 uuid: 7141fb7c-1789-49e3-8a91-d1bc5195b727
CCodeGenerator VMMaker.oscog-eem.2558 uuid: ecd4b81e-cfaa-4167-a8ad-c2ebbb4e460b
*/


Expand Down Expand Up @@ -45,6 +45,7 @@ extern void enterCogCodePopReceiver(void);
extern CogBlockMethod * findMethodForStartBcpcinHomeMethod(sqInt startbcpc, CogMethod *cogMethod);
extern void followForwardedLiteralsIn(CogMethod *cogMethod);
extern void followForwardedMethods(void);
extern void followMovableLiteralsAndUpdateYoungReferrers(void);
extern void freeUnmarkedMachineCode(void);
extern void initializeCodeZoneFromupTo(sqInt startAddress, sqInt endAddress);
extern sqInt isPCWithinMethodZone(void *address);
Expand All @@ -70,9 +71,11 @@ extern void unlinkAllSends(void);
extern void unlinkSendsLinkedForInvalidClasses(void);
extern void unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector);
extern void unlinkSendsToFree(void);
extern void unlinkSendsToMachineCodePrimitiveMethodsAndFreeIf(sqInt freeIfTrue);
extern void unlinkSendsToandFreeIf(sqInt targetMethodObject, sqInt freeIfTrue);
extern void addAllToYoungReferrers(void);
extern void freeMethod(CogMethod *cogMethod);
extern sqInt kosherYoungReferrers(void);
extern CogMethod * methodFor(void *address);
extern sqInt methodsCompiledToMachineCodeInto(sqInt arrayObj);
extern sqInt numMethods(void);
Expand All @@ -84,8 +87,10 @@ extern void printCogMethodsWithPrimitive(sqInt primIdx);
extern void printCogMethodsWithSelector(sqInt selectorOop);
extern void printCogYoungReferrers(void);
extern sqInt printOpenPICList(void);
extern sqInt pruneYoungReferrers(void);
extern char * whereIsMaybeCodeThing(sqInt anOop);
extern sqInt numRegArgs(void);
extern sqInt cogMethodHasMachineCodePrim(CogMethod *aCogMethod);
extern sqInt genQuickReturnConst(void);
extern sqInt genQuickReturnInstVar(void);
extern sqInt genQuickReturnSelf(void);
Expand Down
49,038 changes: 24,837 additions & 24,201 deletions nsspur64src/vm/cogitX64SysV.c

Large diffs are not rendered by default.

49,096 changes: 24,866 additions & 24,230 deletions nsspur64src/vm/cogitX64WIN64.c

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions nsspur64src/vm/cogmethod.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* Automatically generated by
CCodeGenerator VMMaker.oscog- nice.2281 uuid: 4beeaee7-567e-1a4b-b0fb-bd95ce302516
CCodeGenerator VMMaker.oscog-eem.2558 uuid: ecd4b81e-cfaa-4167-a8ad-c2ebbb4e460b
*/

typedef struct {
Expand All @@ -13,7 +13,8 @@ typedef struct {
unsigned cmUsageCount : 3;
unsigned cmUsesPenultimateLit : 1;
unsigned cbUsesInstVars : 1;
unsigned cmUnusedFlags : 2;
unsigned cmHasMovableLiteral : 1;
unsigned cmUnusedFlag : 1;
unsigned stackCheckOffset : 12;
} CogBlockMethod;

Expand All @@ -26,7 +27,8 @@ typedef struct {
unsigned cmUsageCount : 3;
unsigned cmUsesPenultimateLit : 1;
unsigned cbUsesInstVars : 1;
unsigned cmUnusedFlags : 2;
unsigned cmHasMovableLiteral : 1;
unsigned cmUnusedFlag : 1;
unsigned stackCheckOffset : 12;
unsigned short blockSize;
unsigned short blockEntryOffset;
Expand Down
Loading

0 comments on commit f6d5541

Please sign in to comment.