pxt-common-packages 10.1.10 → 10.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1504,7 +1504,19 @@ int getConfig(int key, int defl) {
1504
1504
  return defl;
1505
1505
  int *cfgData = vmImg->configData;
1506
1506
  #else
1507
- int *cfgData = bytecode ? *(int **)&bytecode[18] : NULL;
1507
+ int *cfgData = NULL;
1508
+ if (bytecode) {
1509
+ cfgData = *(int **)&bytecode[18];
1510
+ } else {
1511
+ // This happens when getConfig() is called before the TypeScript
1512
+ // program starts (exec_binary()). One example is overriding heap size with:
1513
+ // namespace userconfig { export const SYSTEM_HEAP_BYTES = 10000 }
1514
+ unsigned *pc = (unsigned *)functionsAndBytecode;
1515
+ if (*pc++ == 0x4210) {
1516
+ uint16_t *bcode = *((uint16_t **)pc++);
1517
+ cfgData = *(int **)&bcode[18];
1518
+ }
1519
+ }
1508
1520
  #endif
1509
1521
 
1510
1522
  if (cfgData) {
package/libs/base/gc.cpp CHANGED
@@ -455,6 +455,7 @@ static GCBlock *allocateBlockCore() {
455
455
  auto lowMem = getConfig(CFG_LOW_MEM_SIMULATION_KB, 0);
456
456
  auto sysHeapSize = getConfig(CFG_SYSTEM_HEAP_BYTES, 4 * 1024);
457
457
  auto heapSize = GC_GET_HEAP_SIZE();
458
+ DMESG("heap: %d (minus %d sys bytes)", heapSize, sysHeapSize);
458
459
  sz = heapSize - sysHeapSize;
459
460
  if (lowMem) {
460
461
  auto memIncrement = 32 * 1024;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pxt-common-packages",
3
- "version": "10.1.10",
3
+ "version": "10.1.11",
4
4
  "description": "Microsoft MakeCode (PXT) common packages",
5
5
  "keywords": [
6
6
  "MakeCode",