hp.go 784 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. package modern
  2. import (
  3. "fmt"
  4. //cpm "fw/cp/module"
  5. "fw/cp/node"
  6. "fw/cp/object"
  7. rtm "fw/rt2/module"
  8. "fw/rt2/scope"
  9. "reflect"
  10. "ypk/halt"
  11. )
  12. type halloc struct {
  13. area *area
  14. }
  15. func (h *halloc) Allocate(n node.Node, par ...interface{}) scope.ValueFor {
  16. fmt.Println("HEAP ALLOCATE")
  17. _ = rtm.ModuleOfNode(h.area.d, n)
  18. if h.area.data == nil {
  19. h.area.data = append(h.area.data, newlvl())
  20. }
  21. switch v := n.(type) {
  22. case node.VariableNode:
  23. switch t := v.Object().Complex().(type) {
  24. case object.PointerType:
  25. panic(0)
  26. //h.area.data[0].alloc(mod, nil, )
  27. default:
  28. halt.As(100, reflect.TypeOf(t))
  29. }
  30. default:
  31. halt.As(101, reflect.TypeOf(v))
  32. }
  33. return nil
  34. }
  35. func (h *halloc) Dispose(n node.Node) {}
  36. func (a *halloc) Join(m scope.Manager) { a.area = m.(*area) }