Index: dev/core/src/com/google/gwt/dev/jjs/impl/Pruner.java
===================================================================
--- dev/core/src/com/google/gwt/dev/jjs/impl/Pruner.java	(revision 3723)
+++ dev/core/src/com/google/gwt/dev/jjs/impl/Pruner.java	(working copy)
@@ -966,6 +966,7 @@
       }
       for (JMethod method : program.entryMethods) {
         rescuer.rescue(method);
+        rescuer.rescue(method.getEnclosingType(), true, false);
       }
 
       UpRefVisitor upRefer = new UpRefVisitor(rescuer);
Index: dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java
===================================================================
--- dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java	(revision 3723)
+++ dev/core/src/com/google/gwt/dev/jjs/impl/GenerateJavaScriptAST.java	(working copy)
@@ -375,6 +375,12 @@
     private final JsName globalTemp = topScope.declareName("_");
 
     private final JsName prototype = objectScope.declareName("prototype");
+    
+    /**
+     * The JavaScript functions corresponding to the entry methods of the
+     * program ({@link JProgram#entryMethods}).
+     */
+    private JsFunction[] entryFunctions;
 
     {
       globalTemp.setObfuscatable(false);
@@ -835,6 +841,10 @@
       }
 
       push(jsFunc);
+      int entryIndex = program.entryMethods.indexOf(x);
+      if (entryIndex >= 0) {
+        entryFunctions[entryIndex] = jsFunc;
+      }
       currentMethod = null;
     }
 
@@ -976,15 +986,7 @@
       // types don't push
 
       // Generate entry methods
-      List<JsFunction> entryFuncs = popList(x.entryMethods.size()); // entryMethods
-      for (int i = 0; i < entryFuncs.size(); ++i) {
-        JsFunction func = entryFuncs.get(i);
-        if (func != null) {
-          globalStmts.add(func.makeStmt());
-        }
-      }
-
-      generateGwtOnLoad(entryFuncs, globalStmts);
+      generateGwtOnLoad(entryFunctions, globalStmts);
       generateNullFunc(globalStmts);
 
       // Add a few things onto the beginning.
@@ -1126,6 +1128,12 @@
       currentMethod = x;
       return true;
     }
+    
+    @Override
+    public boolean visit(JProgram x, Context ctx) {
+      entryFunctions = new JsFunction[x.entryMethods.size()];
+      return true;
+    }
 
     @Override
     public boolean visit(JsniMethodBody x, Context ctx) {
@@ -1269,7 +1277,7 @@
       generateTypeId(x, globalStmts);
     }
 
-    private void generateGwtOnLoad(List<JsFunction> entryFuncs,
+    private void generateGwtOnLoad(JsFunction[] entryFuncs,
         List<JsStatement> globalStmts) {
       /**
        * <pre>
@@ -1319,8 +1327,7 @@
       JsBlock callBlock = new JsBlock(sourceInfo);
       jsIf.setElseStmt(callBlock);
       jsTry.setTryBlock(callBlock);
-      for (int i = 0; i < entryFuncs.size(); ++i) {
-        JsFunction func = entryFuncs.get(i);
+      for (JsFunction func : entryFuncs) {
         if (func != null) {
           JsInvocation call = new JsInvocation(sourceInfo);
           call.setQualifier(func.getName().makeRef(sourceInfo));
Index: dev/core/src/com/google/gwt/dev/jjs/impl/SourceGenerationVisitor.java
===================================================================
--- dev/core/src/com/google/gwt/dev/jjs/impl/SourceGenerationVisitor.java	(revision 3723)
+++ dev/core/src/com/google/gwt/dev/jjs/impl/SourceGenerationVisitor.java	(working copy)
@@ -107,12 +107,6 @@
 
   @Override
   public boolean visit(JProgram x, Context ctx) {
-    for (int i = 0; i < x.entryMethods.size(); ++i) {
-      JMethod method = x.entryMethods.get(i);
-      accept(method);
-      newline();
-      newline();
-    }
     for (int i = 0; i < x.getDeclaredTypes().size(); ++i) {
       JReferenceType type = x.getDeclaredTypes().get(i);
       accept(type);
Index: dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java
===================================================================
--- dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java	(revision 3723)
+++ dev/core/src/com/google/gwt/dev/jjs/JavaToJavaScriptCompiler.java	(working copy)
@@ -154,8 +154,8 @@
       throws UnableToCompleteException {
     JMethod bootStrapMethod = program.createMethod(
         program.createSourceInfoSynthetic("Bootstrap method"),
-        "init".toCharArray(), null, program.getTypeVoid(), false, true, true,
-        false, false);
+        "init".toCharArray(), program.getIndexedType("EntryMethodHolder"),
+        program.getTypeVoid(), false, true, true, false, false);
     bootStrapMethod.freezeParamTypes();
 
     JMethodBody body = (JMethodBody) bootStrapMethod.getBody();
Index: dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java
===================================================================
--- dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java	(revision 3723)
+++ dev/core/src/com/google/gwt/dev/jjs/ast/JProgram.java	(working copy)
@@ -66,7 +66,8 @@
           "java.lang.Iterable", "java.util.Iterator",
           "com.google.gwt.core.client.GWT",
           "com.google.gwt.core.client.JavaScriptObject",
-          "com.google.gwt.lang.ClassLiteralHolder",}));
+          "com.google.gwt.lang.ClassLiteralHolder",
+          "com.google.gwt.lang.EntryMethodHolder",}));
 
   static final Map<String, Set<String>> traceMethods = new HashMap<String, Set<String>>();
 
@@ -269,6 +270,7 @@
   }
 
   public void addEntryMethod(JMethod entryPoint) {
+    assert entryPoint.isStatic();
     if (!entryMethods.contains(entryPoint)) {
       entryMethods.add(entryPoint);
     }
@@ -404,6 +406,7 @@
       JReferenceType enclosingType, JType returnType, boolean isAbstract,
       boolean isStatic, boolean isFinal, boolean isPrivate, boolean isNative) {
     assert (name != null);
+    assert (enclosingType != null);
     assert (returnType != null);
     assert (!isAbstract || !isNative);
 
@@ -863,7 +866,6 @@
 
   public void traverse(JVisitor visitor, Context ctx) {
     if (visitor.visit(this, ctx)) {
-      visitor.accept(entryMethods);
       visitor.accept(allTypes);
     }
     visitor.endVisit(this, ctx);
Index: dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/EntryMethodHolder.java
===================================================================
--- dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/EntryMethodHolder.java	(revision 0)
+++ dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/EntryMethodHolder.java	(revision 0)
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2008 Google Inc.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.lang;
+
+/**
+ * This class holds the boot strap entry method that the compiler generates.
+ */
+public class EntryMethodHolder {
+
+}

Property changes on: dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/EntryMethodHolder.java
___________________________________________________________________
Name: svn:mime-type
   + text/x-java
Name: svn:eol-style
   + native

