direct-lstack-alloc.awl 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. FUNCTION FC 20 : VOID
  2. VAR_INPUT
  3. VAR1 : BYTE;
  4. VAR2 : BYTE;
  5. END_VAR
  6. BEGIN
  7. // Check whether VAR1 (VLB 0) was clobbered.
  8. L #VAR1
  9. __ASSERT== __ACCU 1, 1
  10. END_FUNCTION
  11. FUNCTION FC 10 : VOID
  12. BEGIN
  13. L 1
  14. T LB 0 // This directly allocates LB 0
  15. CALL FC 20 (
  16. VAR1 := LB 0,
  17. // This 'B#16#0' immediate implicitly allocates
  18. // space on the L stack.
  19. // It should not overwrite the direct LB 0 allocation.
  20. VAR2 := B#16#0,
  21. )
  22. END_FUNCTION
  23. FUNCTION FC 2 : VOID
  24. VAR_INPUT
  25. BVAR1 : BOOL;
  26. BVAR2 : BOOL;
  27. END_VAR
  28. BEGIN
  29. // Check whether BVAR1 (VLB 0) was clobbered.
  30. __STWRST
  31. U #BVAR1
  32. __ASSERT== __STW VKE, 1
  33. __STWRST
  34. END_FUNCTION
  35. FUNCTION FC 1 : VOID
  36. BEGIN
  37. L 1
  38. T LB 0 // This directly allocates LB 0
  39. CALL FC 2 (
  40. BVAR1 := L 0.0,
  41. // This 'FALSE' immediate implicitly allocates
  42. // space on the L stack.
  43. // It should not overwrite the direct LB 0 allocation.
  44. BVAR2 := FALSE,
  45. )
  46. END_FUNCTION
  47. ORGANIZATION_BLOCK OB 1
  48. BEGIN
  49. CALL FC 1
  50. CALL FC 10
  51. CALL SFC 46 // STOP CPU
  52. END_ORGANIZATION_BLOCK